Application receives SIGKILL on system shutdown, why not SIGTERM?

We use our Java application under X that starts from `/etc/X11/Xsessions.d/9999ngoma`               root@denis-laptop:~# uname -a     Linux denis-laptop 2.6.32-36-generic #79-Ubuntu SMP Tue Nov 8 22:29:26 UTC 2011 i686 GNU/Linux      It starts as a full-screen replacement of GDM. When the system is powered down, it seems our app receives SIGKILL and not SIGTERM (this is the reason some resources are not stored to disk). How could this happen? I should also warn once again, that application starts exclusively fom, `/etc/X11/Xsessions.d/9999ngoma`. Exclusively means that Gnome is loaded only after our application exits (I just don't know other way to run application exclusively under X). Could it be that GDM receives SIGTERM and then SIGKILL child that didn't finish during GDM session initialization process (script at Xsession.d directory).


Testing precedence of resolving addresses from commandline

There was such tool but I cannot remember its name. I needed to configure precedence of addresses by `/etc/gai.conf`. I finally managed to find an error, but for future, what's the name of tool which displays the addresses of hostname as `getaddrinfo(3)` displays it?


A challenge for sed convert code from Mathematica to Matlab

I have the following output from Mathematica to C code:               $ cat file.txt     Complex(1.3, 2.7)*Power(kappa, 2.0) + Complex(0.3, 2.0)*Power(kappa,5.0)*log(alpha)      The file is extremely long (many tens of thousands of lines). I would like to replace every Complex(a, b) with (a + i*b) and every Power(a, b) to a^b. So the above sample would look like:               $ cat desired_file.txt     (1.3 + i*2.7)*kappa^2.0 + (0.3 + i*2.0)*kappa^5.0*log(alpha)      How can I use sed to achieve this result? It is not straight forward at all by reading regular expressions and examples out there. How can I do this using `sed`?


Firewall change control

At the moment I'm using a Python script to generate `iptables` rules. Each set of changes gets committed to a git repository before deployment so there's a trace of who changed what and why. What tools/processes do other people use to manage changes to their firewall rules? Is there a guide on best practice for firewall change control that anyone likes? **UPDATE:** I guess what I'm asking is for tools/processes around the area. For instance I find testing large firewall scripts quite difficult. Anyone use/written a test script or know of a unit testing type approach that's possible with `iptables`?


monitoring events (keyboard, mouse) in X

Is it possible to display all events that are generated in Xorg? Such as keyboard pressed, mouse events...?


Gnome menu shortcuts don't appear after Apache OpenOffice 4 install on Tails 1.0

