Salvage files from ext3 filesystem with physical errors

I have a disk from a crashed Linux laptop with files on it that the unhappy owner would like to have back if at all possible (no backup solutions please). I have not had anything to do with it before. The disk is recognized by both OS X and Ubuntu 11.10:               root@ubuntu1110:~# fdisk -l /dev/sdc          Disk /dev/sdc: 500.1 GB, 500107862016 bytes     255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors     Units = sectors of 1 * 512 = 512 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x80d549b4             Device Boot      Start         End      Blocks   Id  System     /dev/sdc1   *          63   953602334   476801136   83  Linux     /dev/sdc2       953602335   976768064    11582865    5  Extended     /dev/sdc5       953602398   976768064    11582833+  82  Linux swap / Solaris      This looks consistent with a stock installation of a Linux distribution with a swap partition. Unfortunately some rather nasty messages show up in dmesg, after Ubuntu says it cannot mount the sdc1 partition:               [  181.228092] sd 6:0:0:0: [sdc] 976773168 512-byte logical blocks: (500 GB/465 GiB)     [  181.232176] sd 6:0:0:0: [sdc] Write Protect is off     [  181.232181] sd 6:0:0:0: [sdc] Mode Sense: 21 00 00 00     [  181.236359] sd 6:0:0:0: [sdc] No Caching mode page present     [  181.236364] sd 6:0:0:0: [sdc] Assuming drive cache: write through     [  181.246696] sd 6:0:0:0: [sdc] No Caching mode page present     [  181.246707] sd 6:0:0:0: [sdc] Assuming drive cache: write through     [  182.835915]  sdc: sdc1 sdc2 < sdc5 >     [  182.854199] sd 6:0:0:0: [sdc] No Caching mode page present     [  182.854204] sd 6:0:0:0: [sdc] Assuming drive cache: write through     [  182.854208] sd 6:0:0:0: [sdc] Attached SCSI disk     [  218.250174] sd 6:0:0:0: [sdc] Unhandled sense code     [  218.250179] sd 6:0:0:0: [sdc]  Result: hostbyte=DID_ERROR driverbyte=DRIVER_SENSE     [  218.250182] sd 6:0:0:0: [sdc]  Sense Key : Hardware Error [current]      [  218.250187] Info fld=0x0     [  218.250188] sd 6:0:0:0: [sdc]  Add. Sense: No additional sense information     [  218.250193] sd 6:0:0:0: [sdc] CDB: Read(10): 28 00 00 00 01 08 00 00 08 00     [  218.250200] end_request: I/O error, dev sdc, sector 264     [  218.250206] Buffer I/O error on device sdc, logical block 33     [  255.398994] sd 6:0:0:0: [sdc] Unhandled sense code     [  255.399029] sd 6:0:0:0: [sdc]  Result: hostbyte=DID_ERROR driverbyte=DRIVER_SENSE     [  255.399032] sd 6:0:0:0: [sdc]  Sense Key : Hardware Error [current]      [  255.399037] Info fld=0x0     [  255.399038] sd 6:0:0:0: [sdc]  Add. Sense: No additional sense information     [  255.399053] sd 6:0:0:0: [sdc] CDB: Read(10): 28 00 00 00 01 08 00 00 08 00     [  255.399061] end_request: I/O error, dev sdc, sector 264     [  255.399066] Buffer I/O error on device sdc, logical block 33     [  281.340599] sd 6:0:0:0: [sdc] Unhandled sense code     [  281.340609] sd 6:0:0:0: [sdc]  Result: hostbyte=DID_ERROR driverbyte=DRIVER_SENSE     [  281.340618] sd 6:0:0:0: [sdc]  Sense Key : Hardware Error [current]      [  281.340653] Info fld=0x0     [  281.340655] sd 6:0:0:0: [sdc]  Add. Sense: No additional sense information     [  281.340659] sd 6:0:0:0: [sdc] CDB: Read(10): 28 00 00 00 00 67 00 00 08 00     [  281.340667] end_request: I/O error, dev sdc, sector 103     [  281.340739] EXT3-fs (sdc1): error: can't read group descriptor 4      My current theory is that the harddisk has run out of spare blocks so now a real bad block has been introduced and it is in the area used when mounting the partition. This is confirmed by dd:               root@ubuntu1110:~# dd if=/dev/sdc1 of=/dev/null bs=10240 conv=noerror     dd: reading `/dev/sdc1': Input/output error     2+0 records in     2+0 records out     20480 bytes (20 kB) copied, 44.7084 s, 0.5 kB/s     dd: reading `/dev/sdc1': Input/output error     9+1 records in     9+1 records out     96256 bytes (96 kB) copied, 162.933 s, 0.6 kB/s     dd: reading `/dev/sdc1': Input/output error     9+1 records in     9+1 records out     96256 bytes (96 kB) copied, 180.083 s, 0.5 kB/s      Bad blocks early and very slow transmission rate even later in the process (not shown) My problem now is how to approach from here. I need something that can read from a broken ext2/ext3-filesystem so we can copy those files still there off the disk, and I have not done much Linux system administration in the last 15 years so I do not know the right terms for searching. I could probably copy a disk image over night, but then the "this block is bad" information is lost. What kind of program would be useful in this situation?


Wireless rtl8187 freezes intermittently

I am using a wireless USB ALFA 036H. Linux Mint (32-bit) recognizes it without any drivers but it stops downloading/uploading and I have to reconnect to get it to work again. I tried to find a solution so I installed a different driver (the one I was supposed to use) and the problem changed: it stops downloading/uploading for few seconds (3-10) then just move on and start downloading/uploading again. Any ideas? More info:   * Linux Mint 32-bit    * device: ALFA AWUS036H USB wireless Adapter, 802.11g High power   * driver: rtl8187  Note: feel free to ask for more information. lsmod output:               Module                  Size  Used by     rtl8187                56206  0      mac80211              257001  1 rtl8187     cfg80211              156212  2 rtl8187,mac80211     eeprom_93cx6           12653  1 rtl8187     snd_seq_dummy          12686  0      cryptd                 19801  0      aes_i586               16956  1      aes_generic            38023  1 aes_i586     arc4                   12473  2      binfmt_misc            13213  1      dm_crypt               22463  0      vesafb                 13449  1      nvidia               9766978  50      snd_hda_codec_realtek   255882  1      ipt_REJECT             12512  1      ipt_LOG                12784  4      snd_hda_intel          24113  5      snd_hda_codec          90901  2 snd_hda_codec_realtek,snd_hda_intel     snd_hwdep              13274  1 snd_hda_codec     snd_pcm                80042  3 snd_hda_intel,snd_hda_codec     snd_seq_midi           13132  0      snd_rawmidi            25269  1 snd_seq_midi     snd_seq_midi_event     14475  1 snd_seq_midi     snd_seq                51291  3 snd_seq_dummy,snd_seq_midi,snd_seq_midi_event     snd_timer              28659  2 snd_pcm,snd_seq     snd_seq_device         14110  4 snd_seq_dummy,snd_seq_midi,snd_rawmidi,snd_seq     ppdev                  12849  0      xt_limit               12541  6      xt_tcpudp              12531  8      ipt_addrtype           12535  4      snd                    55295  18 snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_rawmidi,snd_seq,snd_timer,snd_seq_device     parport_pc             32111  1      xt_state               12514  9      joydev                 17322  0      ip6table_filter        12711  1      psmouse                73312  0      ip6_tables             22545  1 ip6table_filter     nf_nat_irc             12542  0      nf_conntrack_irc       13138  1 nf_nat_irc     nf_nat_ftp             12548  0      nf_nat                 24827  2 nf_nat_irc,nf_nat_ftp     nf_conntrack_ipv4      19024  11 nf_nat     nf_defrag_ipv4         12649  1 nf_conntrack_ipv4     nf_conntrack_ftp       13106  1 nf_nat_ftp     nf_conntrack           69744  7 xt_state,nf_nat_irc,nf_conntrack_irc,nf_nat_ftp,nf_nat,nf_conntrack_ipv4,nf_conntrack_ftp     iptable_filter         12706  1      ip_tables              18125  1 iptable_filter     soundcore              12600  1 snd     x_tables               21907  10 ipt_REJECT,ipt_LOG,xt_limit,xt_tcpudp,ipt_addrtype,xt_state,ip6table_filter,ip6_tables,iptable_filter,ip_tables     snd_page_alloc         14073  2 snd_hda_intel,snd_pcm     serio_raw              12990  0      lp                     13349  0      parport                36746  3 ppdev,parport_pc,lp     usbhid                 41704  0      hid                    77084  1 usbhid     dm_raid45              88410  0      xor                    21860  1 dm_raid45     btrfs                 527388  0      zlib_deflate           26594  1 btrfs     libcrc32c              12543  1 btrfs     8139too                23208  0      8139cp                 22497  0      floppy                 60032  0      r8169                  42534  0


Why do backgrounded processes sometimes stop spontaneously?

Sometimes, some time after I've backgrounded a process with `bg` in bash, when I press Enter in the same shell to redisplay the prompt (just to check that I'm still in bash when some output from the background process has been displayed), the background process seems to stop spontaneously. If I do `bg` again the same problem recurs. The only way to fix it seems to be `fg`. Why does this happen?


Login automatically as root

I am working with a board and when it finishes the boot, appears the login. What I want to do is login as root but automatically. I mean I want to do that when boot is finish, I can see the prompt, without login.


Change the number of generated /dev/tty devices

I'm building an embedded Linux system, based on Gentoo. Using udev, all tty devices are probed with a `PROGRAM` stanza to determine if they are a modem. Right now the system boots up with 64 `/dev/tty*`. When udev probes the tty devices, the system runs out of memory. How can I reduce the number of produced tty devices to 4? Is this an OS setting or a kernel setting?


Failed to load session Ubuntu and to fetch .archive.ubuntu.com