I use the following after unpacking the AOO4 deb .tar.gz to install it:               sudo dpkg -i en-US/DEBS/*.deb     sudo dpkg -i en-US/DEBS/desktop-integration/*.deb      But no menu shortcuts appear (Applications -> Office -> *). I've mucked about with it a bunch of times, and **one time, somehow, they did appear** alongside the OpenOffice.org default shortcuts there. However, I am not sure what I managed to do that time that caused it to work. I've also tried:               sudo dpkg -iR en-US/DEBS/*.deb      and               sudo dpkg -i -R en-US/DEBS/*.deb      The only other things I have been trying is creating a soft link on the desktop, launching OOo3 and/or AOO4, pressing F5 while the desktop or the menu has focus, and switching to other workspaces, but no combination of these actions seems to make it work again after a fresh boot. What am I missing? By what fluke did I get it to work the one time?


Using fstab File When Mounting Filesystem

I installed Arch Linux using BTRFS, but I was having issues with wifi. I have to mount the drive from the Live CD. But, when I mount using:               mount /dev/sda1 /mnt/arch      It doesn't use the fstab file from `/dev/sda1`. This is causing issues. In the `fstab` file I am binding `/var/lib` to `/run/btrfs-root/ROOT/var/lib`. Because of this I am unable to use `pacman` because it's not binding when mounted. How can I mount the drive and have it use the `fstab` file to bind and mount the subvolumes?


Font getting reset in virtual console on GNU/Linux

I have set a custom font on my virtual console (vt1) using the following command:               shell> setfont ter-114f      If I switch to X (using Ctrl+Alt+F7) and come back to the virtual console (using Ctrl+Alt+F1), the display isn't proper. Looks like the screen size is getting reset (previously set to 28 rows before switching). How can this be fixed?


bash quotes expansion puzzle

My script looks like:               opts="-x ''"     curl http://somepage $opts      I want the string in `$opts` appended to the command. I use `bash -x test.sh` to check the expansion and see that the the single-quotes are removed. If I change it to:               opts="-x \'\'"      After expansion, there are 4 single-quotes.


How is the octal 2-byte output calculated from od

I'm struggling to work out what the octal 2-byte output from the `od` command is. I understand the octal output (`-b` flag) but the octal 2-byte is a mystery to me (`-o`) Can someone shed some light on how the `-o` result is calculated from ASCII? Here is an example:               [root@localhost lpi103-2]# cat text1     1 apple     2 pear     3 banana     [root@localhost lpi103-2]# od -c text1     0000000   1       a   p   p   l   e  \n   2       p   e   a   r  \n   3     0000020       b   a   n   a   n   a  \n     0000030     [root@localhost lpi103-2]# od -bc text1     0000000 061 040 141 160 160 154 145 012 062 040 160 145 141 162 012 063               1       a   p   p   l   e  \n   2       p   e   a   r  \n   3     0000020 040 142 141 156 141 156 141 012                   b   a   n   a   n   a  \n     0000030     [root@localhost lpi103-2]# od -oc text1     0000000  020061  070141  066160  005145  020062  062560  071141  031412               1       a   p   p   l   e  \n   2       p   e   a   r  \n   3     0000020  061040  067141  067141  005141                   b   a   n   a   n   a  \n     0000030


how to extract .z file from an old QNX in Centos

z files from an old QNX system which needs to be unpacked in preferable Centos. These files are packed with the QNX pack method and there is no Virtual Machine (VMWARE) available to load QNX and unpack these files. I've tried all the available extraction programs, but no one is able to unpack these. File filename gives data as result I've tried the following:   * gunzip   * uncompress   * tar   * winrar   * 7z   * unzip Output in Centos:               -rwxr--r-- 1 root root  896 Mar 11 05:15 PMITN01.z     [root@green update]# zcat PMITN01.z     zcat: PMITN01.z: not in gzip format     [root@green update]# gunzip PMITN01.z     gunzip: PMITN01.z: not in gzip format     [root@green update]# uncompress -v PMITN01.z     PMITN01.z - no .Z suffix     [root@green update]# tar -zxvf PMITN01.z     gzip: stdin: not in gzip format     tar: Child returned status 1     tar: Error exit delayed from previous errors     [root@green update]# cat PMITN01.z | cpio -imdv     cpio: premature end of archive     [root@green update]# file PMITN01.z     PMITN01.z: data      After installing freeze/melt:               [root@green update]# cp PMITN01.z PMITN01.z.F     [root@green update]# melt PMITN01     PMITN01.F: No such file or directory     [root@green update]# melt PMITN01.z     PMITN01.z.F: not in frozen format      The only valuable search I've found is the following OpenQNX forum. -----UPDATE-------- I've added the file here so you can see/check what kind of file it is. I still haven't found an answer for my question, so I don't know why answers get upvoted.... To make it more complicated the system used probably split the files into multiple files, here is a ll -hal output:               -rwxrw-r-- 1 root root  357 Feb  7  2012 PMIPN.z     -rwxrw-r-- 1 root root  362 Feb  7  2012 PMIRN01.z     -rwxrw-r-- 1 root root  695 Feb  7  2012 PMIRN02.z     -rwxrw-r-- 1 root root  995 Feb  7  2012 PMIRN03.z     -rwxrw-r-- 1 root root  363 Feb  7  2012 PMIRN04.z     -rwxrw-r-- 1 root root 3.2K Feb  7  2012 PMIRN05.z     -rwxrw-r-- 1 root root  363 Feb  7  2012 PMIRN06.z     -rwxrw-r-- 1 root root  363 Feb  7  2012 PMIRN07.z     -rwxrw-r-- 1 root root  362 Feb  7  2012 PMIRN08.z     -rwxrw-r-- 1 root root  851 Feb  7  2012 PMIRN09.z     -rwxrw-r-- 1 root root 1022 Feb  7  2012 PMIRN10.z     -rwxrw-r-- 1 root root  361 Feb  7  2012 PMIRN11.z     -rwxrw-r-- 1 root root  695 Feb  7  2012 PMIRN12.z     -rwxrw-r-- 1 root root  15K Feb  7  2012 PMIRN13.z     -rwxrw-r-- 1 root root  16K Feb  7  2012 PMIRN14.z     -rwxrw-r-- 1 root root 1.6K Feb  7  2012 PMIRN15.z     -rwxrw-r-- 1 root root  638 Feb  7  2012 PMIRN16.z     -rwxrw-r-- 1 root root 1.9K Feb  7  2012 PMIRN17.z     -rwxrw-r-- 1 root root  13K Feb  7  2012 PMIRN18.z     -rwxrw-r-- 1 root root  363 Feb  7  2012 PMIRN19.z     -rwxrw-r-- 1 root root  578 Feb  7  2012 PMIRN20.z     -rwxrw-r-- 1 root root  362 Feb  7  2012 PMIRN21.z     -rwxrw-r-- 1 root root 1.6K Feb  7  2012 PMIRN22.z     -rwxrw-r-- 1 root root  361 Feb  7  2012 PMIRN23.z     -rwxrw-r-- 1 root root  361 Feb  7  2012 PMIRN24.z     -rwxrw-r-- 1 root root  688 Feb  7  2012 PMIRN25.z     -rwxrw-r-- 1 root root  362 Feb  7  2012 PMIRN26.z     -rwxrw-r-- 1 root root  650 Feb  7  2012 PMIRN27.z     -rwxrw-r-- 1 root root  801 Feb  7  2012 PMIRN28.z     -rwxrw-r-- 1 root root 3.0K Feb  7  2012 PMIRN29.z     -rwxrw-r-- 1 root root  361 Feb  7  2012 PMIRN30.z     -rwxrw-r-- 1 root root  354 Feb  7  2012 PMIRN31.z     -rwxrw-r-- 1 root root  569 Feb  7  2012 PMIRN32.z     -rwxrw-r-- 1 root root  361 Feb  7  2012 PMIRN33.z     -rwxrw-r-- 1 root root  362 Feb  7  2012 PMIRN34.z     -rwxrw-r-- 1 root root  362 Feb  7  2012 PMIRN35.z     -rwxrw-r-- 1 root root 7.8K Feb  7  2012 PMIRN36.z     -rwxrw-r-- 1 root root  875 Feb  7  2012 PMIRN37.z     -rwxrw-r-- 1 root root 4.6K Feb  7  2012 PMIRN38.z     -rwxrw-r-- 1 root root 3.2K Feb  7  2012 PMIRN39.z     -rwxrw-r-- 1 root root  362 Feb  7  2012 PMIRN40.z     -rwxrw-r-- 1 root root  362 Feb  7  2012 PMIRN41.z     -rwxrw-r-- 1 root root 7.4K Feb  7  2012 PMIRN42.z     -rwxrw-r-- 1 root root  362 Feb  7  2012 PMIRN43.z      As you can see it's not a clear split on filesize.


How to enable and use code folding in vim

How can I enable and **do** code folding in vim? Do I have to change anything in `~/.vimrc`? I type `z`+`a` and `z`+`c` and `z`+`o` and nothing happens. code folding on vim.


Why can't find -regex match a newline?

Why does this fail?               touch "$(printf "a\nb")"; find . -regex './.\n.'      I also tried these, none of which work:               find . -regextype posix-extended -regex '.\n.'     find . -regextype posix-awk -regex '.\n.'     find . -regextype posix-basic -regex '.\n.'     find . -regextype posix-egrep -regex '.\n.'      The only way it seems to work is (thanks @MichaelMrozek)               find . -regex './.'$'\n''.'      Which is cumbersome to say the least. So, why do find's regular expressions seem to be unable to deal with `\n`? * * * Update in response to answers so far: OK, I understand that `\n` is not part of ERE and that was one of my misunderstandings but `find` claims to support `posix-awk` and both `gawk` and `mawk` match `\n` as expected:               $ printf "f1l1\nhas newline:f2l1#f1l2 does not:f2l2#" |          mawk -F: 'BEGIN{RS="#"}; ($1~/\n/){print $1}'      f1l1     has newline      I don't have a pure `awk` to test with so perhaps POSIX `awk` does not match? Otherwise is `find` not actually implementing `posix-awk` regular expressions?


Syntax error in a bash script that calls find

Where is the error in this script please:               #!/bin/bash     rep="git"          files=`find' ${rep} '-type f`     for f in ${files} do         echo $f     done      When i run `find git -type f` alone in the shell, it works!


install OPENCV to Rasbian( Debian Linux )

![enter image description here](http://i.stack.imgur.com/YswTR.png) I installed rasbian(debian) for windows . I want to install OPENCV. I have write the newest link .               wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip      But I got error in this picture. What can I do now ?


git pull from remote but no such ref was fetched?

I have a git mirror on my disk and when I want to update my repo with git pull it gives me error message:                Your configuration specifies to merge with the ref '3.5/master' from the remote, but no such ref was fetched.      It also gives me:                 1ce6dac..a5ab7de  3.4/bfq    -> origin/3.4/bfq       fa52ab1..f5d387e  3.4/master -> origin/3.4/master       398cc33..1c3000a  3.4/upstream-updates -> origin/3.4/upstream-updates       d01630e..6b612f7  3.7/master -> origin/3.7/master       491e78a..f49f47f  3.7/misc   -> origin/3.7/misc       5b7be63..356d8c6  3.7/upstream-updates -> origin/3.7/upstream-updates       636753a..027c1f3  3.8/master -> origin/3.8/master       b8e524c..cfcf7b5  3.8/misc   -> origin/3.8/misc       * [neuer Zweig]     3.8/upstream-updates -> origin/3.8/upstream-updates      When I run make menuconfig it gives me Linux version 3.5.7? What does this mean? How can I update my repo?


Extract data in linux/unix

I have input data which I want to parse and extract values using awk/grep/sed:               group-2 9 10 text color=black,from=ABCB11,fromid=4,order=2,thickness=3,to=ACE,toid=11,use=1,z=1     group-3 0 1 text color=black,from=ABCB11,fromid=4,order=2,thickness=3,to=ACE,toid=11,use=1,z=1     group-2 28 29 text color=black,from=ABCB11,fromid=4,order=2,thickness=3,to=CHRM1,toid=114,use=1,z=1     group-5 0 1 text color=black,from=ABCB11,fromid=4,order=2,thickness=3,to=CHRM1,toid=114,use=1,z=1     group-2 29 30 text color=black,from=ABCB11,fromid=4,order=2,thickness=3,to=CHRM2,toid=115,use=1,z=1     group-5 1 2 text color=black,from=ABCB11,fromid=4,order=2,thickness=3,to=CHRM2,toid=115,use=1,z=1     group-2 10 11 text color=black,from=ABCB11,fromid=4,order=2,thickness=3,to=DRD2,toid=158,use=1,z=1     group-3 1 2 text color=black,from=ABCB11,fromid=4,order=2,thickness=3,to=DRD2,toid=158,use=1,z=1     group-2 11 12 text color=black,from=ABCB11,fromid=4,order=2,thickness=3,to=EGF,toid=164,use=1,z=1     group-3 2 3 text color=black,from=ABCB11,fromid=4,order=2,thickness=3,to=EGF,toid=164,use=1,z=1     group-2 21 22 text color=black,from=ABCC8,fromid=5,order=2,thickness=3,to=ACE,toid=11,use=1,z=1     group-3 12 13 text color=black,from=ABCC8,fromid=5,order=2,thickness=3,to=ACE,toid=11,use=1,z=1     group-2 0 1 text color=black,from=ABCC8,fromid=5,order=2,thickness=3,to=ADRA1A,toid=21,use=1,z=1     group-1 0 1 text color=black,from=ABCC8,fromid=5,order=2,thickness=3,to=ADRA1A,toid=21,use=1,z=1     group-2 1 2 text color=black,from=ABCC8,fromid=5,order=2,thickness=3,to=ADRA1B,toid=22,use=1,z=1     group-1 1 2 text color=black,from=ABCC8,fromid=5,order=2,thickness=3,to=ADRA1B,toid=22,use=1,z=1     group-2 2 3 text color=black,from=ABCC8,fromid=5,order=2,thickness=3,to=ADRA1D,toid=23,use=1,z=1     group-1 2 3 text color=black,from=ABCC8,fromid=5,order=2,thickness=3,to=ADRA1D,toid=23,use=1,z=1      Basically,I want to take the distinct values in "from=" and its "fromid" and "to=" and its "toid=" which can be seen below as to how the output should be: The desired output.has to be the values in "from=" and "to=" joined row wise.Since from=ABCB11 is present many times but I want only it once,so as the value in "to=" has to be once in the output. Whatever is present as fromid or toid ,I want all rows to have fromid,after taking distinct values from both. The format of the output can be interpreted from below output:               ABCB11 = fromid=4,from=ABCB11     ABCC8 = fromid=5,from=ABCC8     ACE = fromid=11,from=ACE     CHRM1 = fromid=114,from=CHRM1     CHRM2 = fromid=115,from=CHRM2     DRD2 = fromid=158,from=DRD2     EGF = fromid=164,from=EGF     ADRA1A = fromid=21,from=ADRA1A     ADRA1B = fromid=22,from=ADRA1B     ADRA1D = fromid=23,from=ADRA1D      I want to have exactly the same output as above,but I have a new input file,which is below:               ABCB11  4   ACE 11     ABCB11  4   CHRM1   114     ABCB11  4   CHRM2   115     ABCB11  4   DRD2    158     ABCB11  4   EGF 164     ABCC8   5   ACE 11     ABCC8   5   ADRA1A  21     ABCC8   5   ADRA1B  22     ABCC8   5   ADRA1D  23     ABCC8   5   CHRM1   114      Taking all the unique genes and creating the output.


BCM4312 802.11b/g and Scientific-linux

I have a fresh Scientific-linux 6.1 install on a Compaq 610 notebook:               lspci | grep Broadcom     10:00.0 Network controller: Broadcom Corporation BCM4312 802.11b/g LP-PHY (rev 01)      But I can't see the wifi interface listed in "ifconfig -a". How can I bring the wifi to life?


How to debug a suspend problem?

I used to have Fedora 14 installed on this HP Compaq 610, and the suspend feature worked fine. Now that I've installed Scientific Linux 6.1 suspend doesn't work anymore. How do I debug/fix it?


Recovering windows partition in Mint (testdisk fails)

Yesterday I messed up my partitions, wanting to replace Ubuntu with Mint. My other partition had Windows 8 on it. I booted Mint from a live USB and started the Mint setup. I selected the option to overwrite Ubuntu with Mint. However before i clicked the Install button I changed my mind and thought it would be a good idea to make a backup of my windows partition. Unfortunately the damage was already done and I was unable to locate my Windows partition. Gparted:               /dev/sda1 fat32           512.00 MiB      1.02 MiB        510.98 MiB     boot     /dev/sda2 ext4            224.50 GiB      7.69 GiB        216.80 GiB     /dev/sda3 linux-suspend     7.89 GiB      fs    ---               ---      fdisk:               WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.               Disk /dev/sda: 250.1 GB, 250059350016 bytes     255 heads, 63 sectors/track, 30401 cylinders, total 488397168 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: 0x00000000             Device Boot      Start         End      Blocks   Id  System     /dev/sda1               1   488397167   244198583+  ee  GPT          Disk /dev/sdb: 15.5 GB, 15504900096 bytes     255 heads, 63 sectors/track, 1885 cylinders, total 30283008 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: 0xc196969a             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1   *        8064    30283007    15137472    c  W95 FAT32 (LBA)      I also tried testdisk but it tells me it couldn't recover any partitions and the ones that are listed are only a boot partition,linux's own partition or empty partitions/folders. Does anyone have any suggestions or have i just lost all my windows files? [edit]               mint@mint ~ $ sudo blkid     /dev/loop0: TYPE="squashfs"      /dev/sda1: UUID="D435-92A0" TYPE="vfat"      /dev/sda2: UUID="0de14359-2f69-45ff-88a3-eefa41d127ad" TYPE="ext4"      /dev/sda3: UUID="f96fa82f-707f-41fe-bce1-cf61396f7869" TYPE="swsuspend"      /dev/sdb1: LABEL="UUI" UUID="8247-3FF1" TYPE="vfat"      mint@mint ~ $ sudo lsblk     NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT     sda      8:0    0 232.9G  0 disk      ├─sda1   8:1    0   512M  0 part      ├─sda2   8:2    0 224.5G  0 part      └─sda3   8:3    0   7.9G  0 part      sdb      8:16   1  14.5G  0 disk      └─sdb1   8:17   1  14.4G  0 part /cdrom     sr0     11:0    1  1024M  0 rom       loop0    7:0    0   1.3G  1 loop /rofs


Send log messages to a different location

I want to send messages from C program and from Perl script to a file (for example, /var/log/my_log). I don't have access to the syslog daemon configuration, so I think in launch a differente syslog daemon (syslog-ng). I'm able to send messages from the command line, using `logger` command and its `-u` option. This log messages are logged on my_log instead of the usual messages file, but I cannot reproduce the same behavior from C or Perl. The openlog function, apparently, doesn't have any option to specify a socket for logging, or the PID of the log process or something that allows me to send the messages to my own log instead the system log. Can it be done or is it impossible using `syslog` library?


echo string >> file does not work

I wrote the following script:               for filename in `find . -name '*'.cpp | grep $IN_REGEX | grep -v $OUT_REGEX`     do         echo "Output file is $OUTPUT_FILE"         count=`git log --pretty=format: --name-only $filename | grep -v ^$ | wc -l`         echo "$count    $filename" >> $OUTPUT_FILE     done      But nothing gets written into the output file. Please note:   1. I have set the values for `OUTPUT_FILE`, `IN_REGEX` and `OUT_REGEX`.   2. The code inside the loop is being executed. I checked this with an `sh -x` invokation.   3. When I remove the `>> $OUTPUT_FILE` I get the output.    4. I tried a `touch $OUTPUT_FILE` inside the script and that is working fine. Can someone please point out what is my mistake here?


How to check debconf selections of a non-installed package?

I'm trying to find the available debconf configuration options (which key- value pairs the package supports and if possible a description of each) of some non-installed packages, like ufw, but I haven't found a way with debconf* binaries to check them out. Is there something I'm missing?


How do I confirm if another instance of my package manager is still running?

dpkg is reporting that the database is locked which may imply that another instance of the package manager is still running so how do I check this? I have a Debian based system and this came up while I was trying to figure out why I got a "failed to fetch" when downloading some packages. The original error:                   W: Failed to fetch ftp.us.debian.org/debian/pool....4-2_amd64.deb 404 Not Found [IP: 128.61.240.89 80]          W: Failed to fetch ftp.us.debian.org/debian/pool...-8.1_amd64.deb 404 Not Found [IP: 128.61.240.89 80]          W: Failed to fetch ftp.us.debian.org/debian/pool...-8.1_amd64.deb 404 Not Found [IP: 128.61.240.89 80]      The research:               dpkg --audit     Another process has locked the database for writing, and might currently be     modifying it, some of the following problems might just be due to that.          The following packages have been unpacked but not yet configured.     They must be configured using dpkg --configure or the configure     menu option in dselect for them to work:      vim-latexsuite       view, edit and compile LaTeX documents from within Vim      texlive-base         TeX Live: Essential programs and files      libgraphite3         SILGraphite - a "smart font" rendering engine      texlive-luatex       TeX Live: LuaTeX packages      tk8.4                Tk toolkit for Tcl and X11, v8.4 - run-time files      texlive-doc-base     TeX Live: TeX Live documentation      tcl8.4               Tcl (the Tool Command Language) v8.4 - run-time files      luatex               next generation TeX engine      libptexenc1          TeX Live: pTeX encoding library      texlive-binaries     Binaries for TeX Live      ed                   classic UNIX line editor      vim-addon-manager    manager of addons for the Vim editor      ruby                 Interpreter of object-oriented scripting language Ruby (d      texlive-common       TeX Live: Base component      lmodern              scalable PostScript and OpenType fonts based on Computer       tex-common           common infrastructure for building and installing TeX


How is it that I can attach strace to a process that isn't in the output of ps?

I'm trying to debug why our integration tests are taking so long and it looks like they're hanging part way through. I logged onto our test service and saw the following behaviour:               root@colossus:~# strace -p 18310     Process 18310 attached - interrupt to quit     futex(0x7f9915c609d0, FUTEX_WAIT, 18313, NULL^C <unfinished ...>     Process 18310 detached          root@colossus:~# strace -p 18313     Process 18313 attached - interrupt to quit     restart_syscall(<... resuming interrupted call ...>^C <unfinished ...>     Process 18313 detached          root@colossus:~# ps -ef | grep 18313     root     19089 19034  0 09:46 pts/0    00:00:00 grep --color=auto 18313          root@colossus:~# ps -p 18313     PID TTY          TIME CMD      My interpretation of these commands is that `18310` is waiting for its child `18313` to complete. Process `18313` is trying to restart an interrupted system call. Here's where it gets weird. Although I can attach to `18313`, I cannot see it in the list of current processes, when I run `ps`. Can someone help me understand what is going on here, please?


How to dump bios data to a file

I want to dump the bios data of my laptop to a file. The only solution I found is the following command:               dd if=/dev/mem bs=X skip=Y count=1      `X` and `Y` are different in suggested solutions by different people because there are different bios types. Is there a way to find exact address of bios data in /dev/mem? Can I use `dmidecode` to find the address range of bios in memory? And does linux dump all bios data in RAM or just a special part of it? If linux can dump bios data to RAM, can the root user also access the bios directly?


Not able to open vlc

I installed vlc through yum but am unable to open it via terminal(it shows command not found) or gui. I am not able to see the vlc config files, icon in applications either. Following is the terminal text:               Loaded plugins: langpacks, presto, refresh-packagekit Resolving     Dependencies     --> Running transaction check     ---> Package vlc.x86_64 0:2.0.5-1.fc17 will be installed     --> Finished Dependency Resolution          Dependencies Resolved          ================================================================================  Package   Arch         Version              Repository                   Size     ================================================================================ Installing:  vlc       x86_64       2.0.5-1.fc17           rpmfusion-free-updates       1.6 M          Transaction Summary     ================================================================================ Install  1 Package          Total download size: 1.6 M Installed size: 4.2 M Is this ok [y/N]: y     Downloading Packages: vlc-2.0.5-1.fc17.x86_64.rpm                        | 1.6 MB     00:02      Running Transaction Check Running Transaction     Test Transaction Test Succeeded Running Transaction   Installing :     vlc-2.0.5-1.fc17.x86_64                                      1/1      Verifying  : vlc-2.0.5-1.fc17.x86_64                                     1/1          Installed:   vlc.x86_64 0:2.0.5-1.fc17                                             Complete! [root@localhost ~]# vlc bash: vlc: command not found...


Remove shutdown/reboot options from logout window

In my CentOS5 installation in KDE, users get presented the options to terminate the session, reboot, and shutdown. Since this computer should always remain on, I'd like to remove the reboot and shutdown option from the menu to avoid an accidential reboot. How do I do this?


Monitor CPU Registers

I'm looking for such tool, to see state of CPU registers, eax, ebx, ecx, edx. I've discovered cpuid:                eax in    eax      ebx      ecx      edx     00000000 0000000d 756e6547 6c65746e 49656e69     00000001 000206a7 06100800 1f9ae3bf bfebfbff     00000002 76035a01 00f0b0ff 00000000 00ca0000     00000003 00000000 00000000 00000000 00000000     00000004 00000000 00000000 00000000 00000000     00000005 00000040 00000040 00000003 00001120     00000006 00000077 00000002 00000009 00000000     00000007 00000000 00000000 00000000 00000000     00000008 00000000 00000000 00000000 00000000     00000009 00000000 00000000 00000000 00000000     0000000a 07300803 00000000 00000000 00000603     0000000b 00000000 00000000 0000002c 00000006     0000000c 00000000 00000000 00000000 00000000     0000000d 00000000 00000000 00000000 00000000     80000000 80000008 00000000 00000000 00000000     80000001 00000000 00000000 00000001 28100800     80000002 20202020 49202020 6c65746e 20295228     80000003 65726f43 294d5428 2d356920 30303532     80000004 5043204b 20402055 30332e33 007a4847     80000005 00000000 00000000 00000000 00000000     80000006 00000000 00000000 01006040 00000000     80000007 00000000 00000000 00000000 00000100     80000008 00003024 00000000 00000000 00000000      However, `ebx` second line is changing, only.   * 06100800   * 04100800   * 00100800   * 02100800   * 04100800 Nothing more. Is it possible to monitor registers?


How to split files with common prefix in bash

I have a directory with many files with common prefix, like `gsc*_other.foo`, where * is a character that goes from `0` to `9` or `a`/`b` (where `a` stands for `10` and `b` for `11`). My goal is to create text files with the same `gsc*` per each one (that is, the first text file has all the `gsc0_other.foo`, the second all the `gsc1_other.foo`, and so on). I am a beginner with bash, so I just know that I need something like `split`, but splitting over a common prefix, instead of a number of lines or size of the files. I already made a similar script, to list files up to a maximum number of files:               find ./J0902-405/*.evt -maxdepth 1 -type f -printf '%f\n' |        split -l498 -d - files_xselect.list      And I looked for many other way to change this script in what I need (like more `split`, `xargs`, `sed`), but don't have a way to go along with that.


How exactly is a Linux desktop/device/display expressed in a terminal?

My plan is to use `vpxenc` (video encoder) and `flac` (audio encoder) to record the screen/microphone, but I'm stopped short of entering the input (file) in the command line. How can I exactly address a screen from a terminal?


Find folders containing a file

How can I find all subfolders containing a given file? For example, in a Minecraft server installation, the different worlds are stored in subfolders with arbitrary names. To identify that a given folder represents a world, I have to look for a `level.dat` inside it. Is there a command that finds all `level.dat` files and returns the folders that contain them?


Is there a way to turn on the function key indicator based on capslock status on Lenovo ThinkPad Yoga?

The Capslock key comes with no LED indicator light on newer ThinkPad models. The Fn key has a light for when FnLk (function lock) is turned on (as if that's more important that the capsloack key!?!?!?!). The only capslock indication is software-based: a symbol is shown on the screen. And if if you install a linux distribution the chances are that such software won't be available out of the box. An LED light like the rest of the world puts on their keyboard would be so nice. Can any of the LED lights be somehow made to toggle with the state of the capslock?


Screen margin for compiz?

Can I use `XFWM` like features with compiz, leave out a margin for programs like `conky`? I tried to look for relevant stuff in `ccsm`, but no entries fit my need very well.


Resize a Physical Volume, resize2fs won't work with it

I need to resize my PV so that I could make room for a new partition,               /dev/sda7 -->  belongs to Volume Group: vg0      `vg0` has 23g free space not allocated, so I tried               pvresize --setphysicalvolumesize XXg      to reduce its size. What's next? I tried `resize2fs`, and it won't work with LVM partitions. I'll have to reduce `/dev/sda7`, so that I could create a new partition, e.g `/dev/sda8` for windows system.


install cisco VPN client on linux in place on WIN XP

I am currently using Windows XP with Cisco VPN Client version 5.0.01.0600 I would like to replace Windows XP with Linux, either Red Hat version 5.x or 6.x My question is, what equivalent VPN software can I install on Linux machine in order to get full compatibility with the same VPN network that the Cisco VPN client uses. Please advise also on where I can download Cisco VPN Client version 5.0.01.0600 for Linux.


Is it possible to "roll" a symlink to a new file without affecting any open file handles?

An application I am developing locally logs it's output to files formatted with the current timestamp such as `app-%Y%m%d.log`. To make it simple to be able to tail the current's day log in a terminal window, I have a symlink named `current.log` which points to today's log. At the start of work each day, I need to kill the tail process, point the symlink at today's file, and then re-run the command to `tail -f current.log`. Is it possible to change the target of the symlink without having to restart `tail` - by changing the target of the file handle without `tail` being any wiser? To automate this "start of new work day" task it would be easy to setup a cron'ed script to point the symlink at today's file, but it seems that the existing `tail` process would have no idea that the target has changed.


LFS 7.4 chapter 6.7: make: gcc: Command not found

I am (again) trying LFS. The version is 7.4 I am stuck at chapter 6.7, where I must run: `make mrproper` and I get this error: `make: gcc: Command not found`. But the `gcc` is there. I also cannot run `readelf` or `ld`, I get the same error. After some search on the web I found out that this is something done wrong and that I should start all over again. Well, I started all over and got the same error at the same point. I made more searching and I tried starting from the beginning again, but still I got the same error. How can I solve this problem?


OS X-like deadkeys behavior on Linux

I'm on Debian (actually Crunchbang), and my notebook has a default US layout keyboard. My native language is Brazilian Portuguese (pt-BR), so I've changed my layout with `setxkbmap -layout us -variant intl`. This allows me to use deadkeys to produce (Maçã, é,...), but it makes it harder to type commands like `cd ~/download` (I have to type `cd`, `~[space]/...`). Mac OS X with "US-Int" layout has a different behavior. You press "~", it shows "~" on the screen and moves the cursor to the right. If the following character is "a", instead of showing "~a", it shows "ã". Is it possible to enable this "mac-like" behavior on Linux? How?


Deploying my application

When deploying my application under linux, where do I put my libraries, executable and the desktop entry file? And what about other files my program needs? For example background pictures, audio files etc. I heard that I put my **executable** file in the `/usr/bin/` folder, my **libraries** in the `/opt/<myapp>/lib/` folder and my **desktop entry** file in `/usr/share/applications/` folder. Is that correct? But where is the general place for application resources? Is that everything I need to care of when deploying my application or are there other steps I am missing?


Canon I sensys MF3010 driver

I have this printer + scanner. Here (Driver for Canon i-SENSYS MF3010) I hound very useful answer to install driver and it worked for me. As printer now it works for me but I have same 1.0.23 but it doesn't recognize it as scanner... System opensuse 13.1


Poor IO due to LUKS/Software RAID/LVM ordering?

I'm trying to determine if I should re-setup my RAID array due to poor IO performance. First off, the system:   * i7 920   * 4 4TB WD 5400 Green drives   * CentOS 6.3 host Secondly, the disk setup:   * /dev/sda2,b2,c2,d2 are individually LUKS encrypted   * /dev/mapper/a2,b2,c2,d2 are all part of a software RAID5 /dev/md1   * /dev/md1 has LVM on top of that   * LVM is used to separate /, /storage, and swap I choose this structure to allow for multiple instances of kcryptd, thinking that by doing this, I would get multithread support on encryption since one instance is running per drive. However, I'm beginning to wonder if that was a good idea. For instance, if I run a heavy decompression routine on a RAR file of random data, my IO Wait goes up to around 25% and it slows the overall system down. I'm wondering if all the instruction sets are getting backed up somehow due to all the kcryptd processes. Therefore, I'm considering changing to:   * /dev/sda2,b2,c2,d2 are put into /dev/md1   * /dev/md1 is encrypted and mapped to /dev/mapper/1   * LVM on top of /dev/mapper/1 This would drop down to a single kcrpytd process, which could be a bottleneck in it's own right, too. Does anyone think this will help with my IO issue?


inline conditionals for assignment

Is there an "inline-equivalent" to expressions like the following?:               if [[ $VERBOSE == 1 ]]; then       V=$FOO     else       V=     fi      I'm thinking of something like this in `perl`, for example:               $V = $VERBOSE ? $FOO : undef;      (BTW, my interest is not so much in the business of reducing five lines to one, since one could always re-write the shell snippet as               if [[ $VERBOSE == 1 ]]; then V=$FOO; else V=; fi      but rather in a single conditional expression that is equivalent to a multi- statement `if`-construct.) In case there's a difference, I'm interested primarily in the answer for `zsh`, but also in the one for `bash`.


PulseAudio: Avahi needs restart to work

I'm trying to setup my local server pulse audio to be accessible by my notebook's one. I have successfully set up the server to start one instance (the server one, everything wanrned me i should not do that), also when i restart the avahi daemon the pulseaudio device appears in my notebook. However this isn't true, when i restart the NTB (and/or when it connects to a wifi or lan), after about 1 hour of usage or when the device is not used for a little while. As i mentioned the avahi restart on the server fixes this. I have googled this and only possible issue i found is that my eth driver doesn't support multicast correctly. Any other ideas? BTW The server is running DHCP server DHCPd and also acts as router. Server: Debian 6.0.8   pulseaudio: 0.9.21-3+squeeze1   avahi-daemon: 0.6.27-2+squeeze1   dhcp3-server: 4.1.1-P1-15+squeeze8 Client: Ubuntu 13.10 (up-to-date)   pulseaudio: 1:4.0-0ubuntu6   avahi-daemon, avahi-utils: 0.6.31-2ubuntu4.1


How does one get rid of screen flickering

Some time ago I downloaded Warzone 2100, the screen flickered and I thought it was just part of the game but the next time I went on assault cube that flickered as well (It did not flicker before warzone). Most recently Americas army began to flicker after I changed the screen revolution and now it will not stop flickering even if I restore default settings. How can I disable screen flickering? \ Update: This all started to happen after I upgraded to 11.10


shell script - echo command not printing in proper sequence

I have the following `testfile.txt`:               string1 1       string2 2       string3 3       string1 2       string2 4       string3 6       string1 3       string2 6       string3 9        I have the following script:               #!bin/sh          oldstr="abc"       while read line       do           newstr=\`echo "$line" | sed 's/\(.*\)\( \)\([0-9].*\)/\1/'\`         echo "$oldstr vs $newstr"              if [ $oldstr == $newstr ]          then             echo "old $oldstr"         else            oldstr=$newstr            echo "new $oldstr"         fi     done < $@ | sort     echo "done"      I then run the script:               $ sh test.sh testfile.txt      and get the output:               abc vs string1       new string1       new string1       new string1       new string2       new string2       new string2       new string3       new string3       new string3       string1 vs string2       string1 vs string2       string1 vs string2       string2 vs string3       string2 vs string3       string2 vs string3       string3 vs string1       string3 vs string1       done      I'd like to know why, as I would expect the output to be:               abc vs string1       new string1       string1 vs string1     old string1       string1 vs string1     old string1       string1 vs string2     new string2        and so on.   1. Why isn't the "if" statement working?    2. Why is the echo printing out of sequence?


Broken PATH in CentOS 5.x

I am having troubles with typing commands within the terminal on some of our CentOS servers. For example, I have to include the complete and full path to the command (i.e. /sbin/chkconfig vs. chkconfig). This seems to be happening for a number of the expected locations within the system wide PATH. Some of the locations affected include:   * /usr/sbin/   * /usr/bin/   * /usr/local/sbin/   * /sbin/ I was curious how I could go about correcting this for all users (globally) on the system? I know that for scripting, I always include the full path, but when I am typing commands on the server for routine maintenance or simple troubleshooting, it would be nice to be able to type the command and have it work like it used to. Note: I have tried this command in the past and it did not work.               echo 'export PATH=$PATH:/usr/sbin' >> $HOME/.bash_profile     . $HOME/.bash_profile     echo $PATH


Missing entries from messages file

I have a CentOS server that has been working well until recently. The virtualized instance of the server encountered some type of issue earlier today and required it to be hard rebooted in order for it to be able to be interacted with again. As I was digging through some of the log files to figure out what had happened, it appears that there are a number of days worth of entries that are missing from some of the log files. For example, the messages file has information from 6 days ago and then this morning after the reboot. I have looked through the tar g-zipped log rotated files as well and could not locate the needed information there.   * I was curious if there was a different place I could look for the information?    * What are some instances in which the information would disappear like this?   * Should I be worried about the machine having been compromised? A rkhunter scan did not find anything.


How do I find package URLs with Yum?

I want to update my system (Fedora) with Yum, but I want to use `aria2` to download the packages. There was something in `pacman` that you could use to get the update URLs (and put all links in a file.) Then, `aria2` could use this file as an input list for download. What is the Fedora equivalent?


How to tell what wireless protocols my network card is using?

I want to know which wireless protocol my card is currently using. I found a similar question that tells you what network protocol your card supports, but I want to confirm that my card is actually using that protocol with a given AP. In Windows and Mac you can see this information by simply hovering over the connection; see this question and this question. How can I do this in Linux?


How does less know the terminal resolution?

Everytime someone set a different size for a virtual console, `less` recognize window-resolution (I'm assuming that ...); according to that it changes how many lines of text it should visualize. How that parameter is computed?


How do I start a server via ssh and have it run after I log out?

I ssh into a virtual server and start up a web server. Everything runs as expected. But when I close my terminal on my laptop, the process dies on the virtual server. How do I fix this?


udev re-numbering when creating symlinks

I have USB cellular modem attached to an ALIX 3d2 board running voyage linux (which is based on Debian Squeeze). The modem registers itself as a TTY device, and so by default, udev will create TTY devices named "ttyUSB0" through "ttyUSB3" in `/dev`. However, there may be other USB-to-Serial devices attached and I'd like to have a known reference to the modem. So, I wrote a simple udev rule to make a link from the modem to `/dev/ttyModem{0-3}` however, the only way I could find to automatically handle the numbering was through the `%n` variable in udev, which has the problem of creating `/dev/ttyModem{4-7}` if a four port USB-to-Serial adapter is enumerated before the modem. I found some references to a `%e` variable in old udev documentation that would do just what I need, but it appears to have been removed some time ago. Luckily, there is a port number that can be referenced from the device for each tty device, so I should be able to handle the numbering manually. I can create a link based on the port number, but whenever I attempt to use both the port number and the USB vendorID+productID, the rule is no longer applied. I suspect that I might be violating the "one single parent device" rule somewhere, as these attributes are recognized in different devices according to `udevadm info`, but as far as I can tell, all attributes should be coming from one device and its parent. Here are the rules I've applied: This rule works, and is what I started with, but the number it generates may not start at 0.               SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{idVendor}=="1199", ATTRS{idProduct}=="0028", SYMLINK+="ttyUSBID%n"      * * * So I attempted to specify the port number using four rules like this one, however, this fails, I think because it violates the "one single parent device" rule.               SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", ATTRS{port_number}=="0", ATTRS{idVendor}=="1199", ATTRS{idProduct}=="0028", SYMLINK+="ttyFailingPort0"      * * * Every condition on this rule should come from the same node, so this rule (which works as you'd expect) should be able to reference a parent node.               SUBSYSTEMS=="usb-serial", KERNELS=="ttyUSB*", ATTRS{port_number}=="0", SYMLINK+="ttyPortNumberChild0"      * * * However, this rule fails, and I have no idea why.               SUBSYSTEMS=="usb-serial", KERNELS=="ttyUSB*", ATTRS{idVendor}=="1199" ATTRS{port_number}=="0", SYMLINK+="ttyFailingPortNumber0      * * * And here is the output of `udevadm info --attribute-walk` for port0, port1, port2, port3. The second device from the top contains the port number, and the fourth device contains the identifying USB information. I realize this is a bit of an XY problem, so if you know of a better way to give the modem a constant name, feel free to post that as your answer.


skype version spoofing?

Microsoft has apparently decided to terminate the skype service for older versions (before current 4.3.0.37). That's too bad because I'm needing skype for work badly. Since I'm using an old Mandriva distribution (1) the last version that worked for me was 2.2.0.25 (2). I like this system since it's running smoothly, don't want to change it just for skype. Don't want to install a vmware machine either. So since yesterday I get an error message when I try to log in: `server connection failed`. Curiously, I briefly ran `skype` as root and then I could log in again, but not any longer. I then tried creating another user and ran `skype` from that. No luck. I suspect the server reads out the version of the skype client I'm running and then it refuses connection. Or what is the mechanism here and can we circumvent it somehow? I thought immediately that one could possibly spoof version 4.3.0.37 making the server think I'm running this client and hence let me connect. Has anyone an idea how to concretely make this a reality? Any other ideas?               Linux version 2.6.31.13-desktop-1mnb (qateam@titan.mandriva.com) (gcc version 4.4.1 (GCC) ) #1 SMP Tue Apr 27 20:37:44 EDT 2010     skype-2.2.0.25-69.1mib2010.2.i686.rpm      PS: I need skype capability, not some other substitute service. The people I need to talk to only have skype and not the competency nor willingness to use another service. PPS: What I've done now is build my very old desktop computer which is a duron 1 ghz machine with 386 mb sd ram. Installed Win XP on it + SP3. Installed skype which didn't work. Then another version of skype for "old pc's" was offered. Installed that and now I can place calls successfully. That's not my preferred solution though.


Opening ALSA Microphone in two programs?

I'm using a raspberry pi to capture some audio, but I only want it to do it when the noise level goes above a certain level, and then the device will record until two seconds after it falls below that level again. I have a python program, audioserver.py which starts and stops another program, arecord, from recording from the microphone input. However, it appears that one program cannot have the audio device open while the other already does - is there a way I could overcome this problem and open my ALSA Microphone device more than once?


Best way to implement a system configuration driver for Linux

Is there a standard architecture for a driver that allows to read an set system configuration for an embedded Linux system? System configuration means for example hardware calibration values, revision numbers, regional configuration. A central driver is needed to provide the configuration to user space applications and to allow persistent changes of the values. The configuration will be changed by an application that is connected remotely to a special configuration system (for example on the production line). It would be nice to be able to read and write the configuration via file access. My idea was to implement a sysfs interface. But is this the best way? Is there a device class with similar requirements that I can use as a reference? Because the configuration has to be available via D-Bus, what would be the best way to get the config from sysfs to D-Bus?


fdisk vs parted

I've been running a small media server at home for 10+ years and looking at replacing it (before it breaks). I intend to hook up a new drive to my old system, partition and format (ext4 seems most stable right now) and copy the media over to the new disk, so that I can install that in a new computer (I will be leaving some partitions free on the drive for that). I have been reading my setup notes from 2002 when I used _fdisk_ for partitioning, now I often see _gparted_ or _parted_ is used. Is there any need to use (and install and learn) parted? My current, old system is 32bit and I read somewhere that parted is needed for 64 bit. I don't have parted on the system, but I don't want to make a disk that doesnt work well with the new setup.


How to configure Emacs for literate programming?

I would like to use Emacs for literate programming. I want my code to look like this .               <<class Hufftree definition>>=     template<typename DataType, typename Frequency> class Hufftree     {     public:       Hufftree public members     private:       Hufftree private members     };      In org-babel I can't give names to my code snippets which are spread all over the document and collect them together as shown below. Whenever I compile I want the tool to automatically insert `<<member functions>>` wherever I refer them.               Some text here. Blah blah...          <<my foo class>> ==     #+begin_src ruby      class Foo{         <<member functions>>     }     #+end_src          Something random to say about some other things.           <<member functions>> ==     #+begin_src      // code for member functions goes here      #+end_src


Number of backslashes needed for escaping regex backslash on the command-line

I recently had trouble with some regex on the command-line, and found that for matching a backslash, different numbers of characters can be used. This number depends on the quoting used for the regex (none, single quotes, double quotes). See the following bash session for what I mean:               echo "#ab\\cd" > file     grep -E ab\cd file     grep -E ab\\cd file     grep -E ab\\\cd file     grep -E ab\\\\cd file     #ab\cd     grep -E ab\\\\\cd file     #ab\cd     grep -E ab\\\\\\cd file     #ab\cd     grep -E ab\\\\\\\cd file     #ab\cd     grep -E ab\\\\\\\\cd file     grep -E "ab\cd" file     grep -E "ab\\cd" file     grep -E "ab\\\cd" file     #ab\cd     grep -E "ab\\\\cd" file     #ab\cd     grep -E "ab\\\\\cd" file     #ab\cd     grep -E "ab\\\\\\cd" file     #ab\cd     grep -E "ab\\\\\\\cd" file     grep -E 'ab\cd' file     grep -E 'ab\\cd' file     #ab\cd     grep -E 'ab\\\cd' file     #ab\cd     grep -E 'ab\\\\cd' file      This means that:   * with no quotes, I can match a backslash with 4-7 actual backslashes   * with double quotes, I can match a backslash with 3-6 actual backslashes   * With single quotes, I can match a backslash with 2-3 actual backslashes I understand that one extra backslash is ignored by the shell (from the bash man page): "A non-quoted backslash (\) is the escape character. It preserves the literal value of the next character that follows" This does not apply to the single-quoted examples, because no escaping is done in single quotes. And one additional backslash is ignored by the grep command ("\c" is just "c" escaped, but this is just the same as "c", because "c" does not have a special meaning in a regex). This explains the behaviour of the example with single quotes, but I don't really understand the other two examples, especially why there is a difference between non-qouted an double-quoted strings. Again, a quote from the bash man page: "Enclosing characters in double quotes preserves the literal value of all characters within the quotes, with the exception of $, `, \, and, when history expansion is enabled, !." I tried the same with GNU awk (e.g. `awk /ab\cd/{print} file`), with the same results. Perl, however, shows different results (using e.g. `perl -ne "/ab\\\cd/"\&\&print file`):   * with no quotes, I can match a backslash with 4-5 actual backslashes   * with double quotes, I can match a backslash with 3-4 actual backslashes   * With single quotes, I can match a backslash with 2 actual backslashes  Can anyone explain that difference between non-quoted and double-qouted regex strings on the command-line for grep and awk? I'm not that interested in an explanation of Perl's behaviour, since I usually don't use Perl one-liners.


Make cp return an error value if the target exists

Is there a way to make `cp` (from GNU coreutils on Linux) return a nonzero value in case the target file does already exist?   Or is there any other small utility which is commonly available and which provides this functionality? This would be useful in shell scripts, to atomically copy a file without accidentially loosing anything, and without user interaction. A similar result can be obtained by comparing the copy against the original, but I would have hoped for a simpler solution.


Conflict between `pushd .` and `cd -`

I am a happy user of the `cd -` command to go to the previous directory. At the same time I like `pushd .` and `popd`. However, when I want to remember the current working directory by means of `pushd .`, I lose the possibility to go to the previous directory by `cd -`. (As `pushd .` also performs `cd .`). How can I use `pushd` to still be able to use `cd -` By the way: GNU bash, version 4.1.7(1)


Solaris 11 login banner

How do you add a (GUI) login banner in Solaris 11? I've done quite a bit of searching and have found many things on SSH and FTP banners/motd for remote logins, but not much for the local GUI login. I found a few things that mention editing `/etc/gdm/custom.conf` (mainly for Linux, nothing specifically Solaris). However, none of the suggested changes seem to affect the login screen. Is there something different you have to do to make this work in Solaris 11 or is it not possible?


How to setup KVM partitions?

I'm trying to install SolusVM/KVM on a server with one 500 GB HD and one 256 SSD. I am a complete beginner at Linux. SolusVM has a script on the site to download and install automatically, but how do I specify to install the script on the 500 GB HD and put the virtual machines on the SSD? And how should my partitioning look like? I want KVM isos and stuff on HD and virtual machines on SSD. Thanks a lot.


egrep command which shows all the authors and subjects of mails contained in a directory

Anyone know of an `egrep` command which will show the authors and subjects of all mails contained in some directory?


Foremost file naming - Recovery of file names from inodes

I'm hoping this is not a stupid question. (apologies if it is) I have been asked to recover some files from a corrupt Linux partition. The partition data is shot to pieces but i have been able to locate the file names and the associated Inode number. Using Foremost i was able to recover the data (A folder full of pdf's), Foremost (as expected) has named the files as 6 digit hex values. My question is... What are the numbers that Foremost uses to name the file? Are they `inode` numbers? Addresses? Just unique numbers?


Can I Uninstall GUI From Debian?

I just did my first install of any Linux OS, and I accidentally selected "Desktop GUI" in the install, but I want to build everything myself. Is there any way by which I can uninstall the GUI environment without re-installing OS?


Have someone ever audited the default OpenWrt firewall rules?

I have an Openwrt 10.03.1 installed from: openwrt-ar71xx-wrt160nl-squashfs- factory.bin (firewall only customized with this: sed 's/REJECT/DROP/g' /etc/config/firewall) - so besides this, **IT'S A DEFAULT OPENWRT INSTALL**   I have 3 SSID's on it for 3 clients. It's a WRT160NL.   It connects to the internet via pppoe, so pppoe-wan is the WAN interface (in reality the "eth1" is the WAN interface, the cable is plugged into that port).   So I printed out the next things to paper:   iptables-save               root@OPENWRT:~# iptables-save     # Generated by iptables-save v1.4.6 on Wed Nov 21 16:59:23 2012     *nat     :PREROUTING ACCEPT [282:28098]     :POSTROUTING ACCEPT [12:748]     :OUTPUT ACCEPT [170:12487]     :nat_reflection_in - [0:0]     :nat_reflection_out - [0:0]     :postrouting_rule - [0:0]     :prerouting_lan - [0:0]     :prerouting_rule - [0:0]     :prerouting_wan - [0:0]     :zone_lan_nat - [0:0]     :zone_lan_prerouting - [0:0]     :zone_wan_nat - [0:0]     :zone_wan_prerouting - [0:0]     -A PREROUTING -j prerouting_rule      -A PREROUTING -i br-lan -j zone_lan_prerouting      -A PREROUTING -i pppoe-wan -j zone_wan_prerouting      -A POSTROUTING -j postrouting_rule      -A POSTROUTING -o br-lan -j zone_lan_nat      -A POSTROUTING -o pppoe-wan -j zone_wan_nat      -A postrouting_rule -j nat_reflection_out      -A prerouting_rule -j nat_reflection_in      -A zone_lan_prerouting -j prerouting_lan      -A zone_wan_nat -j MASQUERADE      -A zone_wan_prerouting -j prerouting_wan      COMMIT     # Completed on Wed Nov 21 16:59:23 2012     # Generated by iptables-save v1.4.6 on Wed Nov 21 16:59:23 2012     *raw     :PREROUTING ACCEPT [88762:5585776]     :OUTPUT ACCEPT [32677:185865297]     :zone_lan_notrack - [0:0]     :zone_wan_notrack - [0:0]     -A PREROUTING -i br-lan -j zone_lan_notrack      -A PREROUTING -i pppoe-wan -j zone_wan_notrack      COMMIT     # Completed on Wed Nov 21 16:59:23 2012     # Generated by iptables-save v1.4.6 on Wed Nov 21 16:59:23 2012     *mangle     :PREROUTING ACCEPT [88762:5585776]     :INPUT ACCEPT [86059:4425898]     :FORWARD ACCEPT [2664:1156339]     :OUTPUT ACCEPT [32677:185865297]     :POSTROUTING ACCEPT [35338:187021465]     :zone_wan_MSSFIX - [0:0]     -A FORWARD -j zone_wan_MSSFIX      -A zone_wan_MSSFIX -o pppoe-wan -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu      COMMIT     # Completed on Wed Nov 21 16:59:23 2012     # Generated by iptables-save v1.4.6 on Wed Nov 21 16:59:23 2012     *filter     :INPUT DROP [0:0]     :FORWARD DROP [0:0]     :OUTPUT ACCEPT [0:0]     :forward - [0:0]     :forwarding_lan - [0:0]     :forwarding_rule - [0:0]     :forwarding_wan - [0:0]     :input - [0:0]     :input_lan - [0:0]     :input_rule - [0:0]     :input_wan - [0:0]     :nat_reflection_fwd - [0:0]     :output - [0:0]     :output_rule - [0:0]     :reject - [0:0]     :syn_flood - [0:0]     :zone_lan - [0:0]     :zone_lan_ACCEPT - [0:0]     :zone_lan_DROP - [0:0]     :zone_lan_REJECT - [0:0]     :zone_lan_forward - [0:0]     :zone_wan - [0:0]     :zone_wan_ACCEPT - [0:0]     :zone_wan_DROP - [0:0]     :zone_wan_REJECT - [0:0]     :zone_wan_forward - [0:0]     -A INPUT -m state --state INVALID -j DROP      -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT      -A INPUT -i lo -j ACCEPT      -A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j syn_flood      -A INPUT -j input_rule      -A INPUT -j input      -A FORWARD -m state --state INVALID -j DROP      -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT      -A FORWARD -j forwarding_rule      -A FORWARD -j forward      -A OUTPUT -m state --state INVALID -j DROP      -A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT      -A OUTPUT -o lo -j ACCEPT      -A OUTPUT -j output_rule      -A OUTPUT -j output      -A forward -i br-lan -j zone_lan_forward      -A forward -i pppoe-wan -j zone_wan_forward      -A forwarding_rule -j nat_reflection_fwd      -A input -i br-lan -j zone_lan      -A input -i pppoe-wan -j zone_wan      -A output -j zone_lan_ACCEPT      -A output -j zone_wan_ACCEPT      -A reject -p tcp -j REJECT --reject-with tcp-reset      -A reject -j REJECT --reject-with icmp-port-unreachable      -A syn_flood -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m limit --limit 25/sec --limit-burst 50 -j RETURN      -A syn_flood -j DROP      -A zone_lan -j input_lan      -A zone_lan -j zone_lan_ACCEPT      -A zone_lan_ACCEPT -o br-lan -j ACCEPT      -A zone_lan_ACCEPT -i br-lan -j ACCEPT      **-A zone_lan_DROP -o br-lan -j DROP**     **-A zone_lan_DROP -i br-lan -j DROP**     **-A zone_lan_REJECT -o br-lan -j reject**     **-A zone_lan_REJECT -i br-lan -j reject**     -A zone_lan_forward -j zone_wan_ACCEPT      -A zone_lan_forward -j forwarding_lan      -A zone_lan_forward -j zone_lan_DROP      -A zone_wan -p udp -m udp --dport 68 -j ACCEPT      -A zone_wan -p icmp -m icmp --icmp-type 8 -j DROP      -A zone_wan -j input_wan      -A zone_wan -j zone_wan_DROP      -A zone_wan_ACCEPT -o pppoe-wan -j ACCEPT      -A zone_wan_ACCEPT -i pppoe-wan -j ACCEPT      -A zone_wan_DROP -o pppoe-wan -j DROP      -A zone_wan_DROP -i pppoe-wan -j DROP      -A zone_wan_REJECT -o pppoe-wan -j reject      -A zone_wan_REJECT -i pppoe-wan -j reject      -A zone_wan_forward -j forwarding_wan      -A zone_wan_forward -j zone_wan_DROP      COMMIT     # Completed on Wed Nov 21 16:59:23 2012     root@OPENWRT:~#       ifconfig               root@OPENWRT:~# ifconfig     br-lan    Link encap:Ethernet  HWaddr AA:AA:AA:AA:AA:AA           inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:87174 errors:0 dropped:0 overruns:0 frame:0           TX packets:137186 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0            RX bytes:4532245 (4.3 MiB)  TX bytes:192952659 (184.0 MiB)          eth0      Link encap:Ethernet  HWaddr AA:AA:AA:AA:AA:AA           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:0 errors:0 dropped:0 overruns:0 frame:0           TX packets:16 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000            RX bytes:0 (0.0 B)  TX bytes:2578 (2.5 KiB)           Interrupt:4           eth1      Link encap:Ethernet  HWaddr BB:BB:BB:BB:BB:BB           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:3661 errors:0 dropped:0 overruns:0 frame:0           TX packets:3447 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000            RX bytes:1221049 (1.1 MiB)  TX bytes:224533 (219.2 KiB)           Interrupt:5           lo        Link encap:Local Loopback             inet addr:127.0.0.1  Mask:255.0.0.0           UP LOOPBACK RUNNING  MTU:16436  Metric:1           RX packets:24 errors:0 dropped:0 overruns:0 frame:0           TX packets:24 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:0            RX bytes:2088 (2.0 KiB)  TX bytes:2088 (2.0 KiB)          mon.wlan0 Link encap:UNSPEC  HWaddr CC-CC-CC-CC-CC-C1-00-00-00-00-00-00-00-00-00-00             UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:263 errors:0 dropped:0 overruns:0 frame:0           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:32            RX bytes:20929 (20.4 KiB)  TX bytes:0 (0.0 B)          pppoe-wan Link encap:Point-to-Point Protocol             inet addr:1.2.3.4  P-t-P:10.0.0.1  Mask:255.255.255.255           UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1           RX packets:1646 errors:0 dropped:0 overruns:0 frame:0           TX packets:1448 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:3            RX bytes:1063783 (1.0 MiB)  TX bytes:132628 (129.5 KiB)          wlan0     Link encap:Ethernet  HWaddr CC:CC:CC:CC:CC:C1           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:0 errors:0 dropped:0 overruns:0 frame:0           TX packets:16 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:32            RX bytes:0 (0.0 B)  TX bytes:2850 (2.7 KiB)          wlan0-1   Link encap:Ethernet  HWaddr CC:CC:CC:CC:CC:C2           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:0 errors:0 dropped:0 overruns:0 frame:0           TX packets:16 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:32            RX bytes:0 (0.0 B)  TX bytes:2850 (2.7 KiB)          wlan0-2   Link encap:Ethernet  HWaddr CC:CC:CC:CC:CC:C3           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:0 errors:0 dropped:0 overruns:0 frame:0           TX packets:16 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:32            RX bytes:0 (0.0 B)  TX bytes:2850 (2.7 KiB)      brctl show               root@OPENWRT:~# brctl show     bridge name bridge id       STP enabled interfaces     br-lan      8000.129ce121c98e   no      eth0                                 wlan0                                 wlan0-1                                 wlan0-2     root@OPENWRT:~#       ...and take a closer look at it several times. I found a few things that I don't understand:      1)   These rules afaik completely USELESS, I'm sure about this, so there is no real question regarding this, at least a "fixme".   -A zone_lan_DROP -o br-lan -j DROP   -A zone_lan_DROP -i br-lan -j DROP   -A zone_lan_REJECT -o br-lan -j reject   -A zone_lan_REJECT -i br-lan -j reject      2)   The real question is... why are there soo many tables?   nat_reflection_in, nat_reflection_out, postrouting_rule, prerouting_lan, prerouting_rule, prerouting_wan, zone_lan_nat, zone_lan_prerouting, zone_wan_nat, zone_wan_prerouting, zone_lan, zone_lan_forward, zone_wan, zone_wan_forward, etc..   **Couldn't the rules done without tables? OpenWrt routers are usually have small CPU, why use complex rules? Why not more simple? Without tables?**      3)   ...If no one can bring up with a good answer that why are these tables needed...... then afaik I will flush all the rules, etc., and do it by hand.. in a more simpler way..


How to install postfix for sending mails to admin only?

I have a VPS running Ubuntu 13.10 on Digital Ocean. I'd like to install `postfix` on the server, but I want it to be able to send e-mails only to my e-mail address whenever a system message wants to be sent to root. Now I have my `postfix` installed as `local only`. This sends the messages to `/var/mail/root`. Instead, I'd like my messages to go to my real e-mail (`example@gmail.com`), but I don't want to allow other users/sites to send e-mail (like for example from PHP's `mail()`). Is this possible?


Black and white (greyish color) console and X11

Can I achieve simply the state of my system with no color? I'm using openbox.


How can I flatten nested .tar.gz files?

I've got a bunch of .tar.gz files in different paths. I'd like to create a new .tar.gz file at some common ancestor of them and I don't want it to be composed of nested .tar.gz files. How can I easily flatten the archive once created?


Mouse Scroll Wheel Speed Far too sensitive

In my crunchbang installation with X11, openbox, my wireless usb mouse is listed at both `/dev/psaux` and `/dev/input/mouse0`. It's working fine apart from the scrollwheel, which although active, is far too sensitive. I'm thinking maybe the kernel is raising double the scroll events that it should be? Not sure what to check out even if this is the case? I tried adjusting sensitivity via lxinput but it affected everything on the mouse apart from the actual scrollwheel. xinput list               ⎡ Virtual core pointer                      id=2    [master pointer  (3)]     ⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]     ⎜   ↳ Microsoft Microsoft® Nano Transceiver v2.0    id=9    [slave  pointer  (2)]     ⎜   ↳ Microsoft Microsoft® Nano Transceiver v2.0    id=10   [slave  pointer  (2)]      doing `xinput test 9` results in expected mouse motion events (but nothing for button clicks/scrollwheel) `xinput test 10` results in 'unknown class' with no events fired.


Cannot create lvm snapshot

I've found a proble creating a snapshot, as follows:               [root@centos7 ~]# vgs centos       VG     #PV #LV #SN Attr   VSize VFree       centos   3   2   0 wz--n- 9,50g 1,99g     [root@centos7 ~]# LANG=C lvcreate --size 300M --snapshot --name alfa /dev/mapper/centos-root  device-mapper: reload ioctl on  failed: Invalid argument       Aborting. Failed to activate snapshot exception store.     [root@centos7 ~]# dmesg | tail     [   21.881931] ip6_tables: (C) 2000-2006 Netfilter Core Team     [   22.144349] Ebtables v2.0 registered     [   22.205835] Bridge firewalling registered     [   23.694962] IPv6: ADDRCONF(NETDEV_UP): vhgnet0: link is not ready     [   23.695831] e1000: vhgnet0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX     [   23.696502] IPv6: ADDRCONF(NETDEV_CHANGE): vhgnet0: link becomes ready     [   41.871876] device-mapper: table: 253:6: linear: dm-linear: Device lookup failed     [   41.872657] device-mapper: ioctl: error adding target to table     [  737.566773] device-mapper: table: 253:7: linear: dm-linear: Device lookup failed     [  737.567120] device-mapper: ioctl: error adding target to table      what's wrong with this?


Is it possible to have X parse a per-user configuration file?

I am thinking that many of the options that one has to write in the traditional system Xorg.conf file, have to do with user preferences and thus should not IMHO be set by system administrators. In particular touchpad settings. I currently have several `xinput ...` lines in my `~/.xinitrc` to override defaults. I would like instead that X parses a configuration file of my choosing on startup, which I think would be a better way to set a lot of the per-user configuration. Is what I am asking possible?


How to play RTSP stream under Linux for the BOSCH AutoDome Junior HD IVA camera?

I have a AutoDome Junior HD IVA camera. How do I play RTSP stream in my Linux distro? I tried VLC but it fails. Is there any other reliable tool? **Follow up** : Try 1: fail               $ mplayer rtsp://192.168.1.10:554     MPlayer SVN-r33251-4.6.0 (C) 2000-2011 MPlayer Team     mplayer: could not connect to socket     mplayer: No such file or directory     Failed to open LIRC support. You will not be able to use your remote control.          Playing rtsp://192.168.1.10:554.     Connecting to server 192.168.1.10[192.168.1.10]: 554...          rtsp_session: unsupported RTSP server. Server type is 'unknown'.     STREAM_LIVE555, URL: rtsp://192.168.1.10:554     Stream not seekable!      file format detected.     Initiated "video/H264" RTP subsession on port 43230     demux_rtp: Failed to guess the video frame rate     VIDEO:  [H264]  0x0  0bpp  0.000 fps    0.0 kbps ( 0.0 kbyte/s)     FPS not specified in the header or invalid, use the -fps option.     Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory     [vdpau] Error when calling vdp_device_create_x11: 1     ==========================================================================     Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family     Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)     ==========================================================================     Audio: no sound     Starting playback...     V:   0.0   0/  0 ??% ??% ??,?% 0 0                                                   Exiting... (End of file)      Try 2: fail               $ mplayer mms://192.168.1.10:554     MPlayer SVN-r33251-4.6.0 (C) 2000-2011 MPlayer Team     mplayer: could not connect to socket     mplayer: No such file or directory     Failed to open LIRC support. You will not be able to use your remote control.          Playing mms://192.168.1.10:554.     STREAM_ASF, URL: mms://192.168.1.10:554     Connecting to server 192.168.1.10[192.168.1.10]: 554...          Connected     read error:: Resource temporarily unavailable     pre-header read failed     Connecting to server 192.168.1.10[192.168.1.10]: 554...          unknown ASF streaming type     Failed, exiting.     Connecting to server 192.168.1.10[192.168.1.10]: 554...          Cache size set to 320 KBytes     Cache fill:  0.00% (0 bytes)   nop_streaming_read error : Resource temporarily unavailable     Stream not seekable!     Cache fill:  0.00% (0 bytes)   nop_streaming_read error : Resource temporarily unavailable     Cache fill:  0.00% (0 bytes)             Cache not filling, consider increasing -cache and/or -cache-min!     nop_streaming_read error : Resource temporarily unavailable     Cache not filling, consider increasing -cache and/or -cache-min!     nop_streaming_read error : Resource temporarily unavailable     Cache not filling, consider increasing -cache and/or -cache-min!     nop_streaming_read error : Resource temporarily unavailable     Cache not filling, consider increasing -cache and/or -cache-min!     nop_streaming_read error : Resource temporarily unavailable     Cache not filling, consider increasing -cache and/or -cache-min!     Invalid seek to negative position!               Exiting... (End of file)


Locked out of server with SSH - anything I can do?

I accidentally locked myself out of my server. I changed the port, added ssh- keys, `PermitRootLogin` is 'no' and if I remember correctly `PasswordAuthentication` is also no. Logging in on another server works fine so the problem isn't due to my local ssh-keys. When logging in via `ssh -vv -p 2345 username@12.34.56.78` I get the following info back.               OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011     debug1: Reading configuration data /etc/ssh_config     debug1: /etc/ssh_config line 20: Applying options for *     debug1: /etc/ssh_config line 102: Applying options for *     debug1: Connecting to 12.34.56.78 [12.34.56.78] port 1234.     debug1: Connection established.     debug1: identity file /Users/yoeriboven/.ssh/id_rsa type 1     debug1: identity file /Users/yoeriboven/.ssh/id_rsa-cert type -1     debug1: identity file /Users/yoeriboven/.ssh/id_dsa type -1     debug1: identity file /Users/yoeriboven/.ssh/id_dsa-cert type -1     debug1: Enabling compatibility mode for protocol 2.0     debug1: Local version string SSH-2.0-OpenSSH_6.2     debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3     debug1: match: OpenSSH_5.3 pat OpenSSH_5*     debug1: SSH2_MSG_KEXINIT sent     Connection closed by 12.34.56.78      I luckily can still login via FTP so I backed up all the files but I only have access to the user's folder. Any idea how I could login? If not, I'll have to destroy the server and set it up all over.


Boot device /dev/sda1 does not exist on Debian in QEmu

I have an image of Debian/LXDE assembled for ARM and I trying to run it in Qemu. I am using this command:               sudo qemu-system-arm -M versatilepb \          -kernel ./vmlinuz-2.6.32-5-versatile \          -initrd ./initrd.img-2.6.32-5-versatile \          -hda ./debianlxde.img -m 256 -append "root=/dev/sda1 m=256M"      The system tries to run but fails with following errors:               Gave up waiting for root device. Common problems:       - Boot args (cat /proc/cmdline)         - Check rootdelay= (did the system wait long enough?)         - Check root= (did the system wait for right device?)       - Missing modules (cat /proc/modules; ls /dev)     ALERT! /dev/sda1 does not exist. Dropping to a shell!      My OS is Fedora 16 (RFR 16). What am I doing wrong?


How to find out the escape sequence my keyboards sends to terminal?

Let's say we have a generic keyboard with some unknown keys which may send escape sequences to terminal. The keyboard is connected to an xterm terminal emulator running on a generic BSD/Linux. To create correct mapping for the unknown keys, we must first know what escape sequences they send to the xterm. But how to know what escape sequences the keys send?


Why does Unix store timestamps in a signed integer?

Why is a signed integer used to represent timestamps? There is a clearly defined start at 1970 that's represented as 0, so why would we need numbers before that? Are negative timestamps used anywhere?


How do I add a logon GUI to Backtrack 5 R1 with GNOME?

I'm running Backtrack 5 R1 with GNOME in Virtualbox on a Windows 7 x64 host. In the default install, Backtrack boots to a command-line login prompt and then requires you to run `startx` to load the GNOME desktop. Is there a way for me to install a GUI login interface? I'd prefer if the interface could also auto-start the GNOME desktop on login.


Why are ifconfig's rx/tx bytes reset?

I save every 30 minutes `ifconfig`'s rx and tx bytes for a given interface (ppp) and I see most of the time a steady increase but there are lots of drops/decreased, as if `ifconfig`'s counter was reset from time to time without any notice. Any idea ? The counters are not close to a 2^n int/long limit either. I save in my database the uptime of the machine so I am sure there was no reboot.               ...     data_rx: 2118258     data_rx: 2638183     data_rx: 3177673     data_rx: 3706863     data_rx: 233670     data_rx: 538421     ...     data_rx: 10792855     data_rx: 11316207     data_rx: 180722      data_rx: 725622      data_rx: 1251739     ...     data_rx: 4522068


How can I have Linux Mint 15 Olivia always startup in console mode

Several months ago, I installed Mint 15 on an old laptop with the intent to use it to run various game servers for the house. All of these are console apps, so I'd like to not have to bother booting into any GUI. I just have no idea how to achieve this, or if it is any different from how this is achieved with other Linux flavours.


Bash: handling "[[ statement ]] || echo problem found ; exit 1" logic

In the statement in the title, there is a problem that even if the statement is true, it will still exit with status 1 because, as I understand it:               [[ statement ]] || echo problem found ; exit 1      Evaluates to if the statement is false, echo problem found. Exit with status 1. Even if the statement evaluates true, the exit 1 still happens because it is separate. I thought to fix this by running it in a subshell like so:               [[ statement ]] || (echo problem found ; exit 1)      This seems to do what I want, but is it an acceptable way to handle this?


bit-wise complement with dd?

When secure erasing a disk, how can I do a "bit-wise complement" with dd? (or with other UNIX tools?)


What does the (!) mean after uptime on htop

I was analyzing some web heads looking at `htop` and noticed the following               Uptime: 301 days(!), 23:47:39      What does the `(!)` mean?


I'm running out of room on my root partition. How do I expand it with free space?

I'm running Debian (wheezy) on my Raspberry Pi, and I apparently allocated something incorrectly when setting it up awhile back. I have a 16GB SD card, and I'm only using a couple GB for the root partition. When I plug in the card to my Mac card reader, and this is what I see. ![Screenshot of partition information](http://dl.dropbox.com/u/73017/Screenshots/partition.png) It looks like I have a large chunk of unused space. How do I go about reclaiming this without wiping out my existing data/settings? Looking for command-line instructions.


Lazy mount of remote filesystem (with sshfs)

I have a remote computer, and I mount its filesystem with sshfs to my local folder `~/user@host`, like that:               sshfs user@host: ~/user@host      Works nice, but I want to implement "lazy" mount: i.e. I don't want it to be mounted at system startup, but I want it to be mounted just when I'm trying to open my local folder `~/user@host` . Probably there is some way to define like "filesystem hooks": just when user requests directory contents, some command should be executed. Is it possible?


In the mwmrc file, how can I disable the mouse from resizing or moving a window?

In my local .mwmrc file I have disabled moving and resizing window from the system menu, but I can still use the mouse to move or resize the window. How do I prevent users from doing that with the mouse?               Menu DefaultWindowMenu     {     !   Restore     _R  Alt<Key>F5  f.restore     !   Move        _M  Alt<Key>F7  f.move     !   Size        _S  Alt<Key>F8  f.resize     !   Minimize    _n  Alt<Key>F9  f.minimize     !   Maximize    _x  Alt<Key>F10 f.maximize     !   Lower       _L  Alt<Key>F3  f.lower     !   no-label                f.separator     !   Close       _C  Alt<Key>F4  f.kill     }      I'm running SLES 11. The windows are in a Java Swing application delivered via javaws. The application developers don't want to manage their windows and expect it to happen at the OS level.


View permission / owner of full directory tree

I remember doing someting like "XXX /home/user/dir/child/file" and it returned the owner and/or permission of:               /home     /home/user     /home/user/dir     /home/user/child     /home/user/child/file      But I don't remember what this command was. Anybody any idea?


2 ip ranges / 1 nic OR why does one ip range follow default route before local routes

_Updated at the bottom_ I'm using Centos as a router, and just replaced the routing system at work. I've got 2 routers to send data around. For the most part it's working. On one router I have 2 network ranges that are on the same nic (eth1). We have a server on one range, and anyone in the other cannot SSH to it. But, it can be pinged. Here's a quick layout: Internet Link:               eth0 - 192.168.144.50 (link between routers)     eth1 - 10.10.10.254 - 255.255.254.0 (10.10.10.x and 10.10.11.x ranges)     eth2 - internet      Router 2:               eth0 - 192.168.144.24 (link between routers)     eth1 - 98.0.0.1 & 10.98.0.1 ranges (yes, I know 98.0.0.0 is not for private use, this is a legacy setup that we haven't been able to remove yet)      Here is the **ip route** printout:               98.0.0.0/24 dev eth1  proto kernel  scope link  src 98.0.0.1     192.168.144.0/24 dev eth0  proto kernel  scope link  src 192.168.144.24     10.98.0.0/24 dev eth1  proto kernel  scope link  src 10.98.0.1     default via 192.168.144.50 dev eth0      The server is on 98.0.0.6. I have a laptop running on 10.98.0.165. I get a response from the command: ping 98.0.0.6. But, when I try to ssh to it, I get nothing. Through doing some tcpdump commands on my routers, I'm seeing that the packets for the ssh command are going from the laptop, to the internet router (192.168.144.50) and back to the correct router. My iptables list is empty. You can see my ip route output above. Any ideas? I've been staring at this all day. The way I understand it, is that the router should send the packet back through eth1 for 98.0.0.6 to pick up. Thanks. Edit: Scratched out the bouncing part. I realized that I was seeing ssh traffic from my ssh session into the router, and attributed it to my ssh request. **Update** I separated my setup. Now 98.0.0.x is on eth1 and 10.98.0.x is on eth2. What I'm seeing isn't making much sense though. When I ping the 98.0.0.6 server from my 10.98.0.165 laptop, I get a reply. The route it is taking is odd. It goes through the default route to 192.168.144.50 (internet router) and back through to 98.0.0.6. (tcpdump on eth0 of the internet router found this) One tidbit. When I started the project, I was trying to do policy routing to make 2 internet providers work. Is there something related that could be doing this? Here's my updated layout for the second router               eth0 - 192.168.144.24 (router link)     eth1 - 98.0.0.1 / 24     eth2 - 10.98.0.1 /24      and **ip route show**               98.0.0.0/24 dev eth1  proto kernel  scope link  src 98.0.0.1     192.168.144.0/24 dev eth0  proto kernel  scope link  src 192.168.144.24     10.98.0.0/24 dev eth2  proto kernel  scope link  src 10.98.0.1     default via 192.168.144.50 dev eth0


Defining Languages Available at boot - LiveCD

I am trying to create a refined version of the buggy uck for customizing Ubuntu LiveCD ISO, here it is if you're interested in helping. **NOTE:** The process is straight-forward, except when customizing on-boot locale languages. I read that isolinux tweaks could help in doing that, but I don't know how. I don't want advanced customization of languages, I just want two options:   1. Specify a set of languages that are supported in the booting environment.   2. Specify a default language among them. Is that possible?


Forwardticks in example command in `man emerge`: local misconfiguration or typo?

In Manpage of EMERGE it is stated: _To find files that need to be updated in /etc, type find /etc -iname ´._cfg????__ ´* Taking a closer look at it (copy- pasted from terminal -- not from the online version of the manual): `find /etc -iname ´._cfg????_*´`. Using exactly this command won't work because the string in question is inside forward-ticks `´...´` and not inside single quotes, like find `/etc -iname '._cfg????_*'` which works as expected. Is this a local misconfiguration or a typographical error in the Manpage (which means that I should direct this question to https://bugs.gentoo.org/)?


Switch to TTYs without Function keys

At the moment I have a keyboard which lacks function keys (F1 through F12), and I was wondering - is there a way I could switch to textual TTYs (and back, which might prove to be a problem if I were to use `xmodmap`)?


Why doesn't tar ask before overwriting existing files?

I lost a couple hundred lines of a Vim plugin I wrote and continue back up every so often because I extracted a `tar` file containing an older version. I decided not to use source control management when I wrote the plugin, since I only update it periodically. Why doesn't `tar` ask before overwriting existing files by default? I'm guessing that there's some rationale behind why the default behavior is to overwrite files silently, since we usually want safety over speed and convenience. For example, we usually use `#ifdef NDEBUG`, not `#ifdef DEBUG`; similarly, I would expect `tar` ask me before overwriting any files, and for it to have some flag which I can use to tell it to overwrite files without asking me. Also, how can make it so that `tar` does ask me by default, without me having to give it any flags? I'm fine with using tools other than `tar`, if they support this safer default behavior. Thank you for your time!


How to install google chrome with apt-get?

My Linux version is Ubuntu:               > cat /etc/lsb-release     DISTRIB_ID=Ubuntu     DISTRIB_RELEASE=9.04     DISTRIB_CODENAME=jaunty     DISTRIB_DESCRIPTION="Ubuntu 9.04"      running as virtual machine. I did as said here Now when I type               sudo apt-get install google-chrome-stable      I get               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:       google-chrome-stable: Depends: libasound2 (> 1.0.22) but 1.0.18-1ubuntu9 is to be installed                             Depends: libatk1.0-0 (>= 1.29.3) but 1.26.0-0ubuntu2 is to be installed                             Depends: libc6 (>= 2.11) but 2.9-4ubuntu6.3 is to be installed                             Depends: libcups2 (>= 1.4.0) but 1.3.9-17ubuntu3.9 is to be installed                             Depends: libdbus-1-3 (>= 1.2.14) but 1.2.12-0ubuntu2.1 is to be installed                             Depends: libfontconfig1 (>= 2.8.0) but 2.6.0-1ubuntu12 is to be installed                             Depends: libgconf2-4 (>= 2.27.0) but 2.26.0-0ubuntu1 is to be installed                             Depends: libgcrypt11 (>= 1.4.2) but 1.4.1-2ubuntu1 is to be installed                             Depends: libgtk2.0-0 (>= 2.18.0) but 2.16.1-0ubuntu2 is to be installed                             Depends: libstdc++6 (>= 4.4.0) but 4.3.3-5ubuntu4 is to be installed                             Depends: libudev0 (>= 147) but it is not going to be installed     E: Broken packages      What does it mean? Why it doesn't install required packages automatically? My linux is `Linux ubuntu3 2.6.24-19-xen #2 SMP Fri May 23 03:11:08 JST 2008 i686 GNU/Linux` **UPDATE** If I use `dpkg`, I get apparently the same               > sudo dpkg --install google-chrome-stable_current_i386.deb     Selecting previously deselected package google-chrome-stable.     (Reading database ... 31919 files and directories currently installed.)     Unpacking google-chrome-stable (from google-chrome-stable_current_i386.deb) ...     dpkg: dependency problems prevent configuration of google-chrome-stable:      google-chrome-stable depends on libasound2 (>> 1.0.22); however:       Version of libasound2 on system is 1.0.18-1ubuntu9.      google-chrome-stable depends on libatk1.0-0 (>= 1.29.3); however:       Version of libatk1.0-0 on system is 1.26.0-0ubuntu2.      google-chrome-stable depends on libc6 (>= 2.11); however:       Version of libc6 on system is 2.9-4ubuntu6.3.      google-chrome-stable depends on libcups2 (>= 1.4.0); however:       Version of libcups2 on system is 1.3.9-17ubuntu3.9.      google-chrome-stable depends on libdbus-1-3 (>= 1.2.14); however:       Version of libdbus-1-3 on system is 1.2.12-0ubuntu2.1.      google-chrome-stable depends on libfontconfig1 (>= 2.8.0); however:       Version of libfontconfig1 on system is 2.6.0-1ubuntu12.      google-chrome-stable depends on libgconf2-4 (>= 2.27.0); however:       Version of libgconf2-4 on system is 2.26.0-0ubuntu1.      google-chrome-stable depends on libgcrypt11 (>= 1.4.2); however:       Version of libgcrypt11 on system is 1.4.1-2ubuntu1.      google-chrome-stable depends on libgtk2.0-0 (>= 2.18.0); however:       Version of libgtk2.0-0 on system is 2.16.1-0ubuntu2.      google-chrome-stable depends on libstdc++6 (>= 4.4.0); however:       Version of libstdc++6 on system is 4.3.3-5ubuntu4.      google-chrome-stable depends on libudev0 (>= 147); however:       Package libudev0 is not installed.      google-chrome-stable depends on libxss1; however:       Package libxss1 is not installed.      google-chrome-stable depends on xdg-utils (>= 1.0.2); however:       Package xdg-utils is not installed.     dpkg: error processing google-chrome-stable (--install):      dependency problems - leaving unconfigured     Processing triggers for menu ...     Processing triggers for man-db ...     Errors were encountered while processing:      google-chrome-stable      **UPDATE 2** I don't want to participate in upgrading race. I have many machines and systems and if I would upgrade them all the times they want this, I would spent all my time upgrading. Also after upgrading, many components become uncompilable too.


syntax of ls --hide= and ls --ignore=

`ls --hide` and `ls --ignore` provides the possibility leave out files defined through regular expressions set after the `\--ignore=` part. The latter makes sure that this option isn't turned off via `-a, -A`. The command's `man` and `info` page mention Regular Expressions. **Question** : Which wildcards or Regular Expressions are supported in `ls --hide=` and `ls --ignore=`. I found out that `* $ ?` seem to be supported, as well as POSIX Bracket Expressions. But this doesn't seem to work properly all the time and is more a game of trial and error for me. Did I miss something important here?


How do you boot Puppy Linux Slacko into the command line?

How do you boot Puppy Linux Slacko (or Precise or Wary) into the command line? I wish to `startx` only if I need it. Unfortunately it does not seem to copy Slackware's traditional `/etc/inittab` runlevel methodology.


Recursively downloading all files from a website's child directory using wget

I am trying to recursively download the contents of a particular directory (via http from a web server) using wget. The command I am using is:               wget -r -l 0 --user=josh --ask-password http://morris.cs.example.com/files/Software/MySoftware/V2012_Linux      wget then appears to download the contents of the parent directories rather than just the intended child directory (V2012_Linux). How do I modify my command to download only the contents of the child directory and also place it in a directory of my choosing?


vim backspace not working normally

The `Backspace` key is not working as expected in `vim` and also in `vi`. It is working as the `Delete` key, and Delete key is deleting the char, but instead something wierd happens. But, for now, I am trying to get the `Backspace` key working. I tried few solution by googling and searching unix.se, but none helped. I tried adding               :map~ ^? ^H      to `.exrc` file. Also tried adding following function from this link, later mapping the correct key-sequence as given, but even that didn't help solve the issue.               func Backspace()       if col('.') == 1         if line('.')  != 1           return  "\<ESC>kA\<Del>"         else           return ""         endif       else         return "\<Left>\<Del>"       endif     endfunc      ### `vim` details               VIM - Vi IMproved 7.0 (2006 May 7, compiled Jun 12 2009 07:09:20)      ### Machine               $ cat /etc/*release     Red Hat Enterprise Linux Server release 5.5 (Tikanga)      ### Note:   1. I connect to a remote unix machine using putty connection manager.   2. `Shift`+`Backspace` works as normal `Backspace` key works i.e. delete a character to the left.


Link value is 2 by default for folders

Can anyone help me to understand the logic behind the link value being "2" for the first time when we create any folders/ directory in linux. ![enter image description here](http://i.stack.imgur.com/kPmXj.jpg) I searched a lot , but couldn't get satisfactory logic


Can't install grub if mbr contains iso9660

I installed Debian/Gnu-Linux on a disk which previously contained an ISO9660 filesystem, and grub can't be installed :               root@debian:~# grub-install /dev/sdb     /usr/sbin/grub-setup: error: hd1 appears to contain a iso9660 filesystem which isn't known to reserve space for DOS-style boot.  Installing GRUB there could result in FILESYSTEM DESTRUCTION if valuable data is overwritten by grub-setup (--skip-fs-probe disables this check, use at your own risk).      I was able to install it on an other disk currently plugged on the machine (/dev/sda), but I'd like to get rid of it. I tried `install-mbr /dev/sdb`, hoping it would erase the ISO9660 blocks, but I still get the error with grub-install. I could probably copy some blocks of /dev/sda to /dev/sdb, but how many of them ?


How do I remove a simple piece of software?

I want to get rid of the automatically installed solitaire "games" in my brand new Fedora 18. I tried the gnome way, but nothing gets listed when I search for "silitaire". I tried the command line way: > $ su -c 'yum remove *solitaire'   >  Password:   >  Loaded plugins: langpacks, presto, refresh-packagekit   >  No Match for argument: *solitaire   >  No Packages marked for removal


How compatible is Centos in respect to hardware for desktop systems?

I have been tasked with creating a promotional/sales tool for our clients and sales people . (about 8400 users) It is expected that the tool will be used on office and home systems. The tool will run in Linux as a live DVD. So after use, they can go back to windows. For business reasons this must be done in Linux on a live dvd. Windows is not an option. MY question is which distro should be used as the OS if hardware compatibility is the OVERWHELMING concern. in addition to general hardware compatibility, the key compatibility issues are Video cards, sound cards, and network cards. I was pushing for Ubuntu because I assume that Canonical has focused on hardware compatibility. I know we are going to get phone calls, but we want to minimize tech support issues and more importantly, we must provide a good experience for our users. Or the whole project could backfire. Our contract programmer is pushing for Centos. Is Centos EXTREMELY hardware compatible? As compatible as Ubuntu? Would you recommend another distro that we have not thought of?


Partitioning disk image file

I want to partition raw disk image with the following commands               #creating the blank image     $ dd if=/dev/zero of=example.img bs=1M count=50          #write the partition table     $ parted example.img mktable msdos          #creating partition but not the file system     #creating fat32 primary partition 1 to 15 MB     $ parted example.img mkpart p fat32 1 15     #creating ext3 primary partition 16 to end     $ parted example.img mkpart p ext3 16 -0      These command doesn't create file system. How could I do that? I am trying the `mkfs` command in `parted` but it is showing no command found. How could I create file system externally?


tar: Unexpected EOF in archive

I am trying extract .tar.gz file it but with no luck               gzip: stdin: unexpected end of file     tar: Unexpected EOF in archive     tar: Unexpected EOF in archive     tar: Error is not recoverable: exiting now      the file tar.gz include another file.tar only which is has the issue when i trying to extract .tar file i got               tar: Unexpected EOF in archive     tar: Unexpected EOF in archive     tar: Error is not recoverable: exiting now      i tried –ignore-zeros –ignore-failed-read with no luck file type tar.gz: gzip compressed data, from Unix how could i extract this file even if it corrupted ?