was downloading some updates like almost every day and a message about some files to remove or replace I think (I'm not sure) that I've accepted to replace without knowing I confess what is it about, I had to restart PC to Windows 7 for something and forgetting that downloads and installations on Ubuntu were not finished.. The result after comeback to Ubuntu (12.04) is the message: failed to load session Ubuntu and lower graphics both two sessions and after accepting my password, can't us my mouse I was searching in Ubuntu by Windows some answers and I've tried in terminal after starting PC:               sudo apt-get update     sudo apt-get install ubuntu-desktop     sudo apt-get install -f install     sudo dpkg-reconfigure ubuntu-desktop     sudo reboot      and:               sudo apt-get update     sudo apt-get install unity-2d     sudo apt-get install ubuntu-desktop     sudo apt-get install compizconfig-settings-manager     sudo apt-get install compiz-plugins-extra     sudo apt-get update      and:               sudo apt-get install gnome-session     sudo apt-get install lightdm     sudo apt-get install unity-greeter     sudo dpkg-reconfigure lightdm      and:               sudo apt-get install ubuntu-session      and:               purge/install gnome-session      and:               gnome-accessibility-themes      and:               apt-get upgrade      and many others I forget but always fail in the end by:enable to fetch dz.archive.ubuntu.com I couldn't find something satisfying in launchpad about replacing my archive source and it was a little hard for me to understand.. I'm in 12.04 lt's since 2 years and months, that the first prob like that. Hope you help me.


sudo: no tty present and no askpass program specified

I have a perl script that I fork from another script that I launch from a web browser via mod_perl. The forked script (which ends up running as apache) needs to `sudo service X stop` as part of a backup restore process: the X service depends on the restore. I had this running OK on Windows, but now porting to CentOS I'm running into the error in the title. Setup:   1. sudoers file has commented out `# Defaults requiretty`   2. sudoers file has `apache_usr localhost=(root) NOPASSWD: /sbin/service X stop` (which passes a `visudo -c` check) and has no other `apache_usr` lines Things I've tried:   1. `sudo /sbin/service` instead of just `sudo service` in the forked process   2. sudoers file with or without commenting out `Defaults !visiblepw`   3. sudoers file with `(ALL)` instead of `(root)` in the NOPASSWD line above What else is there to try?


Editing Truecrypt Hidden Volume's Outer Volume?

I just created a tor hidden (plausible deniability) volume. I used a 32GB USB flash drive, for the outer volume, and made the inner volume 20GB. Does this mean that I can safely add another ~12GB of data to the outer volume without corrupting the hidden inner volume? I'd like to store my bank statements on the outer one, so I should never need more than 1GB. When creating the inner volume, it said that it would be better to make it smaller to allow for more storage space in the outer volume, but when I finished making the inner volume, it said not to modify the outer volume under any circumstances.


How do I `umount` /proc?

I am following this tutorial on how to do a firmware update to my NAND flash. I followed it only changing the directory where I am placing my new root. I am copying all of the `/bin` `/dev` `/sbin` `/usr` folders into a `tmpfs` that I have located in `RAM`. The following commands are where I start running into problems:               umount /sys     umount /proc      If I `killall5` `sys` unmounts without a problem but then when I try to unmount proc it gives me:               umount: can't umount /proc: Device or resource busy      I have tried using `chroot` similar to this link on a similar issue. But it doesn't seem to help much. I tried to chroot to my newroot, using the following command but it then gives me more grief:               chroot /tmp/newroot /bin/ash      Error:               umount: can't umount /proc: Invalid argument      Could someone point me in the right direction? I'm getting the feeling I'm missing something trivial, as is ussually the case.


How can I get Bash to display the auto-completion definitions for a given command?

I use `module` command to load and unload stuff to my environment, some of the machines I use have proper auto-completion others do not. I'm wondering if I it possible to know where the completion comes from and install elsewhere.


how to count number of differences in large streams quickly?

I want to count the number of differences (different bytes) in two large streams (devices/files). E.g. two hard disks, or one hard disk and `/dev/zero`. The program(s) involved must be fast, as fast as the streams come in (say 1GB/s, although 0.2GB/s is probably OK), and they may use at most a few GB of RAM and of tmp files. In particular, there is no filesystem available that is big enough to store the differences to be counted. The streams are several TB in size. The count need not (and in fact must not) treat whitespace or line feeds any different than other characters. The streams are binary-only and not interpret-able as text. I said streams, although the devices are actually seek-able. But for speed reasons, all should preferably be done with one single streaming pass without seeks, if possible. What I tried so far:               cmp -l /dev/sda /dev/sdb | wc      But this is way to slow; `wc` alone uses one CPU core >50% and the output is only about 2MB/s, which is too slow by a factor of 100.


Emacs change font of a single word (or sentence), not of the whole buffer

Somehow I don't find a way of changing the font size of a specific string of text. I know how to do it globally or temporarily for the whole buffer.Changing the default font is not the issue here. Sometimes I use math symbols like ω, Ω or ב and want to change these to a bigger font. I'd need a simple way of doing this. Alternatives to make these symbols more visible are welcome too.


What environment do I get with sudo?

When I run sudo, what exactly happens to my environment? When I run `sudo command`, it doesn't seem to see my or root's environment. For example, my path for both includes `/usr/local/bin`, but if I try to run one of the program's without the full path, it fails. I thought sudo ran as root, and hence got root`s environment. Is there a different way that bash executes under sudo than under root or my normal user? EDIT: I have been using `sudo -i` lately, but recently it has been causing problems because my current working directory gets set to `/root`. This is as expected (sorta), but I still don't understand why sudo isn't recognizing my executables in `/usr/local/bin`. EDIT: I am running Fedora 15.


SSH tunnel through middleman server - how to connect in one step (using key pair)?

My question is basically how to turn my existing two steps into one step. I have a working SSH tunnel set up between two computers using a middleman server like this:               Kubuntu_laptop--->nat_fw--->Debian_Server<--nat_fw<--Kubuntu_desktop      What I do presently is SSH from Kubuntu_laptop to Debian_Server and then from Debian_Server to Kubuntu_desktop. I would like to make that one SSH command, issued on my Kubuntu_laptop in bash that results in my being connected to the Kubuntu_desktop (shell/bash). The commands I am using now are as follows. Step 1:               me@kubuntu_laptop:~$ ssh -i ~/.ssh/id_rsa admin@debian_server        Step 2:               admin@debian_server:$ ssh -p 1234 -i /home/admin/.ssh/id_rsa admin@localhost       Then I am connected to the kubuntu_desktop via SSH (from kubuntu_laptop). RSA keys are required for all SSH connections. Password login is disabled all the way around. And notice that the computer user accounts are different at two of the computers. Regarding the connection for this leg:               Debian_Server<--nat_fw<--Kubuntu_desktop      Here is how it is established:               autossh -M 5234 -N -f -R 1234:localhost:22 user@mydebian.com -p 22      Notice Kubuntu_desktop connects to middleman as user@mydebian.com (not admin@debian_server). But when I connect to Kubuntu_desktop, I connect as admin user. I cannot change the existing monitoring port (5234) or the remote (- R) port number (1234 in this example). I cannot change the SSH security to allow password logins. I cannot open up any new firewall ports. I can't change user accounts (except on laptop).


Slow wifi on Intel N 6235

I have extremely slow wifi connection on my linux mint. The network controller is `Intel Corporation Centrino Advanced-N 6235 (rev 24)`. I found on the ubuntu wiki a fix: `sudo rmmod iwlwifi && sudo modprobe iwlwifi 11n_disable=1` I got: `Error: Module iwlwifi is in use by: iwldvm` So I did: `sudo rmmod iwldvm`, `sudo rmmod iwldvm` (went fine then) and `sudo modprobe iwlwifi 11n_disable=1` My wlan0 was not up, so I started the iwldvm too. `sudo modprobe iwldvm` Unfortunately the internet is still too slow. I tried different approaches but nothing worked. Mainly I am confused that the wifi worked fine for a week, now I am experiencing such troubles. I've read that the kernel upgrade to 3.10 should fix this, but I can't boot that one and 3.9 didn't fix this. Is it possible that my machine (asus zenbook prime) is using different thing then the `iwlwifi`? I am just asking because I found a file in /etc/modprobe.d/ called iwlwifi.conf which contains:               # /etc/modprobe.d/iwlwifi.conf     # iwlwifi will dyamically load either iwldvm or iwlmvm depending on the     # microcode file installed on the system.  When removing iwlwifi, first     # remove the iwl?vm module and then iwlwifi.     remove iwlwifi \     (/sbin/lsmod | grep -o -e ^iwlmvm -e ^iwldvm -e ^iwlwifi | xargs /sbin/rmmod) \     && /sbin/modprobe -r mac80211      The `lsmod | grep iwlwifi` command gives me:               iwlwifi               173477  1 iwldvm     cfg80211              510937  3 iwlwifi,mac80211,iwldvm


Unwanted messages every time I attempt to login?

I am using Linux Mint Olivia and it worked fine for past couple of months but from yesterday it keep showing these message whenever I want to login to my PC: > Keys: Press S to skip mounting or M for manual recovery If I press `s`, then it shows another message: > Keys: Continue to wait , or press S to skip mounting or M for manual > recovery If I press `s`, then it allows me to login. Can any one tell me how can I login normally? Contents of my `/etc/fstab`:               UUID=e1867541-6f11-4fd8-8121-2318248cb9c4 / ext4 errors=remount-ro 0 1      # swap was on /dev/sda9 during installation      UUID=8f655fe6-92c5-43c8-9655-2c2b3485a836 none swap sw 0 0     UUID=[C59C-D751] /media/[bappu] vfat user,uid=1000,gid=100,dmask=027,fmask=137 0 0


Cross Compile GMP and Openswan for ARM

I have to cross compile `opensawn` for a OMAP4 Board and GMP is prerequisite. First I tried it on 64 bit OS but it gave me this error: > configure: error: Oops, mp_limb_t is 64 bits, but the assembler code in this > configuration expects 32 bits. Then I shifted to Ubuntu 12.04 32 Bit and the GMP V6.0.0 got compiled after few trials. Even after having the ARCH, TOOLCHAIN and CROSS_COMPILER variables in `.bashrc` I had to `export` the following:               export ARCH=arm
     export PATH=/home/harsh32bit/Work/Projects/BSQ_VVDN/BISQUARE/gcc-SourceryCodeBenchLite-arm/bin/:$PATH
     export CROSS_COMPILE=arm-none-linux-gnueabi-
      Then following commands were observed:                 ./configure --build=i686-pc-linux-gnu --host=arm-none-linux-gnueabi --prefix=/home/harsh32bit/Work/Projects/BSQ_VVDN/BISQUARE/gcc-SourceryCodeBenchLite-arm/          make clean     make     make install      Then Soft-linking GMP Library to Toolchain               ~/Work/Projects/BSQ_VVDN/BISQUARE/gcc-SourceryCodeBenchLite-arm/lib/gcc/arm-none-linux-gnueabi/4.7.3       # ln -s ~/Work/Projects/BSQ_VVDN/packages/gmp-6.0.0/.libs/libgmp.so libgmp.so      I had the GMP compiled successfully although the `make check` reported all test failed.               9 of 9 tests failed.      Now when I try to cross compile Openswan-2.6.41 after making changes in CROSSCOMPILE.sh and do this `make programs` I get this error: > In file included from > /home/harsh32bit/Work/Projects/BSQ_VVDN/packages/openswan-2.6.41/include/certs.h:24:0,from > /home/harsh32bit/Work/Projects/BSQ_VVDN/packages/openswan-2.6.41/lib/libopenswan/id.c:42: > /home/harsh32bit/Work/Projects/BSQ_VVDN/packages/openswan-2.6.41/include/secrets.h:20:41: > fatal error: gmp.h: No such file or directory compilation terminated I have gone to TI E2E site for this, sniffed internet for pointers in last 4 weeks but I couldn't figure out. If anyone has any clue about cross compiling `openswan` and `GMP` please advise me.


"IPv6 support is disabled" warnings

I get the error while running a script which tries to send emails.               send-mail: warning: inet_protocols: IPv6 support is disabled: Address family not supported by protocol     send-mail: warning: inet_protocols: configuring for IPv4 support only     postdrop: warning: inet_protocols: IPv6 support is disabled: Address family not supported by protocol     postdrop: warning: inet_protocols: configuring for IPv4 support only      Could anyone say what is the issue, do I require some permission?


Overwriting disk before encryption

I'm going to create encrypted lvm on my disk. As a encryption mechanism I choose dmcrypt with LUKS. Here's my question - should I overwrite (for security reasons) whole disk before creating encrypted container, or overwrite already encrypted container (there is some information at cryptsetup FAQ - step 6) or both? Does it matter?


Execute a file if a command is not found

When I try to execute files in Linux, I'm always annoyed by the need to write `./executablefile` instead of just `executablefile`. I get why it's done, so it won't have an ambigous input, one that is a command and also a file. But I want it to execute the file if a command is not found (commands have priority). I made a tweak through a guide that if you write a command and it's not found, it searches it in the `pacman` database and tells me in which package the command is at, so I know it's possible to do something when it says `command not found`. Is there a good way to do this?


Send email if specified files do not exist

I am new to unix scripting. I have to do something like : In a folder /x everyday 10Pm and next day 3 AM, 2 files are placed. I have to write a script which will check the folder /x and confirm if the files are there or not and send mails accordingly everyday. file formats:   * `ValuationIR**02092013**_0326` (FileName pattern: `ValuationIR<date>_<time>.csv` )   * `SnapshotIR**02082013**_2238` (FileName pattern: `SnapshotIR<date>_<time>.csv` ) Could someone help on how can I achieve the same, and which all commands would be required.


Logrotate not picking up or acting on new configuration file

I had a `logrotate` configuration file set up for a log (let's call it _Log1_ ). It is working fine and the log is rotating everyday as expected. Yesterday I cloned this set up and modified it for three more log files _Log2, Log3 and Log4_. These log files already exist on disk, and are being actively written to. However, when checked today, the three log files did not rotate at all. I was expecting them to rotate along with the first log file _Log1_. But only _Log1_ was rotated, and the rest ( _Log2_ to _Log4_ ) weren't touched at all. If I place new configuration files for `logrotate`, **do I have to run a command to "activate" them so`logrotate` will start rotating the log files?** I thought since it's a `cron` job running at 4 am everyday, it will automatically pick up the new files and rotate files. Is there some sort of manual activation needed? What's strange is that the `/var/lib/logrotate.status` file seems to show (with today's date) that **all four** log files were looked at by `logrotate`. So, why did `logrotate` skip the three new log files that obviously need rotating? * * * **Configuration file:**               /path/to/Log1.log {         compress         compresscmd /usr/bin/bzip2         compressext .bz2         compressoptions -9         copytruncate         daily         dateext         delaycompress         extension .log         notifempty         missingok         nomail         olddir Log1         rotate 100         maxage 60     }      There shouldn't be anything wrong with the configuration file, since it works fine for _Log1_. The `olddir` directory is already created for all the logs. When running `logrotate -d` (debug mode), it says `log does not need rotating` for all four logs. I understand this is correct for `Log1` since it's already rotated, but what about the others? Does it have anything to do with `after 1 days`? Does `logrotate` first mark the new file's date in `logrotate.status` file, then only rotate when one day has elapsed since the last mark? **How is the status file used by`logrotate`?**


How does SuSE Linux's support for btrfs differ from Ubuntu and Fedora's?

The SuSE Linux Enterprise Server 11 Service Pack 2 release notes state that SuSE offers "commercial support" for btrfs, while Ubuntu and Fedora appear to be holding back until a working fsck utility is available. Does SuSE have some special tools/people to support btrfs that other distros don't? (N.B. I'm aware that Oracle Linux also offers commercial support for btrfs, but they employ the main developer, so I can see how they have a special support capability).


Load application with module load and specify a different name from the default

I am using my local workstation to run applications stored on our local cluster. To load and run an application, I normally use:               module load xxx      However, there is a an application on my computer that already has the same name as a module I am trying to load. I am afraid there might be a conflict when I load such a module. Is there a way similar to Python (`import xxx as yyy`) to load a module and specify a different name to it. Something like:               module load xxx as yyy


Methods to diagnose why an application works for local user account but fails on a network user account?

I have setup a CentOS 6.5 machine that is attached to my company's domain. The OS is configured to allow Active Directory authentication so we do not have to have separate usernames and passwords to login into it. The application ANSYS Mechanical works fine when I launch it while logged in with a local (non AD) account. However, when its launched while logged in with my AD account, it reports:               Script Error     Line: 25959     Char: 2     Error: Object required     Code: 800a01a8     Source: Microsoft JScript runtime error     Script: var pg=pm.PreferencesCategories.Item("CATNAME_DesignModeler").PreferencesGroups;      My question is, what tools and methods should I be using to help me diagnose this odd issue? The aim would be to either fix a possible bad setting at my end or to communicate to the software vendor my problem. The software vendor would not help since the application does work with regular local user account, however, if I have more specific info I could approach the developers. I feel that there is some configuration setting that is causing this.


Execute a program at login

I'm running Arch-Linux ARM on a Raspberry Pi. My project goal is to have a barcode scanner attached to the Pi that forwards the scanned messages to a server in a LAN. To harden the system against power outages etc. and minimize required user interaction, I wish to set it up, so that a certain user is logged in automatically at startup(done and works) and a specific program is to be run at startup(done and works but not as intended). I've done this so far by adding               exec mono scannerSoftware.exe 127.0.0.1 1234 randomString      to `/home/certainUser/.bash_profile` so it gets executed only once even when I'm switching back and forth to root (in contrast to bashrc). The particular problem I am having: When I launch the system it works as intended (login as certainUser, starting scannerSoftware.exe), BUT if I want to switch users and hit `Ctrl`+`C` it restarts the login process, logging certainUser in again and running the program again => back to where I came from.   My guess as to why this happens is that the sys detects "login not complete, better start it again" I could circumvent this by spamming `Ctrl`+`C` right around the login, so that I practically interrupted it. Of course this is not good practice, suffice to say it is not practical at all. My question:   How can I set it up, so the program gets executed AFTER login is complete, so that `Ctrl`+`C`'ing out brings me to a normal bash promt as certainUser instead of beginning the endless login-cycle? EDIT:   I'm not using any graphical interface or such, only commandline (bash on tty), because when done the system won't even have a display.


Apache CGI proxy returning 502 Bad Gateway on Fedora

I need to configure Apache as a proxy on Fedora and am using a CGI script to define allowable domains. This approach has worked in the past on Windows but now on a Fedora Server I am getting the following error: NetworkError: 502 Bad Gateway - `http://localhost/cgi- bin/proxy.cgi?url=http%3A%2F%2F000.0.0.000%2Fgeoserver%2Fwfs"` (I have anonymised the IP address as it's my test server). This URL is successful: `http://localhost/cgi-bin/proxy.cgi` demonstrating that my proxy.cgi script is in the right place. I have added the following domains to my allowable list:               localhost, 000.0.0.000, localhost/geoserver/wfs, 000.0.0.000/geoserver/wfs      (obviously I'm substituting the real IP address in the actual CGI script) I notice that the url causing the error is coming through as `http%3A%2F%2F000.0.0.000%2Fgeoserver%2Fwfs` instead of `http://000.0.0.000/geoserver/wfs` and I wonder if this is the problem but don't know how to resolve it.


Meaning of Crossing filesystem boundaries, --one-file-system, etc

I'm planning to use rsnapshot to backup my whole Linux system, though I'm confused by `-x` option (same of `one_fs` in `rsnapshot.conf`). The man page says: > -x one filesystem, don't cross partitions within each backup point I understand it's not a specific rsnapshot option since rsync, cp, tar and other commands provide this feature as well. Does file system boundaries refers to different partitions? Different mount points? And what does it mean to don't "cross" them? Back to my case, I read many people suggesting to use `-x` with rsnapshot, but I'm wondering if doing so is not going to compromise the completeness of my backup. I want to backup everything under `/`, including `/boot` and `/home`, which reside on dedicated partitions of the same disk, while at the same time I don't want to backup files and directories not strictly belonging to my system, like `/mnt`, `/media`, etc. Executing `mount` command on my system gives the following output. Pratically, using `rsnapshot -x`, what will be included and what will be left out?               /dev/sda7 on / type ext4 (rw,errors=remount-ro)     proc on /proc type proc (rw,noexec,nosuid,nodev)     sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)     none on /sys/fs/fuse/connections type fusectl (rw)     none on /sys/kernel/debug type debugfs (rw)     none on /sys/kernel/security type securityfs (rw)     udev on /dev type devtmpfs (rw,mode=0755)     devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)     tmpfs on /tmp type tmpfs (rw,noexec,nosuid)     tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)     none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)     none on /run/shm type tmpfs (rw,nosuid,nodev)     /dev/sda6 on /boot type ext3 (rw)     /dev/sda8 on /home type ext4 (rw)     binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)     gvfs-fuse-daemon on /home/myuser/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=myuser)


SED : Case Match Pattern Replacement

I have a source code spread across several files.   * It has a pattern `abcdef` which I need to replace with `pqrstuvxyz`.   * The pattern could be `Abcdef` (Sentence Case) then it needs to be replaced with `Pqrstuvxyz`.   * The pattern could be `AbCdEf` (Toggle case) then it needs to be replaced with `PqRsTuVxYz`. In short, I need to match the case of the source pattern and apply the appropriate destination pattern. How can I achieve this using `sed` or any other tool?


copy a single file from local repository GIT

I need to copy a SINGLE FILE from LOCAL REPOSITORY to my machine, not `git- pull` or `git-fetch`, how can i do it? Is it possible to get it via hash ? such as `a3ea2118bf1c5e2c6aa0974d0b6ff7415bd044ef` ?


How can I ssh to a remote server with an automated password and no key?

I have a remote server. I planned to use public keys to connect over ssh without typing the password but the remote system rejects public key authentication. So what is the best way to do it? What about using `sshpass`?


Graphic glitches with Llano APU in gnome 3 (Arch)

I recently installed Arch Linux on my Mini-ITX machine using the recommended `xf86-video-ati` driver for the AMD Llano-APU. XFCE works -- with compositing -- ~~perfectly fine~~ , but Gnome 3 shows a lot of glitches, like you can see in the pictures below. Any ideas how to fix this, without using the proprietary Catalyst driver? * * * **Update** XFCE also has some (subtle) glitches. * * * output of `lspci`:               00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 10h-1fh) Processor Root Complex     00:00.2 IOMMU: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 10h-1fh) I/O Memory Management Unit     00:01.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Trinity [Radeon HD 7540D]     00:01.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Trinity HDMI Audio Controller     00:10.0 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB XHCI Controller (rev 03)     00:10.1 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB XHCI Controller (rev 03)     00:11.0 SATA controller: Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] (rev 40)     00:12.0 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB OHCI Controller (rev 11)     00:12.2 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller (rev 11)     00:13.0 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB OHCI Controller (rev 11)     00:13.2 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB EHCI Controller (rev 11)     00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller (rev 14)     00:14.1 IDE interface: Advanced Micro Devices, Inc. [AMD] FCH IDE Controller     00:14.2 Audio device: Advanced Micro Devices, Inc. [AMD] FCH Azalia Controller (rev 01)     00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge (rev 11)     00:14.4 PCI bridge: Advanced Micro Devices, Inc. [AMD] FCH PCI Bridge (rev 40)     00:14.5 USB controller: Advanced Micro Devices, Inc. [AMD] FCH USB OHCI Controller (rev 11)     00:15.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Hudson PCI to PCI bridge (PCIE port 0)     00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 10h-1fh) Processor Function 0     00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 10h-1fh) Processor Function 1     00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 10h-1fh) Processor Function 2     00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 10h-1fh) Processor Function 3     00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 10h-1fh) Processor Function 4     00:18.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h (Models 10h-1fh) Processor Function 5     02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168 PCI Express Gigabit Ethernet controller (rev 06)      ![glitch_1](http://i.stack.imgur.com/NKifo.jpg) ![glitch_2](http://i.stack.imgur.com/x6qcr.jpg)


No sound since I first pressed "mute" on my keyboard

I have a problem with sound. I once pressed the mute button on my keyboard and since then I couldn't do anything to get the sound back on my headphones (obviously, including pressing mute again). I tried to go into alsamixer and everything seems okay, except the headphone, which seems like it has no volume at all (and it says: `Item: Headphone [Off, Off]`) and I also can't increase it. As for the rest (master, pcm, surround, center etc) are all okay. My sound card is a HDA Intel, Realtek ALC1200.               uname -a:     Linux ... 3.2.0-53-generic-pae #81-Ubuntu SMP Thu Aug 22 21:23:47 UTC 2013 i686 i686 i386 GNU/Linux      Any clue? * * *


script works fine on client machine but doesnt work in nagios

purpose: nagios check for kannel stuck     Date : dec 8, 2013          /etc/init.d/kannel status | grep -i -E "SMS: received" | awk '{ print $3 }' > kannel_temp_1.txt       /etc/init.d/kannel status | grep -i -E "SMS: received" | awk '{ print $7 }' > kannel_temp_2.txt         /etc/init.d/kannel status | grep -i -E "SMS: received" | awk '{ print $3 }' > kannel_temp_3.txt         /etc/init.d/kannel status | grep -i -E "SMS: received" | awk '{ print $7 }' > kannel_temp_4.txt          recvsms1=$(cat kannel_temp_2.txt) sentsms2=$(cat kannel_temp_3.txt) recvsms2=$(cat kannel_temp_4.txt)          if [ $sentsms1 == $sentsms2 ] && [ $recvsms1 == $recvsms2 ];     then        exitcode=0        statustxt=ok         else        exitcode=2        statustxt=critical        fi          echo "$exitcode - $statustxt"      My script works fine on client machine but returns the wrong information (always critical) in nagios.


How to move the first x files

I have this huge folder with thousands of unordered files. Is it feasible to move the first 5000s to a subfolder via the `mv` command? For now I move files with                mv *some_pattern* ./subfolder1/      As for now, I move images quite randomly, it's not really important if there aren't exactly 5000 files in each subfolder. Is there a better way to do it?


Sending HTML with Mutt (or another terminal mail client)

While I can find some scattered info on the topic, I can't seem to find a straight walkthrough (or even a definite answer)... Basically I'm too low on the totem pole to start sending plain-text e-mails. My company requires an HTML signature that includes the logo image. The problem is I'm fed up with GUI mail clients. Is it possible to configure Mutt in a way that would allow me to have all messages I write injected to an HTML template (with an embedded image)? Or will I just have to deal with Thunderbird's chaos? Thanks for any help!


VIM -Change waiting time for combined key maps

In VIM, When I map for example `<F9><F10>` to a command and `<F9>` to another command , it waits for 1-2 seconds when I press F9 to allow me press `<F10>` to access the command mapped to `<F9><F10>` and if I don't press `<F10>` it executes the command mapped to `<F9>`. Is there a way to change this waiting time?


Is it bad practice to set root's shell to something other than the default?

Once a friend of mine (who is an experienced Unix/Linux user) told me that setting root's shell to something other than sh (i.e bash or zsh) might create problems, because some script might assume that the shell is sh and do something weird. However, I think Ubuntu have default root shell set to bash, and Gentoo uses bash too. Can somebody bust the myth?


pressing @ in the keyboard gives " (and # gives £ ) in mint16

Hello I am using mint16(cinnamon). When I try to write @ it shows ". That is, key functioning of these two keys has got swapped somehow. Can someone please suggest a way to get rid of this problem.


Difference between references of Linux "utilities", "commands" and "programs"

I read uses of the word "utilities" for commands/programs such as 'ls', 'chmod', 'mv', etc. Is "commands" is Linux referring to the same things as `top`, `ps`, etc., or are those something different? What about "programs"? Are those the ones that don't come with the standard distribution which need to be installed like `irssi`, `emacs`, `kismet`, etc.?


Howto install gcc on NetBSD 6.1.2?

I did a minimal install of NetBSD 6.1.2 and thought it would be easy to install a working gcc package. But even after `pkg_add -r gcc48 gcc48-libs` and adding gcc to the path, gcc is still not able to compile simple programs. Which packages do I need and which additional config steps are necessary ?


How much can the space allocated for an LVM snapshot be reduced?

I created an LVM snapshot, then I modified the original logical volume, and now I see that I probably allocated too much space to hold the snapshot. And I want to reclaim some free space by reducing the space allocated for the snapshot. How can I check how much the space allocated for a snapshot can be reduced without breaking the snapshot? In other words: How to find out the space actually needed at the current moment for a snapshot to continue to exist? (If I know this minimal necessary size, then I probably can simply use `lvreduce` to reclaim more free space for the VG from the snapshot.)


API with no system calls

The book 'Understanding Linux Kernel' says that **'for something abstract such as math functions, there may be no reason to make system calls'**. Can any one please explain how is a system call not required in math functions? Isn't the CPU involved in mathematical operations? Can anyone give an example of such a program?


Issues with libGL on Fedora 20 - unable to load driver swrast?

Firstly, before I explain my problem, I have referred to the question previously asked on Ask.Fedora about the libGL error, which can be seen here. I have been trying to play the game "FTL - Faster Than Light", and I have been running into problems where the graphics perform extraordinarily poorly, and the sound keeps turning into a strange buzzing sound. Upon looking further, I noticed that my Terminal outputted the following message during the game's launch.               libGL error: failed to load driver: swrast     libGL error: Try again with LIBGL_DEBUG=verbose for more details.      After doing some further research, it would appear that this issue has affected multiple people on numerous distributions of Linux, all with different solutions. Below, I have provided as much information as I can to help diagnose my specific issue. This also seems to be similar to Bug 971437 on the Red Hat bug tracker When getting libGL debug info on glxinfo:               $ LIBGL_DEBUG=verbose glxinfo | grep direct     libGL: screen 0 does not appear to be DRI2 capable     libGL: OpenDriver: trying /usr/lib64/dri/tls/swrast_dri.so     libGL: OpenDriver: trying /usr/lib64/dri/swrast_dri.so     libGL: Can't open configuration file /home/jflory/.drirc: No such file or directory.     libGL: Can't open configuration file /home/jflory/.drirc: No such file or directory.     direct rendering: Yes      I have a feeling there is some sort of issue with my graphics card, because I am VERY new to Linux and I'm unsure about what I may need to properly be able to run games. Below, I have some of the numerous packages I have tried to install during this process.               $ cat /etc/ld.so.conf.d/nvidia-lib64.conf     cat: /etc/ld.so.conf.d/nvidia-lib64.conf: No such file or directory          $ cat /etc/ld.so.conf.d/nvidia-lib.conf     cat: /etc/ld.so.conf.d/nvidia-lib.conf: No such file or directory          $ sudo yum install mesa-libglapi     Loaded plugins: langpacks, refresh-packagekit     Package mesa-libglapi-9.2.5-1.20131220.fc20.x86_64 already installed and latest version     Nothing to do          $ sudo yum install xorg-x11-drv-nvidia-libs.i686     Loaded plugins: langpacks, refresh-packagekit     No package xorg-x11-drv-nvidia-libs.i686 available.     Error: Nothing to do      I have installed a few more things across the course of the night, but none of them seemed to have done any good, so I don't _think_ they are relevant. If any more information is needed, please let me know and I will provide. As a reminder, I am very new to Linux in general and I am still learning, so I am not the most familiar with all the different UNIX operations I am able to do. Here's a quick rundown of my system specs:               $ uname -a     Linux localhost.localdomain 3.12.5-302.fc20.x86_64 #1 SMP Tue Dec 17 20:42:32 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux          $ grep "model name" /proc/cpuinfo     model name      : Intel(R) Core(TM) i3-3120M CPU @ 2.50GHz      ## Edit #1 I ran `sudo yum install mesa-dri-drivers` and it appeared it is already installed on my system.               $ sudo yum install mesa-dri-drivers     Loaded plugins: langpacks, refresh-packagekit     Dropbox                                            |  951 B     00:00          google-chrome                                      |  951 B     00:00          updates/20/x86_64/metalink                         |  18 kB     00:00          updates                                            | 4.6 kB     00:00          updates/20/x86_64/primary_db                         | 3.0 MB   00:06          updates/20/x86_64/updateinfo   FAILED                                               ftp://mirror.nexicom.net/pub/fedora/linux/updates/20/x86_64/repodata/updateinfo.xml.gz: [Errno 14] curl#56 - "response reading failed"     Trying other mirror.     (1/2): updates/20/x86_64/updateinfo                  | 309 kB   00:01          (2/2): updates/20/x86_64/pkgtags                     | 755 kB   00:23          Package mesa-dri-drivers-9.2.5-1.20131220.fc20.x86_64 already installed and latest version     Nothing to do      ## Edit #2 After executing `lspci -vvv -s 00:02.0`, my output was the following:               # lspci -vvv -s 00:02.0     00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09) (prog-if 00 [VGA controller])         Subsystem: Toshiba America Info Systems Device fa20         Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-         Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-         Interrupt: pin A routed to IRQ 16         Region 0: Memory at c8000000 (64-bit, non-prefetchable) [size=4M]         Region 2: Memory at c0000000 (64-bit, prefetchable) [size=128M]         Region 4: I/O ports at 4000 [size=64]         Expansion ROM at <unassigned> [disabled]         Capabilities: [90] MSI: Enable- Count=1/1 Maskable- 64bit-             Address: 00000000  Data: 0000         Capabilities: [d0] Power Management version 2             Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)             Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-         Capabilities: [a4] PCI Advanced Features             AFCap: TP+ FLR+             AFCtrl: FLR-             AFStatus: TP-


Enabling apt repository priority in LMDE

I want to set up apt repository priority ordering in Linux Mint Debian Edition 2012.04. In `/etc/apt/preferences` the order should be: LMDE -> Debian testing -> Debian unstable. In other words, I almost always want to use packages from LMDE semi-rolling repository, and only sometimes get them from testing and unstable only when absolutely necessary. I looked at http://forums.linuxmint.com/viewtopic.php?f=201&t=78882 and http://forums.linuxmint.com/viewtopic.php?f=141&p=379226, but still have not been able to get repository priority ordering to work correctly. What is the best way to do this?


Torrent with GUI for Gnome on CentOS 6?

I'm running Gnome Desktop on CentOS, I was wondering if anyone knows of a good Torrent program like uTorrent that will run on Gnome CentOS? If so does anyone have a tutorial on how to install it.


Grub doesn't recognize windows 8

Recently, I installed Windows 8.1 and Linux Mint Debian Edition on a new laptop. Neither installs seemed to have any issues, and both operating systems run well. However, the only way I can switch between the two is by going to the boot menu and changing their boot priorities. Grub won't recognize windows 8, and windows boot manager throws an error if I add linux mint as an entry (using easybcd) and try to run it from there. I've disabled both secure boot and fast boot. My grub.cfg does seem to have an entry for windows 8, it just doesn't show up when I boot my computer. Here's what it looks like: http://pastebin.com/W98CdEA9 I've looked for solutions online already, but most people who have the same problem either didn't receive an answer at all, or received an answer specific to their case that doesn't seem to work for mine. This is my first time dual booting, so I'm not sure what other relevant information I should include, so feel free to ask for anything needed.


SVN: How to move the project from one repository to another repository

I am working on SVN. Actually I created 3 projects under the same repository. Now I created 2 new repositories. Actually I want to move the existing two projects into these repositories. I installed Subversion on Ubuntu 12.04.


Centos VFS cannot open root device

Yesterday I did a kernel update on a virtual machine. When I restarted the machine unfortunately I got the error `Kernel panic - not syncing VFS` After some searching I found out I should go to GRUB and just select the old kernel and everything would be fine. Wel I selected the old kernel but came to the following error; `VFS: Cannot open root device "mapper/vg_cpanel-lv_root` ![Error trace](http://i.stack.imgur.com/bzb3a.png) So after some digging I found, this question somewhere else. I went to rescue mode and do `vim /boot/grub/device.map` and 1 line appears `(fd0) /dev/fd0` (nothing more). I did a fdisk -l; ![enter image description here](http://i.stack.imgur.com/9iD2l.png) But there ends the train for me, unfortunately. Following are 2 screen shots of my grub command; ![All commands](http://i.stack.imgur.com/K1qRY.png) ![kernel command](http://i.stack.imgur.com/DXuhU.png) I hope someone can point me in the right direction.


Internet routing between wlan0 and ppp0?

On my Debian Linux device, I have a USB-modem that is connected to the Internet. Its interface name is ppp0. I also have a USB-wireless adapter, where I am hosting a Access Point. Its interface name is wlan0. How to I route traffic between these interfaces, so that if my phone is connected to this AP, that I can access the Internet via ppp0? EDIT 1: I tried setting up some routing, but does not seem to work. Here are the details:               # iptables --list-rules     -P INPUT ACCEPT     -P FORWARD ACCEPT     -P OUTPUT ACCEPT     -A FORWARD -i ppp0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT     -A FORWARD -i wlan0 -o ppp0 -j ACCEPT          # iptables --list-rules -t nat     -P PREROUTING ACCEPT     -P INPUT ACCEPT     -P OUTPUT ACCEPT     -P POSTROUTING ACCEPT     -A POSTROUTING -o ppp0 -j MASQUERADE      EDIT 2 SOLVED: I was able to solve my problem. I was using the same subnet for wlan0 and ppp0. When using different subnets for wlan0 and ppp0, everything worked fine. I also found this article useful: http://elinux.org/RPI-Wireless- Hotspot


Cloud Server: Which MTA (exim/postfix/etc.) on What OS (Linux/FreeBSD)

My company wants to migrate the current mail server into a Cloud Server Provider. The Provider is the IaaS (Infrastructure as a Service) kind, not SaaS (Software as a Service). That means I have to install the OS + MTA myself. I'd really appreciate it if you can give me a guidance, pro/con analysis, experience, etc. on the following combinations:   * Exim on Linux   * Postfix on Linux   * Exim on FreeBSD   * Postfix on FreeBSD   * (other MTA)* on Linux/FreeBSD *Please do not suggest **sendmail** and/or **qmail**. Thank you all for your kind assistance. PS: When I've made my choice, I'll change the question title to '[Solved]' and post my choice.


How to determine if two devices are connected in network?

Is there a free linux softwear to determine if two network devices are connected? Or a php class can be also good... I'd like to draw the network topology. I can determine the devices in the network with zenmap (it saves the results to file), but I don't know which device connected to which device... (zenmap can also draw topology, but it doesn't save it to file)


What tools allow me to present man pages as formatted HTML on a web server?

What tools exist to make man pages available on a system available via HTTP and link topics together such that references in the `SEE ALSO` sections and elsewhere will become hyperlinks in the HTML representation of the man pages? I'm using Debian (6) and Ubuntu (10.04, 10.10) currently, so existing packages would be preferred, but I'll also go for any other solutions if they are clearly superior.


lshw lists my drive but it has no /dev file

Ive just got a dedicated server which has 2x 1TB HDD. However when I type `df -h` I get the following:               [root@sd-56537 ~]# df -h     Filesystem      Size  Used Avail Use% Mounted on     /dev/sda2       916G  688G  182G  80% /     tmpfs           7.8G  368K  7.8G   1% /dev/shm     /dev/sda1       194M   61M  124M  34% /boot      How can I access the 2nd drive ? EDIT:               [root@sd-56537 ~]# fdisk -l          Disk /dev/sda: 999.7 GB, 999653638144 bytes     255 heads, 63 sectors/track, 121534 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes     Sector size (logical/physical): 512 bytes / 512 bytes     I/O size (minimum/optimal): 512 bytes / 512 bytes     Disk identifier: 0x000d74f9             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *           1          26      204800   83  Linux     Partition 1 does not end on cylinder boundary.     /dev/sda2              26      121404   974966784   83  Linux     /dev/sda3          121404      121534     1048576   82  Linux swap / Solaris     [root@sd-56537 ~]#      **Here are some things that have been tried:**               [root@sd-56537 ~]# udevadm trigger --verbose --dry-run | grep disk      /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/host0/target0:1:0/0:1:0:0/scsi_disk/0:1:0:0      * * *                [root@sd-56537 ~]# ls -l /dev/disk/by-id;      total 0      lrwxrwxrwx 1 root root 9 Jan 2 13:38 scsi-3600508e00000000019b5485ed592d30e -> ../../sda      lrwxrwxrwx 1 root root 10 Jan 2 13:38 scsi-3600508e00000000019b5485ed592d30e-part1 -> ../../sda1      lrwxrwxrwx 1 root root 10 Jan 2 13:38 scsi-3600508e00000000019b5485ed592d30e-part2 -> ../../sda2      lrwxrwxrwx 1 root root 10 Jan 2 13:38 scsi-3600508e00000000019b5485ed592d30e-part3 -> ../../sda3      lrwxrwxrwx 1 root root 9 Jan 2 13:38 wwn-0x600508e00000000019b5485ed592d30e -> ../../sda      lrwxrwxrwx 1 root root 10 Jan 2 13:38 wwn-0x600508e00000000019b5485ed592d30e-part1 -> ../../sda1      lrwxrwxrwx 1 root root 10 Jan 2 13:38 wwn-0x600508e00000000019b5485ed592d30e-part2 -> ../../sda2      lrwxrwxrwx 1 root root 10 Jan 2 13:38 wwn-0x600508e00000000019b5485ed592d30e-part3 -> ../../sda3      * * *               [root@sd-56537 ~]# lshw | grep -A 5 disk      *-disk:0 UNCLAIMED      description: ATA Disk      product: TOSHIBA MG03ACA1      vendor: Toshiba      physical id: 0.0.0      bus info: scsi@0:0.0.0      --      *-disk:1      description: SCSI Disk      product: Virtual Disk      vendor: Dell      physical id: 1.0.0      bus info: scsi@0:1.0.0      --      *-disk:2 UNCLAIMED      description: ATA Disk      product: TOSHIBA MG03ACA1      vendor: Toshiba      physical id: 0.1.0      bus info: scsi@0:0.1.0      [root@sd-56537 ~]#      * * *               [root@sd-56537 ~]# blkid      /dev/sda2: UUID="b93f6b9d-163e-4231-bac0-204ce290f0af" TYPE="ext4"      /dev/sda1: UUID="858364a4-263a-4e78-9ec5-ed6b23471377" TYPE="ext4"      /dev/sda3: UUID="6a4a69e0-6378-4c65-b7ba-e78e0b38013a" TYPE="swap"      [root@sd-56537 ~]#


Detecting monitor on boot time?

I am using my laptop in several monitor configurations that do require xorg.conf (say, I am driving a T221 from my laptop) and it's very inconvenient to manually switch them. Is there something in /sys which tells me if something is plugged into a DVI connector? Or a utility or ...?


awk regex matches wrong?

Playing around with awk I noticed this behavior:               [root@ror6ax3 ~]# grep open * | awk '$2 ~ /opens*/ {print $0}'     install.log:Installing openldap-2.4.23-32.el6_4.1.x86_64     install.log:Installing openssl-1.0.1e-15.el6.x86_64     install.log:Installing openssh-5.3p1-94.el6.x86_64     install.log:Installing openssh-clients-5.3p1-94.el6.x86_64     install.log:Installing openssh-server-5.3p1-94.el6.x86_64     install.log:Installing b43-openfwwf-5.2-4.el6.noarch     [root@ror6ax3 ~]# grep open * | awk '$2 ~ /opens */ {print $0}'     install.log:Installing openssl-1.0.1e-15.el6.x86_64     install.log:Installing openssh-5.3p1-94.el6.x86_64     install.log:Installing openssh-clients-5.3p1-94.el6.x86_64     install.log:Installing openssh-server-5.3p1-94.el6.x86_64      Why would `opens*` match `openldap` ?


Ctrl-C handling in SSH session

When I start an SSH session that executes a long-running command, what happens with `Ctrl`+`C` (SIGINT) handling? I can see that the SSH session is closed, but I am not sure who gets the SIGINT first: is it...   1. the remote long-running command? that is, (a) the signal handler in the remote command is called and stops the remote command, (b) the shell that spawned it detects that the command stopped, and stops as well (c) the remote sshd detects the shell stopped, so it closes the connection or   2. the local ssh receives the signal, and closes the connection. I think that (1) is happening, but want to make sure. I am also uncertain about what happens with shell handling of SIGINTs in this case. For example, if I ...               ssh remote 'while true ; do sleep 1 ; date ; done'      and `Ctrl`+`C`, then the remote connection is dropped. Is there a way to run the remote command under a shell that will stay alive after `Ctrl`+`C`? That is, in this case, stop the loop and allow me to keep working on the remote shell?


Error Installing "ia32-libs" to run ADB and Fastboot Linux Mint 16 "Petra"

I have been trying to get `adb`, `fastboot`, `avd` and others to work with the latest version of Linux Mint (16 "Petra") I originally got this error when trying to run ADB:               ➜  platform-tools  ./adb     ./adb: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory      After looking around I found suggestions saying that you need to install 32-bit compatibility libraries. So, I tried to install the package `ia32-libs`, which, however, failed horribly.               ➜  ~  sudo apt-get install ia32-libs                                        Reading package lists... Done     Building dependency tree            Reading state information... Done     Some packages could not be installed. This may mean that you have     requested an impossible situation or if you are using the unstable     distribution that some required packages have not yet been created     or been moved out of Incoming.     The following information may help to resolve the situation:          The following packages have unmet dependencies:      ia32-libs :               Depends: bluez-alsa:i386 but it is not going to be installed              Depends: gstreamer0.10-plugins-base:i386 but it is not going to be installed              Depends: gstreamer0.10-plugins-good:i386 but it is not going to be installed              Depends: gtk2-engines:i386 but it is not going to be installed              Depends: gtk2-engines-murrine:i386 but it is not going to be installed              Depends: gtk2-engines-oxygen:i386 but it is not going to be installed              Depends: gtk2-engines-pixbuf:i386 but it is not going to be installed              Depends: gvfs:i386 but it is not going to be installed              Depends: ibus-gtk:i386 but it is not going to be installed              Depends: libacl1:i386 but it is not going to be installed              Depends: libao4:i386 but it is not going to be installed              Depends: libasound2:i386              Depends: libasound2-plugins:i386 but it is not going to be installed              Depends: libasyncns0:i386 but it is not going to be installed              Depends: libattr1:i386 but it is not going to be installed              Depends: libaudio2:i386 but it is not going to be installed              Depends: libcanberra-gtk-module:i386 but it is not going to be installed              Depends: libcap2:i386 but it is not going to be installed              Depends: libcapi20-3:i386 but it is not going to be installed              Depends: libcups2:i386 but it is not going to be installed              Depends: libcupsimage2:i386 but it is not going to be installed              Depends: libcurl3:i386 but it is not going to be installed              Depends: libdbus-glib-1-2:i386 but it is not going to be installed              Depends: libesd0:i386 but it is not going to be installed              Depends: libfontconfig1:i386 but it is not going to be installed              Depends: libfreetype6:i386 but it is not going to be installed              Depends: libgail-common:i386 but it is not going to be installed              Depends: libgconf-2-4:i386 but it is not going to be installed              Depends: libgdbm3:i386 but it is not going to be installed              Depends: libgettextpo0:i386 but it is not going to be installed              Depends: libglapi-mesa:i386 but it is not going to be installed              Depends: libglu1-mesa:i386 but it is not going to be installed              Depends: libgphoto2-6:i386 but it is not going to be installed              Depends: libgphoto2-port10:i386 but it is not going to be installed              Depends: libgtk2.0-0:i386 but it is not going to be installed              Depends: libmpg123-0:i386 but it is not going to be installed              Depends: libncursesw5:i386 but it is not going to be installed              Depends: libnspr4:i386 but it is not going to be installed              Depends: libnss3:i386 but it is not going to be installed              Depends: libodbc1:i386 but it is not going to be installed              Depends: libopenal1:i386 but it is not going to be installed              Depends: libpulse-mainloop-glib0:i386 but it is not going to be installed              Depends: libpulsedsp:i386 but it is not going to be installed              Depends: libqt4-dbus:i386 but it is not going to be installed              Depends: libqt4-network:i386 but it is not going to be installed              Depends: libqt4-opengl:i386 but it is not going to be installed              Depends: libqt4-qt3support:i386 but it is not going to be installed              Depends: libqt4-script:i386 but it is not going to be installed              Depends: libqt4-scripttools:i386 but it is not going to be installed              Depends: libqt4-sql:i386 but it is not going to be installed              Depends: libqt4-svg:i386 but it is not going to be installed              Depends: libqt4-test:i386 but it is not going to be installed              Depends: libqt4-xml:i386 but it is not going to be installed              Depends: libqt4-xmlpatterns:i386 but it is not going to be installed              Depends: libqtcore4:i386 but it is not going to be installed              Depends: libqtgui4:i386 but it is not going to be installed              Depends: libqtwebkit4:i386 but it is not going to be installed              Depends: librsvg2-common:i386 but it is not going to be installed              Depends: libsane:i386 but it is not going to be installed              Depends: libsdl-image1.2:i386 but it is not going to be installed              Depends: libsdl-mixer1.2:i386 but it is not going to be installed              Depends: libsdl-net1.2:i386 but it is not going to be installed              Depends: libsdl-ttf2.0-0:i386 but it is not going to be installed              Depends: libsdl1.2debian:i386 but it is not going to be installed              Depends: libsqlite3-0:i386 but it is not going to be installed              Depends: libssl0.9.8:i386 but it is not going to be installed              Depends: libssl1.0.0:i386 but it is not going to be installed              Depends: libstdc++5:i386 but it is not going to be installed              Depends: libstdc++6:i386 but it is not going to be installed              Depends: libxaw7:i386 but it is not going to be installed              Depends: libxml2:i386 but it is not going to be installed              Depends: libxp6:i386 but it is not going to be installed              Depends: libxslt1.1:i386 but it is not going to be installed              Depends: libxss1:i386 but it is not going to be installed              Depends: libxtst6:i386 but it is not going to be installed              Depends: odbcinst1debian2:i386 but it is not going to be installed              Depends: xaw3dg:i386 but it is not going to be installed              Depends: libgl1-mesa-dri:i386 but it is not going to be installed              Depends: libgl1-mesa-glx:i386 but it is not going to be installed              Depends: libpam-winbind:i386 but it is not going to be installed     E: Unable to correct problems, you have held broken packages.      Any help would be very much appreciated. EDIT: After following Rmano's suggestion to run this: `sudo apt-get install libc6:i386 libgcc1:i386 gcc-4.6-base:i386 libstdc++5:i386` I got this error about unmet dependencies:               ➜  ~  sudo apt-get install libc6:i386 libgcc1:i386 gcc-4.6-base:i386 libstdc++5:i386 libstdc++6:i386     [sudo] password for insanity:      Reading package lists... Done     Building dependency tree            Reading state information... Done     Some packages could not be installed. This may mean that you have     requested an impossible situation or if you are using the unstable     distribution that some required packages have not yet been created     or been moved out of Incoming.     The following information may help to resolve the situation:          The following packages have unmet dependencies:     libgcc1 : Breaks: libgcc1:i386 (!= 1:4.8.1-10ubuntu9) but 1:4.8.1-10ubuntu8 is to be installed     libgcc1:i386 : Depends: gcc-4.8-base:i386 (= 4.8.1-10ubuntu8) but it is not going to be installed                 Breaks: libgcc1 (!= 1:4.8.1-10ubuntu8) but 1:4.8.1-10ubuntu9 is to be installed     libstdc++6:i386 : Depends: gcc-4.8-base:i386 (= 4.8.1-10ubuntu8) but it is  not going to be installed     E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused  by held packages.      EDIT 2: It seems that I have to downgrade to an older version of a view core utils, however, I'm not sure that it is a safe idea.


Shell Script : Check for all the source files in different paths

This is the naming convention of the file.               <yearmonthdate>_<sourcesystem>_<totalnoofpartsof file>_<subject area>_<part number>.dat (or .dat.gz)      First part is Date, Second part is source system from where the file is coming from. Third part is the number of parts for the file. Which means there will be 3 files. Forth part is for which subject area Fifth part is part of the file. **In this example**               20131121_A01_003_SALES_001.dat.gz     20131121_A01_003_SALES_002.dat     20131121_A01_003_SALES_003.dat      `20131121` is date `A01` is source system `003` is number of parts in that file `SALES` is the community `001`, `002`, `003` are the part numbers of the file. Extension can be either `.dat` or `.dat.gz` **REQUIREMENT:** Now, there are a number of source systems and for each source system there is a path               /in/inroot/source/A01     /in/inroot/source/A02     /in/inroot/source/A03     /in/inroot/source/X04     /in/inroot/source/C06     /in/inroot/source/DN1      When we run the script, by passing subject area as argument, it should check in all the paths that files are present for that subject and should also check if it has all the parts for yesterday. **Example:**               sh filecheck.sh CUSTOMER      It should go into each of the paths mentioned above and check if `20131120_A01_002_CUSTOMER_001.dat` and `20131120_A01_002_CUSTOMER_002.dat` are present in `A01`. Similarly in all other folders. The number of parts is also dynamic. If the file is missing from any source system or any part of the file is missing it should write those to a separate file. I know I am asking too much, but it is a bit urgent and I don't have time to play around.


Should I confirm/verify an existing Debian bug?

I am currently experiencing similar issues as reported in this bug on my Debian laptop (similar symptoms, different software). I've read the documentation on bug reporting but I'm not sure what is considered best practice in this situation. Obviously I shouldn't create an new report if one already exists for this bug, but is it good practice to send a "me too" message to confirm that the bug actually exists, or will that just create unnecessary clutter? If so, should I send a simple email to `<number>@bugs.debian.org` describing my basic setup, or is more required?


How can I boot the PC-BSD live DVD-ISO IMAGE directly via GRUB2?

Via the loopback command, GRUB2 allows to directly boot an ISO file. Now, I've configured the according _menuentry_ to boot the PC-BSD **Live DVD ISO** , but when I try to boot it, the _FreeBSD bootstrap loader_ outputs:               can't load 'kernel'      **Here is the GRUB2 menuentry I currently use:**               menuentry "PC-BSD" {             search --no-floppy --fs-uuid --set root 0d11c28a-7186-43b9-ae33-b4bd351c60ad             loopback loop /PCBSD9.0-RC1-x64-DVD-live.iso             kfreebsd (loop)/boot/loader     }      **Does one know how I'd need to amend that in order to be able to boot the PC- BSD live system?**


Stripped down Kernel for a Laptop

I am a Linux noob, but I am willing to learn. My immediate objective is to compile a small kernel for my laptop without sacrificing usability. I am familiar with the kernel compilation steps (don't necessarily understand the process). What are the options I can get rid of in menuconfig for a faster, **slimmer** kernel? I have been using the trial and error method, i.e uncheck unused filesystems and drivers, but this is a painfully slow process. Can somebody point me towards things I **should not** touch or a better way of going about this process? This little "project" is for recreation only. System Specs and OS:   i7 580M, Radeon HD5850, 8Gb DDR3, MSI Motherboard x86_64 Ubuntu 11.10.


GTK-2 error when installing Glassfish plugin for Eclipse on Fedora 16 64-bit

I have Eclipse running fine on my Fedora 16. I was following these instructions to install the Glassfish Tools Bundle for Eclipse (which has to be done outside Eclipse through its own installer) and, after I went through the installer successfully, the next step was to launch the eclipse launcher in the plugin directory (so not the regular Eclipse launcher). I got the following error:               > ./eclipse          (eclipse:2300): Gtk-WARNING **: Unable to locate theme engine in module_path: "clearlooks",          (eclipse:2300): Gtk-WARNING **: Unable to locate theme engine in module_path: "clearlooks",          (eclipse:2300): Gtk-WARNING **: Unable to locate theme engine in module_path: "clearlooks",          (eclipse:2300): Gtk-WARNING **: Unable to locate theme engine in module_path: "clearlooks",          (eclipse:2300): Gtk-WARNING **: Unable to locate theme engine in module_path: "clearlooks",          (eclipse:2300): Gtk-WARNING **: Unable to locate theme engine in module_path: "clearlooks",          (eclipse:2300): Gtk-WARNING **: Unable to locate theme engine in module_path: "clearlooks",          (eclipse:2300): Gtk-WARNING **: Unable to locate theme engine in module_path: "clearlooks",          (eclipse:2300): Gtk-WARNING **: Unable to locate theme engine in module_path: "clearlooks",          (eclipse:2300): Gtk-WARNING **: Unable to locate theme engine in module_path: "clearlooks",          (eclipse:2300): Gtk-WARNING **: Unable to locate theme engine in module_path: "clearlooks",          (eclipse:2300): Gtk-WARNING **: Unable to locate theme engine in module_path: "clearlooks",          (eclipse:2300): Gtk-WARNING **: Unable to locate theme engine in module_path: "clearlooks",          (eclipse:2300): Gtk-WARNING **: Unable to locate theme engine in module_path: "clearlooks",          (eclipse:2300): Gtk-WARNING **: Unable to locate theme engine in module_path: "clearlooks",          (eclipse:2300): Gtk-WARNING **: Unable to locate theme engine in module_path: "clearlooks",          (eclipse:2300): Gtk-WARNING **: Unable to locate theme engine in module_path: "clearlooks",     Gtk-Message: Failed to load module "pk-gtk-module"     Gtk-Message: Failed to load module "canberra-gtk-module"      That was reported in the terminal. The GUI that popped up briefly said there is also an error log file under ~/workspace/.metadata/.log, which has the following:               !SESSION 2012-09-27 22:18:52.512 -----------------------------------------------     eclipse.buildId=M20090917-0800     java.version=1.6.0_16     java.vendor=Sun Microsystems Inc.     BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US     Framework arguments:  -pluginCustomization plugin_customization.ini -showsplash org.eclipse.platform     Command-line arguments:  -os linux -ws gtk -arch x86 -pluginCustomization plugin_customization.ini -showsplash org.eclipse.platform          !ENTRY org.eclipse.equinox.p2.directorywatcher 4 0 2012-09-27 22:19:01.715     !MESSAGE The installable unit org.eclipse.jdt.compiler.apt.translated_host_properties is missing the filename property.          !ENTRY org.eclipse.osgi 4 0 2012-09-27 22:19:07.181     !MESSAGE Application error     !STACK 1     java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3555 or swt-pi-gtk in swt.library.path, java.library.path or the jar file         at org.eclipse.swt.internal.Library.loadLibrary(Library.java:254)         at org.eclipse.swt.internal.Library.loadLibrary(Library.java:159)         at org.eclipse.swt.internal.gtk.OS.<clinit>(OS.java:22)         at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63)         at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54)         at org.eclipse.swt.widgets.Display.<clinit>(Display.java:131)         at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:516)         at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:161)         at org.eclipse.ui.internal.ide.application.IDEApplication.createDisplay(IDEApplication.java:143)         at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:88)         at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)         at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)         at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)         at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)         at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)         at java.lang.reflect.Method.invoke(Method.java:597)         at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)         at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)         at org.eclipse.equinox.launcher.Main.run(Main.java:1311)     !SESSION 2012-09-27 22:22:17.706 -----------------------------------------------     eclipse.buildId=M20090917-0800     java.version=1.6.0_16     java.vendor=Sun Microsystems Inc.     BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US     Framework arguments:  -pluginCustomization plugin_customization.ini -showsplash org.eclipse.platform     Command-line arguments:  -os linux -ws gtk -arch x86 -pluginCustomization plugin_customization.ini -showsplash org.eclipse.platform      I found this site but I can't follow the instructions there to save my life. All I understand is that GTK-2 needs some 32-bit libs even though the system is 64-bit but it is trying to open 64-bit ones. Help please


Modification and Access time of a file?

Is it possible to change the file modification time without changing the file acess time?


ls gives me different sort orders during a cron job

I have a cron job that, among other things, does a recursive ls of a directory into a file. This gets compared to another file that I've created that, supposedly, contains an identical listing of the same directory. My problem is that, when I generate the version for comparison, I get the files listed in case-insensitive order. When the cron job runs, its list comes out in case- sensitive order. How can I get both of these to come out the same way (I don't care which)? My call to ls is `/bin/ls -lR --time-style=long-iso *`; as far as I can tell, LC_COLLATE is not set in either setting.


Preserve ownership with rsync and nonexistent user

I have two computers with the same user, me@Home and me@Work. I usually kept their folders synced by bringing Work home (it's a laptop) and rsyncing over LAN. However, now I'm not bringing Work home anymore, so I started using the uni's ssh server to keep my computers synced.               me@Work -> my_name@Uni     me@Home <- my_name@Uni      However, when rsyncing from Work to Uni, using `-avuz`, which should preserve ownership, file ownership is lost. I made some tests and the issue seems to be the unmatched "me" user at Uni. Not only that, directories owned by www-data also didn't have their ownership preserved (since there isn't such user at Uni either), which, one can imagine, caused me some trouble. I don't have root access at Uni nor can my username be changed. Is there anyway I can make this work without setting up a ssh server myself or start bringing Work home again?


Online grep exercises?

Are there any online grep tutorials that would feature some online tool for performing exercises? For example, having some predefined text sample and being told what patterns to find and so forth? It would be a very useful tool for practical learning of grep in a predictable environment.


/dev/sdb keeps changing to whatever disk contains Windows 7?

I am trying to install Windows 7 on `/dev/sda` and Ubuntu 12.04 on `/dev/sdb`. Initially I installed Windows 7 on (call it disk 1) and when I begun installing Ubuntu it said Windows 7 was on `/dev/sdb`. Therefore I deleted Win 7 and re-installed windows on disk 2 (I didnt change any boot priorities in the BIOS). However, when I then went to install Ubuntu for a second time Windows 7 was still on `/dev/sdb`.   In other words `/dev/sdb` had changed from disk 1 to disk 2 when all I did was delete the Windows partition and install it on the other disk. I don't get why the disk I install Windows 7 on becomes `/dev/sdb` when I go to install Ubuntu.


Awk with multiple delimiters

I am trying to execute `awk` on something like this :               <tag x="whatever" y="http://mysite.com/somewords/word1/word2/word3/word4">      I would like to extract `word2` which comes forever after `word1`, knowing that `somewords` does not always exist. I was able to do it using `awk`, but I used it 3 times, each time with one delimiter. Is there any way to merge multiple `awk` commands with multiple delimiters, or simply one `awk` command to pick out `word2`?


How to print a partial list of alias definitions in tcsh?

I'm working on Fedora 18 with tcsh on a network with a lot of pre-defined aliases. I'm adding my own personal aliases as well, but I want to be able to display these in a separate list. Right now I have a `.cshrc` file that loads alias definitions from a `.alias` file. This is the file with the pre-defined aliases. I thought to create a second file named `.myalias`, put my personal aliases there, and have `.cshrc` load that as well. That works fine. Sadly, using the `alias` command only lists ALL defined aliases. I want to list only my personal aliases from the `.myalias` file, but in the same format as the output from the `alias` command. Is there a way to do this?


Command substitution in for loop not working

I want to keep all files **not** ending with `.bat` I tried               for f in $(ls | egrep -v .bat); do echo $f; done      and               for f in $(eval ls | egrep -v .bat); do echo $f; done      But both approaches yield the same result, as they print everything. Whereas `ls | egrep -v .bat` and `eval ls | egrep -v .bat` work per se, if used apart from the `for` loop. **EDIT** It's interesting to see that if I leave out the `-v` flag, the loop does what it should and lists all files ending with `.bat`. * * * Feel free to edit the question title, as I was not sure what the problem is. I'm using `GNU bash, version 4.1.10(4)-release (i686-pc-cygwin). ` * * * **EXAMPLE**               $ ls -l | egrep -v ".bat"     total 60K     -rwx------+ 1 SYSTEM SYSTEM 5.3K Jun  6 20:31 fsc*     -rwx------+ 1 SYSTEM SYSTEM 5.3K Jun  6 20:31 scala*     -rwx------+ 1 SYSTEM SYSTEM 5.3K Jun  6 20:31 scalac*     -rwx------+ 1 SYSTEM SYSTEM 5.3K Jun  6 20:31 scaladoc*     -rwx------+ 1 SYSTEM SYSTEM 5.3K Jun  6 20:31 scalap*      Command is working, but not in the for loop.               $ for f in $(ls | egrep -v .bat); do echo $f; done     fsc     fsc.bat     scala     scala.bat     scalac     scalac.bat     scaladoc     scaladoc.bat     scalap     scalap.bat     scalac     scalac.bat     scaladoc     scaladoc.bat     scalap     scalap.bat      **DEBUG** `$ set -x`               mike@pc /cygdrive/c/Program Files (x86)/scala/bin     $ for f in $(ls | egrep -v .bat); do echo $f; done     ++ ls -hF --color=tty     ++ egrep --color=auto -v .bat     + for f in '$(ls | egrep -v .bat)'     + echo fsc     fsc     + for f in '$(ls | egrep -v .bat)'     + echo fsc.bat     fsc.bat     // and so on


How to autocd in tcsh?

I want to change directory without using cd, I want to access the directory by its name $home/user/tools               $cd tools //works fine     $tools    //permission denied      I tried `set autocd` but still the same?


Identifying and moving fields in a line

I want to identify a field in a line containing a string, and then move it to a different position. A line would look like this (sorry, I can't seem to type tabs in here)               string1 / string2 / blablaABCbla / string3      The idea is to locate the field containing ABC and move this field to the beginning or end of the line. How would I do this in bash, from stdout? [edit] I'm trying to work this into a piped sequence - I was hoping for a clever command I didn't know about, or else something really sed-ugly.


fdisk (expert mode) options

On GNU/Linux with `fdisk (util-linux 2.20.1)`, when using, say `fdisk /dev/sda3` there are quite some options and the and even an "expert mode" (`x`). Most of these are explained through the `m` option. But I can't find an documentation on these, neither in the `man` not the `info` page. As I don't want to fumble around with my file systems at the moment - any idea? Just to make this clear: I'm not talking about the "regular" option, e.g. `fdisk -v` but the ones where `fdisk`first had to be started. My guess was that I might get luck in another, related `man`page but I couldn't find anything so far. Did I miss something?


is there some simple/clean way to make an "empty boolean variable" be evaluated as `false` on bash scripts?

Well, the variable is not boolean until it has been set to `true` or `false`. So when the script begins, it checks for a boolean that was not set yet as in `bTest=''`. So if I do this: `if $bTest;then echo "is active";fi` it will output "is active" when I would like it to show nothing... I could use this: `[ "$bTest" == true ]`, when before was just `$bTest`, but to me that is the problem, it is not a "boolean", it is a string comparison... Also, if I misstype a boolean variable name, it will be empty, and the script execution will throw no error message... and for several times I discovered the real problem was just the misstyped variable... Could an IDE have get that? I use `gedit` so I must track my failures by myself. I wonder if is there a clean and simple way to work with booleans instead of typing `[ "$bTest" == true ]` every time..?


How to start a script with clean environment?

I tried the following but it doesn't seem to work:               $ cat script.sh     #!/bin/env -i /bin/sh          /bin/env     $ script.sh     /bin/env: invalid option -- ' '     Try `/bin/env --help' for more information.


How to ensure FTPeS uses a secure connection?

From: https://secure.wikimedia.org/wikipedia/en/wiki/FTPS > **Explicit:** If a client does not request security, the FTPS server can > either allow the client to continue insecure or refuse/limit the connection.   >   >  **Implicit:** A client is immediately expected to challenge the FTPS server > with a TLS/SSL ClientHello message. If such a message is not received by the > FTPS server, the server should drop the connection. So If I own only the client side, then what can I do to allow an FTPES connection to **only use** a secure connection? Under a non-windows OS. IPtables/pf rule? Proxy? or What can I do?


Trying to create a multiboot USB for Installs

I'm trying to boot various OS/Configurations of OS Install from a single USB. I've been using Multisystem, but it fails when I try to boot an install created with RemasterSys \+ Ubuntu 11.04. It gives something like "please provide a name for this disk". I tried copying in the `./disk` folder into the directory for the install but it still fails. Then I noticed that Ubuntu Desktop is boot directly via USB, so I copied the menu entry and modified the file names:               menuentry "Ubuntu Custom Install" {         search --set -f "/customdist.iso"         loopback loop "/customdist.iso"         linux (loop)/casper/vmlinuz root=UUID=E56C-B453 debian-installer/locale=en_US.UTF-8 debian-installer/language=en kbd-chooser/method=en console-setup/layoutcode=us console-setup/variantcode= console-setup/modelcode=pc105 iso-scan/filename=/customdist.iso boot=casper file=/cdrom/preseed/custom.seed noprompt text --         initrd (loop)/casper/initrd.lz     }      It gives something like file not found. I had `customdist.iso` under the root of the USB just like Ubuntu Desktop is. Also I noticed custom.seed is used so I changed that as well. Whats wrong? Do you have any advice for "noobs" on how to start using GRUB2? I never really get what the commands like `find`, `loopback` or what the long line `linux (loop)/casper/vmlinuz ... file=/cdrom/preseed/custom.seed noprompt text --` do. I suppose the simplest is just to learn to boot everything from ISO?


How should I determine the current network utilization?

I want to display the current network utilization (bandwidth usage) of one interface of a Debian box on a website. It is not supposed to be very elaborate or precise, just a simple number such as "52 Mbit/s". Typical network bandwidth monitors such as `iftop` give me no way to simply extract such a value. How can I best retrieve it? For example, I guess I might parse `/proc/net/dev` every few minutes. Not sure if this is really the best way to do this though.


Lines 1,2,3,4,...,n-1, n to lines n,n-1, ...,4,3,2,1

I just realized that I could solve this problem by reversing line numbers from 1, 2, 3,...,n to n, n-1, ..., 3,2,1 and then use the same logic as earlier. So I want to know how can I reverse the order of lines?


Can iptables rules manipulate IP sets?

In `iptables-extensions(8)` the `set` module is described and it is discussed that it is possible to react to the presence or absence of an IP or more generally a match against an IP set. However, it does not seem that there is a way to append items to an IP set on the fly using an `iptables` rule. The idea being that if I use the `recent` module, I could then temporarily blacklist certain IPs that keep trying and add them into an IP set (which is likely faster). This would mean less rules to traverse for such cases and matching against an IP set is said to be faster as well.


How can I block a subdomain with dnsmasq?

I use dnsmasq as a whitelist on my network. My dnsmasq.conf file looks like this:               bogus-priv     domain-needed     no-resolv          server=/stackexchange.com/8.8.8.8     #etc...      I would like to be able to block a subdomain, for example:               server=/meta.stackexchange.com/0.0.0.0      I also tried:               address=/meta.stackexchange.com/0.0.0.0      And for both I tried substituting 127.0.0.1 for 0.0.0.0. Unfortunately this doesn't seem to work. How can I block a specific subdomain while allowing the rest of the domain in the config file?


String pattern searching

I'm new to linux. I want to be placed as a System Admin. I attended an interview at Amazon. They asked me to write a cmd to find the string that starts with 's' and ends with 'a' in a file. I jz know that we have to use grep, bt don't know the actual things. Added to this they also asked how grep works. Can anyone brief out an answer for this. Thanks in advance


Best way to configure computer lab printers using CUPS (or other print server)?

I manage a computer lab that is used mainly for printing. We've got three identical HP LaserJet P3015s set up and connected by USB to an Ubuntu server, which is then networked to the other computers. All three printers are in the same CUPS class, and the class is shared using the Samba server to the lab computers, which are all OS X and Windows 8 machines. The problem I am having is that whenever someone tries to print an especially long document (sometimes hundreds of pages), the other two printers will stop printing until the long document is finished. Is it not possible in this configuration for CUPS to be accessing multiple printers at the same time, and to choose the printer with the shorted queue (by number of pages, not number of documents) to send new documents to? Is there a better way to configure this? Does anyone have any suggestions or experience on how to improve this situation?


Password dialogs block keybindings

I am using XMonad 0.11, but this might be unrelated. I am using `evolution` 3.12.2 and this is related but the problem might be more general. After research it appears that the window in question is `pinentry` and comes from GPG2. Some password dialogs prevent me from using my keybindings. Usually this is caused by `evolution`. The following happens:   * I am not able to switch workspaces or change the focus with the keyboard, changing focus with the mouse still works.   * I cannot move the window using keybindings alone (i.e, `META-SHIFT-1`) but the combination `META-MOUSE1` to move works.   * The non window manager keys dont' work all either: `ESCAPE` is ignored but `RETURN` works. Insert from clipboard does not work either (although this may be intentional for a password field).   * In fact any keyboard input is redirected to the password fields and the meta combinations appear as normal letters (e.g, if I try `META-SHIFT-1` to move the window an * appears in the password field, most likely masking a 1).   * As soon as the dialog is claused (using mouse or enter) the system behaves normal again. I would like to fix this as this is very annoying when a password window pops up unexpectedly.