title: Tokenize string from $REPLY in bash script

text: This is my first post, and I have no idea how I managed anything before StackExchage, Google, Wiki, GNU, Internet, the list goes on :) I am trying to find a way to construct a SQL database generator bash script, which currently looks like this...               renice -n 19 $$;          idx=32768;     dbt='Radix_en';          cat Domains_en.txt;     cat Tables_en.txt;          while read;      do     checks="$(echo -n $REPLY | md5sum)";     checks=${checks%"  -"};          echo "insert into $dbt values ($idx,'$(uuidgen)','${checks}',$REPLY);";     idx=$((idx+1));          done < Data.txt;     echo "commit;";      The data comes from Data.txt, currently in the form of:               'NUMBER','US_EN','LATIN','GREEK','GERMAN'     0,'zero','nulla','μηδέν','Null'     1,'one','Unum','ένα','ein'      The output is valid SQL (for Firebird):               create domain ...;     create domain ...;     commit;          create table ( ... );     create table ( ... );     commit;          insert into Radix_en values (32768,'dff0207a-591f-4435-9f8b-7b9b3e6ba2c1','d1f77359b3f7236806489ba3108c771f','NUMBER','US_EN','LATIN','GREEK','GERMAN');     insert into Radix_en values (32769,'5ef0e634-5c96-4ae4-92a8-0d68c02ffeb6','4e3f710600230cf0520bf32269511062',0,'zero','nulla','μηδέν','Null');     insert into Radix_en values (32770,'eae9cacc-3ee3-4471-afad-e5af201da435','9ab2f782988416431238ec63277b11df',1,'one','Unum','ένα','ein');     commit;      I would like to find a way to generate the MD5 checksum for every field, instead of the entire line of text including delimiters. Data.txt format is not yet finalized, and I may change its format to anything which would makes this possible or easier. Also, if there has to be several separate steps - fine, since the entire process should be scripted and automated. I was considering processing Data.txt first, then run it through this script, but I would like to simplify the process as much as possible. The number of different Data.txt files could be large, and I still have numerous other processors to include. As the matter of fact I am also trying to learn more about bash scripting, and I am rather hooping to find expert approach and advise to this problem more than a specific solution. I am not even sure if my post title is the solution I need, and thus it is related to my question. I was not sure if I should post this on Superuser where I usually visit or here. So I post here first, and sorry if I am off a bit. Thanks! Sandor ... Edited to add more on 08/23/2014 3:00 AM Thanks to mikeserv using IFS is working, so my scripts now looks like this:               renice -n 19 $$ > /dev/null; #for now          idx=32768;     dbt='Radix_en';          cat Domains_en.txt;     cat Tables_en.txt;          while read;      do          gid="$idx,'$(uuidgen)'";          IFS=,; set -f # no gobbling!     echo "insert into $dbt values ($gid";         for field in $REPLY         do           printf '%s' ",$field,'";         printf '%s' "$field" | md5sum;         done | cut -d\  -f1;               echo "$var);";          idx=$((idx+1));          done < Data.txt;      The output is great, the line breaks are making text edit/search much easier while Firebird is still happy, except one thing.. Here is the output:               create domain ...;     create domain ...;     commit;          create table ( ... );     create table ( ... );     commit;          insert into Radix_en values (32768,'303f8957-57cf-4485-ace4-d21c7cf144e6'     ,'NUMBER','722d79c16b51fe86610972b8d950038c     ,'US_EN','b63fb39e32b062c76694bec58c4f8c67     ,'LATIN','fd6f27a3c59111fc2a0b5e452595ef3d     ,'GREEK','c081310697bb6b7d7bed5034824e2530     ,'GERMAN','15db1d0e1b0861d8ac1f391db801493a     );     insert into Radix_en values (32769,'e7fdf095-d31c-4c59-a23b-7ea67db7aefb'     ,0,'cfcd208495d565ef66e7dff9f98764da     ,'zero','01b40535afbfd9611e910f58f4ab5146     ,'nulla','584edd0b6638798dee53e2c23e84e2d1     ,'μηδέν','cd3ed2f1039ed8668b4d48e742bd2e5b     ,'Null','e0a93a9e6b0eb1688837d8bab9b4badb     );     insert into Radix_en values (32770,'a21916b5-2a05-4656-ad4e-c8cfee1abfcc'     ,1,'c4ca4238a0b923820dcc509a6f75849b     ,'one','7e31533231a12e4a560a18ac8cd02112     ,'Unum','05d92bcbffbf59b375f25945e9af2dd0     ,'ένα','826f5e2d5ba7ace48f4d6fe3c5e2925f     ,'ein','dcc09a2cb665ca332d1689cb11aff592     );     commit;      The md5 hash is missing a delimiter at the end, and I have no idea how to negotiate the output with the pipes. What is it I am not understanding here? Since in this particular case the data fields are going to hold code for programmable ICs no extra characters are going to be acceptable in the checksum between the delimiters, and so far it looks like so. Again, the code is in ASCII and my delimiter is going be something that is not part of ASCII so it is safe. Firebird also going to reject anything not ASCII. If you would be so kind to point me to how to finish this script, as I am already banging my head against some new issues IFS just showed me (yes, file paths on Windows). I'll try and see how this script is going to work with pure ASCII, then I would like to move on and make another post about some more issues. Thanks again for your help! Sandor ... Edited to final on 08/30/2014 7:00 PM Replacing cut with sed seems to work. Firebird field input still needs to be escaped for semi-colons (') with another of the same added, and the current comma IFS delimiter in data files still has to be replaced with non-ASCII. Instead of recursive file lists this script is still a single-file input. echo should probably be replaced by printf, and a whole lot of more... Here is the final script excluding the shebang:               renice -n 19 $$ >> Radix_en_log.txt;          idx=32768; dbt='Radix_en';     cat Domains_en.txt; cat Tables_en.txt;          while read;     do     gid="$idx,'$(uuidgen)'";          IFS=,; set -f;     echo "insert into $dbt values ($gid";         for field in $REPLY         do               printf '%s' ",$field,'"; printf '%s' "$field" | md5sum;         done | sed "s/[ ][ ][-]/\'/g"; printf '%s\n' ");";         idx=$((idx+1));             done < Data.txt;     echo "commit;";      Here is the output:               create domain ...;     create domain ...;     commit;          create table ( ... );     create table ( ... );     commit;          insert into Radix_en values (32768,'2f675b86-b2b4-4e52-b000-e6a8cf0f3dca'     ,'NUMBER','722d79c16b51fe86610972b8d950038c'     ,'US_EN','b63fb39e32b062c76694bec58c4f8c67'     ,'LATIN','fd6f27a3c59111fc2a0b5e452595ef3d'     ,'GREEK','c081310697bb6b7d7bed5034824e2530'     ,'GERMAN','15db1d0e1b0861d8ac1f391db801493a'     );     insert into Radix_en values (32769,'e2afcd65-9a1b-49e3-baf1-74b0619a4776'     ,0,'cfcd208495d565ef66e7dff9f98764da'     ,'zero','01b40535afbfd9611e910f58f4ab5146'     ,'nulla','584edd0b6638798dee53e2c23e84e2d1'     ,'μηδέν','cd3ed2f1039ed8668b4d48e742bd2e5b'     ,'Null','e0a93a9e6b0eb1688837d8bab9b4badb'     );     insert into Radix_en values (32770,'f51b72eb-d64f-4e9e-ab49-8954df9505cd'     ,1,'c4ca4238a0b923820dcc509a6f75849b'     ,'one','7e31533231a12e4a560a18ac8cd02112'     ,'Unum','05d92bcbffbf59b375f25945e9af2dd0'     ,'ένα','826f5e2d5ba7ace48f4d6fe3c5e2925f'     ,'ein','dcc09a2cb665ca332d1689cb11aff592'     );     commit;      Thanks! Sandor


title: Adding 2 lines in text file stanza

text: I have a text file divided in stanzas. Each stanza starts with a [keyword] and ends with a blank line. Something like this:               [keyword1]     param1 = value1     param2 = value2     param3 = value3          [keyword2]     param4 = value4     param5 = value5     ...      I need a script (probably a one line command will work) to insert 2 lines immediately after a given `[keyword]`. Lines to be inserted are like the above couples:               param = value      I was thinking about using `sed` with in place editing plus a backup copy file just in case.


title: Unable to install rbenv with deployer user in CentOS - Permission denied

text: I created a new user in CentOS 6.3 using this commands               useradd deployer          passwd deployer          visudo      then I added this line to file:               deployer ALL=(ALL) ALL      Fine! Now I trying to install rbenv, to deploy an RoR application. I followed this steps:               cd /home/deployer          su deployer          curl https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash      It worked. After, I added rbenv to .bashrc and tried to reload .bashrc file and get this error:               [deployer@mycentos ~]$ . ~/.bashrc      bash: /home/deployer/.rbenv/bin/rbenv: Permission denied      Anyone know why?


title: Are there any tools to test MTD/JFFS2 for Linux 2.4 kernels

text: I have some issues with a platform I support and I suspect memory problems. I wanted to check the Flash parts using some MTD JFFS2 test tools, I found a link to a bunch on this site. However they note that support really isn't there for 2.4 and as stated on that site: > The MTD community is neither able nor interested to provide support for > ancient kernels. Either move yourself and update to a recent kernel. As upgrading isn't an option for me, I'm trying to find out if there are any other tools that could be used to test Flash memory in Linux on older kernels.


title: How set glib environment variable: g_slice

text: I've been told I need to set the following environment variable in order to work around a glib bug:               G_SLICE=always-malloc      But I don't know how to do it, and anywhere I've seen it's use recommended, they just take it for granted you know how to do it (even the gnome documentation: https://developer.gnome.org/glib/stable/glib-running.html). So I tried setting it as a linux environment variable. I tried setting it in the programming environment I was in (Firefox Add-on SDK), but without success. It seems to me that I may have to install glib development packages and find some sort of config file. But perhaps someone would help before I go up the wrong path?


title: Difference between Solaris and OpenSolaris?

text: So I want to learn using Solaris [Diskgroups, etc.]. I recently found out that there is an OS named OpenSolaris: https://en.wikipedia.org/wiki/OpenSolaris Is it a good point to learn Solaris? Or it's different then Solaris? How much it differs from it?


title: Help me to replace sshfs with ssh?

text: I love to do just this:               $ sshfs mountPoint myServer     $ cp thisFile mountPoint      I am now using LiveCD and I do not have sshfs utility available and I need run `$ sudo dd /dev/sdb2 > mountPoint`, how to do this as easy as with sshfs? **Perhaps related**   1. http://superuser.com/questions/397646/cloning-fresh-windows-7-fsed-hdd-to-linux-server-because-having-no-external-hdd **Comment to Psusi**               $ sudo fdisk -l|tail     255 heads, 63 sectors/track, 4864 cylinders, total 78142806 sectors     Units = sectors of 1 * 4096 = 4096 bytes     Sector size (logical/physical): 4096 bytes / 4096 bytes     I/O size (minimum/optimal): 4096 bytes / 4096 bytes     Disk identifier: 0x181d6d22             Device Boot      Start         End      Blocks   Id  System     /dev/sdb1   *        2048     3074047    12288000    7  HPFS/NTFS/exFAT     /dev/sdb2         3074048   600563711  2389958656    7  HPFS/NTFS/exFAT     /dev/sdb3       600563712   625139711    98304000    7  HPFS/NTFS/exFAT     $ sudo file -s /dev/sdb     /dev/sdb: x86 boot sector; partition 1: ID=0x7, active, starthead 32, startsector 2048, 3072000 sectors; partition 2: ID=0x7, starthead 89, startsector 3074048, 597489664 sectors; partition 3: ID=0x7, starthead 254, startsector 600563712, 24576000 sectors, code offset 0xe     $ sudo ntfsclone --save-image --output - /dev/sdb2     ntfsclone v2011.4.12AR.4 (libntfs-3g)     ERROR(22): Opening '/dev/sdb2' as NTFS failed: Invalid argument     Apparently device '/dev/sdb2' doesn't have a valid NTFS. Maybe you selected     the whole disk instead of a partition (e.g. /dev/hda, not /dev/hda1)?


title: How to mimic zsh named directories with bash

text: > **Possible Duplicate:**   >  bash directory shortcuts zsh has the concept of named directories, so you can say in ~/.zshrc               c=/home/fschmitt/svn/plugin_root     : ~c      and later use this short cut in the shell like this               cd ~c/release      How to best emulate this with bash? I can of course say               export c=/home/fschmitt/svn/plugin_root      and then               cd $c/release      however firstly, the $ is complicated to input on German keyboard layout and secondly, I fear binding a variable with just a single letter name might give problems with unwanted variable expansion.


title: Difference between --xz and --lzma in GNU tar?

text: As far as I can tell, XZ is a container that uses the LZMA2 algorithm (i.e. extended LZMA); but e.g.               $ xz foo/      complains about `foo/` being a directory. So presumably the correct way to preserve directories with XZ is with `tar`; then what is the difference between `tar --lzma` and `tar --xz`? (Note that I do explicitly want ownership and permissions preserved, which is why I'm not just using 7z.)


title: A real non-"better touch tools" solution for select-to-copy on Mac OS X

text: I recently moved to Mac. I am missing my X11 copy-paste style. I can't find a way to exactly emulate X11 behavior "select-to-copy", "middle-click-to-paste" **globally** on Mac OS X. I am aware that this issue has been around for a long time, yet I can't find any real killer solution. The best thing I found is in Can I copy by highlighting and paste by middle click on Mac OS X?. All suggested solutions try to find out a way to paste text from the clipboard with a middle click. Yet, nobody has a real solution for automatically copying the highlighted text. I am wondering if there can be a way to automate the copying of highlighted text. Even if I should write a daemon to do it. Any pointers on where to start thinking will be great.


title: Is it possible to preload glibc?

text: One of my client runs a glibc-2.7 based system , and my static linked program wasn't able to start on the target machine, raising an error: `_ZNSt7num_getlcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE, version GLIBCXX_3.4` So I'm wondering if I can use LD_PRELOAD and passing on the glibc on the develop machine? And if it's possible, what file should be copied there?


title: vi / vim - extra indents when pasting text?

text: I can copy characters in other apps such as browsers with `ctrl``c`. I can then press `i` to enter insert mode in vim and press `shift``ctrl``v` to paste the text in. The problem is that each line gets indented a bit more so I end up with: ![enter image description here](http://i.stack.imgur.com/Iq4LL.png) but what I want (and end up manually editing to achieve) is:![enter image description here](http://i.stack.imgur.com/9HzLn.png)


title: Disable apache's auto directory "/" completion

text: I'm in the following situation: I have a directory named `test` at the top level of my site. When I request `http://mysite.com/test`, apache automatically adds a trailing slash and gives me `http://mysite.com/test/`. Is there a way to disable that?


title: Why are the X11 colours different from Wikipedia's?

text: In this Wikipedia article it gives a bunch of X11 colours but they are different from the ones on my FreeBSD system. For example I have no "aqua" or "fuchsia" but, e.g. aquamarine1, etc. and many other numbered colours. Why is that?


title: Should a serious student of *nix choose a distribution that is POSIX-compliant to learn standard features well?

text: I want to learn Unix or Linux as a serious student, and specifically want to learn the basics well so that I can have proper understanding and so I can move between platforms and distributions without unlearning unusual habits. What should I be looking for in a standard distribution? Does it really matter? Many distributions seem to be POSIX-compliant - is that the most important consideration?


title: Bash variable into html

text: I have a script that gets the filenames in a folder and creates HTML link to them on my homepage. Here is the script:               #!/bin/bash       list_dir=`ls -t /path/to/dir/`     for i in $list_dir        do       echo `'<a href="/path/to/dir/$i">$i</a>' >> /var/www/index.html`        done      But when I check the `var/www/index.html` the code is submitted, but the variables have not been substituted. Any advice on how to fix this?


title: Remove string from a particular field using awk/sed

text: I have a file (>80,000 lines) that looks likes this:               chr1    GTF2GFF chromosome  1   249213345   .   .   .   ID=chr1;Name=chr1     chr1    GTF2GFF gene    11874   14408   .   +   .   ID=DDX11L1;Note=unknown;Name=DDX11L1     chr1    GTF2GFF exon    11874   12227   .   +   .   Parent=NR_046018_1     chr1    GTF2GFF exon    12613   12721   .   +   .   Parent=NR_046018_1     chr1    GTF2GFF exon    13221   14408   .   +   .   Parent=NR_046018_1     chr1    GTF2GFF gene    14362   29370   .   -   .   ID=WASH7P;Note=unknown;Name=WASH7P     chr1    GTF2GFF exon    14362   14829   .   -   .   Parent=NR_024540     chr1    GTF2GFF exon    14970   15038   .   -   .   Parent=NR_024540     chr1    GTF2GFF exon    15796   15947   .   -   .   Parent=NR_024540     chr1    GTF2GFF exon    16607   16765   .   -   .   Parent=NR_024540     chr1    GTF2GFF exon    16858   17055   .   -   .   Parent=NR_024540     chr1    GTF2GFF exon    17233   17368   .   -   .   Parent=NR_024540     chr1    GTF2GFF exon    17606   17742   .   -   .   Parent=NR_024540     chr1    GTF2GFF exon    17915   18061   .   -   .   Parent=NR_024540     chr1    GTF2GFF exon    18268   18366   .   -   .   Parent=NR_024540     chr1    GTF2GFF exon    24738   24891   .   -   .   Parent=NR_024540     chr1    GTF2GFF exon    29321   29370   .   -   .   Parent=NR_024540     chr1    GTF2GFF gene    34611   36081   .   -   .   ID=FAM138A;Note=unknown;Name=FAM138A     chr1    GTF2GFF exon    34611   35174   .   -   .   Parent=NR_026818     chr1    GTF2GFF exon    35277   35481   .   -   .   Parent=NR_026818      and I want to extract only the rows that that contain "gene" in the 3rd field and re-arrange the 9th field to contain only the ID value (for example, DDX11L1). This is the desired output:               chr1    11874   14408   DDX11L1    .       +     chr1    14362   29370   WASH7P      .       -     chr1    34611   36081   FAM138A    .       -      Using awk I got the desired fields easily:               head -20 genes.gff3 | awk '$3=="gene" {print $1 "\t" $4 "\t" $5 "\t" $9"\t" $6 "\t" $7}'     chr1    11874   14408   ID=DDX11L1;Note=unknown;Name=DDX11L1    .       +     chr1    14362   29370   ID=WASH7P;Note=unknown;Name=WASH7P      .       -     chr1    34611   36081   ID=FAM138A;Note=unknown;Name=FAM138A    .       -      But I am struggling with getting the ID value. I've tried piping it to sed:               head -20 genes.gff3 | awk '$3=="gene" {print $1 "\t" $4 "\t" $5 "\t" $9"\t" $6 "\t" $7}' | sed 's/\(^.+\t\)ID=\(\w+\).+\(\t.+$\)/\1\2\3/g'      and also gsub               head -20 genes.gff3 | awk '$3=="gene" {gsub(/\(^.+\t\)ID=\(\w+\).+\(\t.+$\)/, "\1\2\3", $9); print $1 "\t" $4 "\t" $5 "\t" $9"\t" $6 "\t" $7}'       But the result is same as using awk alone. How can I extract the ID value? I feel that I am really close to a solution here. Cheers.


title: How to compile a selection of Markdown documents using a shell script

text: Technical authors are increasingly being encouraged to write in standalone topics. Topics are written so that they make sense when compiled into different packages or when they are read in isolation. There are heavily-engineered structured formats for topic-based writing but I want to use Pandoc and Markdown. Processing a single Markdown file to HTML:               pandoc -f markdown -t html inputfile.md      Although I can use Pandoc like this to process individual Markdown files, I will need compile a list of selected Markdown files and process that to achieve a topic-based workflow. If I have some Markdown files:               inputfile1.md, inputfile2.md, inputfile3.md      what is a simple shell script that I can use that can compile them and process them using Pandoc to a single output file?


title: How can you change the process name of Wing IDE from python to something more descriptive

text: In my process list under Ubuntu (using `top`/`System Monitor`) one of the largest memory hogs (200+Mb) was `python`. I searched a bit for one of my programs to be the cause until I realised this was my Python IDE (Wing), which itself is written in Python. I thought I could change the name of the program by inserting setproctitle from the setproctitle package, but the python version that Wing is using is different from my own. `setproctitle` needs to be compiled and the python that wing uses is not a full installation (I asked Wing Support but they are unlikely to change that/incorporate setproctitle). `setproctitle` can only change the name of the running process, so I could not make a script that starts Wing and then change the process name either. After that I tried to write to /proc/PIDNUM/comm, but although that 'file' is 'rw', I am not allowed to write there. I finally found a, not-so-portable, solution for this particular case. But I would like to know if there is a standard way of changing the process name of another (possible a child-) process with a Linux system call.


title: Wifi module doesn't work anymore in CentOS

text: Like the title said, my wifi module doesn't work anymore. After a kernel upgrade. The wifi LED is permanently red. I can only use a wired connection. **EDITS** I add only the lscpi output because the others command result are too long.               00:00.0 Host bridge: Advanced Micro Devices [AMD] RS880 Host Bridge     00:01.0 PCI bridge: Advanced Micro Devices [AMD] RS780/RS880 PCI to PCI bridge (int gfx)     00:05.0 PCI bridge: Advanced Micro Devices [AMD] RS780/RS880 PCI to PCI bridge (PCIE port 1)     00:06.0 PCI bridge: Advanced Micro Devices [AMD] RS780 PCI to PCI bridge (PCIE port 2)     00:11.0 SATA controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode]     00:12.0 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB OHCI0 Controller     00:12.2 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB EHCI Controller     00:13.0 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB OHCI0 Controller     00:13.2 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB EHCI Controller     00:14.0 SMBus: Advanced Micro Devices [AMD] nee ATI SBx00 SMBus Controller (rev 41)     00:14.2 Audio device: Advanced Micro Devices [AMD] nee ATI SBx00 Azalia (Intel HDA) (rev 40)     00:14.3 ISA bridge: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 LPC host controller (rev 40)     00:14.4 PCI bridge: Advanced Micro Devices [AMD] nee ATI SBx00 PCI to PCI Bridge (rev 40)     00:14.5 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB OHCI2 Controller     00:16.0 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB OHCI0 Controller     00:16.2 USB controller: Advanced Micro Devices [AMD] nee ATI SB7x0/SB8x0/SB9x0 USB EHCI Controller     00:18.0 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor HyperTransport Configuration     00:18.1 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor Address Map     00:18.2 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor DRAM Controller     00:18.3 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor Miscellaneous Control     00:18.4 Host bridge: Advanced Micro Devices [AMD] Family 10h Processor Link Control     01:05.0 VGA compatible controller: Advanced Micro Devices [AMD] nee ATI RS880M [Mobility Radeon HD 4200 Series]     02:00.0 Network controller: Broadcom Corporation BCM4313 802.11b/g/n Wireless LAN Controller (rev 01)     03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E PCI Express Fast Ethernet controller (rev 02)


title: keybinding in xterm to shift one line up using shift+up

text: follow urxvt: scroll just one line How can we set keybindings so that shift+up can scroll one line up in xterm?


title: VPN and gateway problems

text: I've got a corporate VPN, which I use to access the Internet. When it's on, I cannot reach the servers inside the corporate network anymore, so I think there are some problems with the gateway setup. Here is the `netstat -rn` output when the VPN is turned off:               Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface     91.218.225.31   10.131.60.1     255.255.255.255 UGH       0 0          0 eth1_rename     10.131.60.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1_rename     169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth1_rename     0.0.0.0         10.131.60.1     0.0.0.0         UG        0 0          0 eth1_rename      Here it is with the VPN turned on:               Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface     10.7.4.0        0.0.0.0         255.255.255.255 UH        0 0          0 ppp0     91.218.225.31   10.131.60.1     255.255.255.255 UGH       0 0          0 eth1_rename     91.218.225.31   10.131.60.1     255.255.255.255 UGH       0 0          0 eth1_rename     10.131.60.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1_rename     169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth1_rename     0.0.0.0         0.0.0.0         0.0.0.0         U         0 0          0 ppp0      `ppp0` is the VPN device. How can I make both the Internet and LAN routing work when the VPN is enabled?


title: Apache redirecting when it shouldn't

text: I have inherited a LAMP server with a lot of customization. I want to enable mod_status in apache to get some monitoring of apache started. Problem is, with mod_status enabled in the httpd.conf, I am not allowed to travel to the http://"serverIP"/server-status URL because apache is redirecting me to a 'landing page'. If I type any invalid URL for the server, it redirects to this page, all error document pages have been hashed out from the httpd.conf. Any assistance to where this has may have been configured or if there is a way to override it so I can get to the url http://"serverIP"/server-status ?


title: VirtualBox host-only network suddenly stopped working , no interface available inside

text: I'm unable to setup host-only network in virtualbox suddenly , please see my screenshot , there's no entry in "Name" comboBox ![enter image description here](http://i.stack.imgur.com/wDruH.png)


title: vim always shows help/documentation

text: Whenever I run vim, it randomly shows the help/documentation at a non particular time. How do I disable that. It's irritating.


title: Why does chmod require disk space? Not-in-place algorithm?

text: I try to chmod some files and I get the error "disk quota exceeded": ![enter image description here](http://i.stack.imgur.com/Wb4Xx.png) It's true that I don't have that much space remaining in the filesystem where I use chmod, namely`nfs.mit.edu:/export/evodesign/beatdb` (which is an NFS), either in terms of bytes or in terms of inodes: ![enter image description here](http://i.stack.imgur.com/FreRR.png) But why does chmod need more space? I use Ubuntu 12.04. * * * Edit: Some more info following the comments: 1) I don't know the OS of the NFS server (`nmap -O nfs-server-ip` didn't return anything) 2) The NFS protocol in use by a mounted NFS filesystem is NFSv3: ![enter image description here](http://i.stack.imgur.com/RHLQu.png) 3) `quota -v`: ![enter image description here](http://i.stack.imgur.com/RGqOL.png) 4) I don't have any `/var/log/messages` logs, I do have some `/var/log/syslog` logs but nothing looks weird there.


title: Strange titles (and bookmarks) in chromium in xubuntu

text: Chromium browser in xubuntu doesn't show Persian titles. For example this site: www.farsnews.com Screenshot (just title): ![](https://dl.dropboxusercontent.com/u/12338367/strange-titles.png) How can I fix that? Edit: I noticed it happens in bookmarks too. Screenshot: ![](https://dl.dropboxusercontent.com/u/12338367/strange- titles2.png)


title: nginx server config with multiple locations does not work

text: I have been trying to get this to work for hours now! I would like to set up a simple web server. My web files shall be in `/var/www`. I also want to have phpmyadmin. I created a directory `/var/phpmyadmin`. Now I want to acces the normal web files in the standard way.   For instance: The file `/var/www/test.php` should be accesible with `http://localhost/test.php`.   The phpmyadmin part should be acces like this: `http://localhost/phpmyadmin`. With the config below I get a 404. Also with this URL: `http://localhost/phpmyadmin/index.php` For this I created this file in the sites-availble folder of nginx:               server {       listen 80; ## listen for ipv4; this line is default and implied       listen [::]:80 default_server ipv6only=on; ## listen for ipv6            root /var/www;       index index.html index.htm index.php;            try_files $uri $uri/ $uri/index.html $uri/index.htm $uri/index.php;            # This didn't work       location /phpmyadmin/ {          alias /var/phpmyadmin;       }            # And this did neither. (Never used both at the same time!)       location /phpmyadmin/ {          root /var;       }            location ~ \.php$ {         try_files $uri =404;         fastcgi_split_path_info ^(.+\.php)(/.+)$;         # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini              # With php5-cgi alone:         #fastcgi_pass 127.0.0.1:9000;         # With php5-fpm:         fastcgi_pass unix:/var/run/php5-fpm.sock;         fastcgi_index index.php;         include fastcgi_params;       }            location ~ /\.ht {         deny all;       }     }      What am I doing wrong? # Edit: Interesting to note is that this works (The root directory works (`http://localhost`)):                 root /var/www/htdocs;            index index.php index.html index.htm;            location /phpmyadmin/ {         root /var/www/phpmyadmin;       }      And this doesn't:                 index index.php index.html index.htm;            location / {         root /var/www/htdocs;       }            location /phpmyadmin/ {         root /var/www/phpmyadmin;       }      phpmyadmin still doesn't work!


title: kernel panic error after recompilation

text: I am completely blocked, but temporarily. I have an Ubuntu 11.10 in good condition, in this one I installed VirtuelBox. I installed on VirtuelBox as Ghest Debian Squeeze with Kernel 2.6.32-5-686. ja 'tried to recompile my kernel to erase all composont driver then I turned on the current configuration of the driver necessary for the operation of Ghest Debian. Steps for compiling and installing the kernel are: > >     root login >     # nano /etc/apt/sources.list >     # apt-get update >     # apt-get install debconf-utils debhelper dpkg-dev build-essential > kernel-package libncurses5-dev >     # uname-r >     2.6.32-5-686 >     # wget > http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.32.5.tar.bz2 >     # tar xvjf linux-2.6.32.5.tar.bz2 >     # mv linux-2.6.32.5/ /usr/src/ >     # cd /usr/src/linux-2.6.32.5/ >     # cp /boot/config-2.6.32-5-686. config >     ### make allnoconfig## >     # make menuconfig >     we selected the penultimate year Load Alternate Configuration File >     you exit the menu while watching >     # make-kpkg - append-to-version "-tango" - initrd buildpackage-us-uc >     the image is now in /usr/src/ >     # dpkg-i linux-image-2.6.32.5-tango-tango-2.6.32.5-10.00Custom_i386.deb >   > > an error when starting the first line from Grub kernel panic not syncing vfs > Unable to mount root fs on unknown-block 0 0 > ![GRUB](http://i.stack.imgur.com/Trh2H.png) ![ERROR](http://i.stack.imgur.com/3oGgO.png) ![after recompilation](http://i.stack.imgur.com/BUcR7.png) lsmod Module Size Used by ppdev 4058 0 lp 5570 0 binfmt_misc 4907 1 fuse 44268 1 loop 9769 0 snd_intel8x0 19595 1 snd_ac97_codec 79200 1 snd_intel8x0 ac97_bus 710 1 snd_ac97_codec snd_pcm 47226 2 snd_intel8x0,snd_ac97_codec snd_seq 35463 0 snd_timer 12270 2 snd_pcm,snd_seq snd_seq_device 3673 1 snd_seq parport_pc 15799 0 parport 22554 3 ppdev,lp,parport_pc snd 34423 8 snd_intel8x0,snd_ac97_codec,snd_pcm,snd_seq,snd_timer,snd_seq_device psmouse 44809 0 pcspkr 1207 0 serio_raw 2916 0 ac 1640 0 joydev 6739 0 evdev 5609 8 i2c_piix4 7076 0 button 3598 0 i2c_core 12787 1 i2c_piix4 soundcore 3450 1 snd snd_page_alloc 5045 2 snd_intel8x0,snd_pcm ext3 94396 5 jbd 32317 1 ext3 mbcache 3762 1 ext3 usbhid 28008 0 hid 50909 1 usbhid sg 19937 0 sr_mod 10770 0 cdrom 26487 1 sr_mod sd_mod 26005 7 crc_t10dif 1012 1 sd_mod ata_generic 2247 0 ohci_hcd 16999 0 ata_piix 17736 0 ahci 27410 6 ehci_hcd 28693 0 thermal 9206 0 libata 115869 3 ata_generic,ata_piix,ahci thermal_sys 9378 1 thermal usbcore 98969 4 usbhid,ohci_hcd,ehci_hcd nls_base 4541 1 usbcore scsi_mod 104853 4 sg,sr_mod,sd_mod,libata e1000 77317 0 root@debian:/boot# root@debian:/boot# lspci 00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02) 00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II] 00:01.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01) 00:02.0 VGA compatible controller: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter 00:03.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02) 00:04.0 System peripheral: InnoTek Systemberatung GmbH VirtualBox Guest Service 00:05.0 Multimedia audio controller: Intel Corporation 82801AA AC'97 Audio Controller (rev 01) 00:06.0 USB Controller: Apple Computer Inc. KeyLargo/Intrepid USB 00:07.0 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08) 00:0b.0 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB2 EHCI Controller 00:0d.0 SATA controller: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) SATA AHCI Controller (rev 02) root@debian:/boot# root@debian:/boot# lscpu Architecture: i686 CPU(s): 1 Thread(s) per core: 1 Core(s) per socket: 1 CPU socket(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 15 Stepping: 13 CPU MHz: 1983.975 root@debian:/boot# the file .config is in the link: .config Help me please


title: extracting attachments from mail that is coming to my postfix inbox

text: How do I extract attachments from mails arriving at my postfix mailbox and preferably send the content of the attachment to another email account? I am interested in being able to acquire/read the content of the attachment on ubuntu terminal.


title: How to detect and stop user from deleting particular file on Linux?

text: Is it possible to monitor user actions on the file system and prevent him from performing particular actions? Can inotify only monitor actions on the file system? What about fanotify? There's very little about it in Web... My program (daemon) sends particular files over network. I want to make sure, that user will not delete or move my file however he cloud be able to read it. When user tries to delete my file with any program calling eg. unlink() I want to make this unlink() call will fail with some error (EACCES?). I can do similar trick implementing file system on FUSE, but it's not a solution here...


title: How to check mdadm raids while running?

text: I'm starting to get a collection of computers at home and to support them I have my "server" linux box running a raid array. Its currently mdadm raid1, going to raid5 once I have more drives (and then raid6 I'm hoping for). However I've heard various stories about data getting corrupted on one drive and you never noticing due to the other drive being used, up until the point when the first drive fails, and you find your second drive is also screwed (and 3rd, 4th, 5th drive). Obviously backups are important and I'm taking care of that also, however I know I've previously seen scripts which claim to help against this problem and allow you to check your raid while its running. However looking for these scripts again now I'm finding it hard to find anything which seems simular to what I ran before and I feel I'm out of date and not understanding whatever has changed. How would you check a running raid to make sure all disks are still preforming normally? I monitor SMART on all the drives and also have mdadm set to email me in case of failure but I'd like to know my drives occasionally "check" themselves too. Thanks in Advance.


title: Installing to a PCIE sata card

text: I have an ASUS P5Q deluxe from an old gaming computer that I'm converting to a server. Unfortunately, while their silly onboard fake RAID thing(drive xpert) worked fine in Windows, the drives are not being detected at all when I attempt to install openSUSE to them. I've tried disabling it and setting it to "normal" but still no luck. The other SATA ports are detected without issue, but they're for my storage drives. Eventually I decided the better option might be a pcie SATA card, but I'm not positive it will solve my problem: Will I be able to install to drives attached through a PCIE card? If so is there a specific card anybody could recommend?


title: Which is better for product level web server: RHEL/Ubuntu Server/Debian/CentOS

text: We are planning to setup a linux based web hosting solution, which should include an HTTP server, SMTP server, mongoDB and Java. We want to understand which distribution is better for this purpose. We very care about:   1. Security including antivirus, patch policy etc   2. Performance   3. Stability   4. Commercial support Thanks, Green


title: How should I solicit feedback from a tree maintainer for patches sent to the lkml?

text: I have submitted a patch to the linux kernel that has gotten several reviews and gone through a couple iterations on the mailing list. It has been ACKed and reviewed by two developers, but they say it is up to a specific developer to approve the patch. This developer is relatively absent from the mailing list. I do not want to harass him personally, but I would like some sort of acknowledgement that the patch can or cannot be accepted. What is the best way to solicit feedback from this developer? Is it acceptable to send a private email to him or to one of the reviewers or is it important for all communication to be public through the mailing lists?


title: lost superblock in md raid

text: Issue on Red Hat Linux 5. Due to some miscommunication two LUNs in our environment were enlarged from 1.2 TB to 1.7 TB. Now, after a reboot, mdadm does not find the superblocks to build the array again. > The common format — known as version 0.90 — has a superblock that is 4K long > and is written into a 64K aligned block that starts at least 64K and less > than 128K from the end of the device (i.e. to get the address of the > superblock round the size of the device down to a multiple of 64K and then > subtract 64K). I found some old documentation:               # mdadm -D /dev/md0     /dev/md0:             Version : 0.90       Creation Time : Tue Jul 10 17:45:00 2012          Raid Level : raid1          Array Size : 1289748416 (1230.00 GiB 1320.70 GB)       Used Dev Size : 1289748416 (1230.00 GiB 1320.70 GB)        Raid Devices : 2       Total Devices : 2     Preferred Minor : 0         Persistence : Superblock is persistent              Update Time : Wed Apr 17 15:03:50 2013              State : active     Active Devices : 2     Working Devices : 2     Failed Devices : 0       Spare Devices : 0                     UUID : 2799bd51:67eb54d2:1fcd3c90:293311a1              Events : 0.39              Number   Major   Minor   RaidDevice State            0     253       10        0      active sync   /dev/dm-10            1     253       11        1      active sync   /dev/dm-11          # fdisk -l /dev/dm-10 /dev/dm-11          Disk /dev/dm-10: 1320.7 GB, 1320702443520 bytes     255 heads, 63 sectors/track, 160566 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes          Disk /dev/dm-10 doesn't contain a valid partition table          Disk /dev/dm-11: 1320.7 GB, 1320702443520 bytes     255 heads, 63 sectors/track, 160566 cylinders     Units = cylinders of 16065 * 512 = 8225280 bytes          Disk /dev/dm-11 doesn't contain a valid partition table


title: Route outgoing traffic to different gateway based on port

text: I am trying to get around my Usenet download bandwidth restrictions based on IP. I currently have two IPs from my ISP to double the download speed. So far I have it working and getting double speed from one server that has multiple access addresses, by using this command to get a second stream going with the first on eth0. sudo route add -host xx.xx.xxx.20 gw 192.168.2.1 dev wlan0 My problem is another service I want to do the same only has one address but multiple port choices. So how can I send any data to a different gateway based on the port. Default example.com:80 should use the 192.168.1.1 gateway on eth0 (which it does since this is the default gateway) Whereas example.com:81 should use the 192.168.2.1 gateway on wlan0


title: Debian: Mounting NFS Volume at boot with fstab not working, How to change when this is attempted on boot

text: So there are a bunch of NICs and vlans on the server and after adding the last ones the auto mount of a network volume is not working. I can do it all right if i SSH in and use `mount` however it doesnt happen with `fstab`. What I'm speculating is the interfaces that are needed to reach the networked storage come up too late, I have no experience with the startup so I have only a few bits of debug you show such as               # chkconfig --list     networking                0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on      nfs-common                0:off  1:off  2:on   3:on   4:on   5:on   6:off  S:on       (thats among others, do ask if you need to see other entries, I don't actually know what would be needed) How can I make the nfs mounting be done at a later point, this above suggests to me that perhaps the nfs stuff happen too early?               # ls -lh /etc/rc5.d/     total 4.0K     -rw-r--r-- 1 root root 677 Mar 27  2012 README     lrwxrwxrwx 1 root root  17 Apr 10 13:46 S14portmap -> ../init.d/portmap     lrwxrwxrwx 1 root root  20 Apr 10 13:46 S15nfs-common -> ../init.d/nfs-common     lrwxrwxrwx 1 root root  20 Apr 11 11:19 S17fancontrol -> ../init.d/fancontrol     lrwxrwxrwx 1 root root  17 Apr 10 13:46 S17rsyslog -> ../init.d/rsyslog     lrwxrwxrwx 1 root root  14 Apr 10 15:59 S17sudo -> ../init.d/sudo     lrwxrwxrwx 1 root root  17 Apr 11 11:18 S18apache2 -> ../init.d/apache2     lrwxrwxrwx 1 root root  15 Apr 11 11:18 S19acpid -> ../init.d/acpid     lrwxrwxrwx 1 root root  13 Apr 11 11:18 S19atd -> ../init.d/atd     lrwxrwxrwx 1 root root  14 Apr 11 11:18 S19cron -> ../init.d/cron     lrwxrwxrwx 1 root root  15 Apr 11 11:18 S19exim4 -> ../init.d/exim4     lrwxrwxrwx 1 root root  21 Apr 11 11:18 S19mpt-statusd -> ../init.d/mpt-statusd     lrwxrwxrwx 1 root root  17 Apr 11 11:18 S19nagios3 -> ../init.d/nagios3     lrwxrwxrwx 1 root root  17 Apr 11 20:49 S19postfix -> ../init.d/postfix     lrwxrwxrwx 1 root root  15 Apr 12 19:15 S19rsync -> ../init.d/rsync     lrwxrwxrwx 1 root root  13 Apr 11 11:18 S19ssh -> ../init.d/ssh     lrwxrwxrwx 1 root root  18 Apr 11 11:18 S21bootlogs -> ../init.d/bootlogs     lrwxrwxrwx 1 root root  18 Apr 11 11:18 S22rc.local -> ../init.d/rc.local     lrwxrwxrwx 1 root root  19 Apr 11 11:18 S22rmnologin -> ../init.d/rmnologin     lrwxrwxrwx 1 root root  23 Apr 11 11:18 S22stop-bootlogd -> ../init.d/stop-bootlogd      How can I delay or change the order of events so that it'd mount with `fstab`, what to look for anyway?


title: Ruby Version Prompt (Oh My ZSH) not working outside of TMUX

text: I am working on some Ruby development, and I installed RVM on my Mac. I regularly use TMUX. I have Oh My ZSH configured to show the Ruby version in my prompt. When I am in TMUX it shows my ruby version in the prompt. When i'm out of TMUX it doesn't show the version. Also, when I enter ZSH again (type `zsh` after i'm in my terminal) the ruby version does show. It does NOT show upon initial login.   * ZSH Version: 5.0.2


title: How can I install Sun JDK on a Debian based system?

text: I can't find any `.deb` packages for Sun's Java Development Kit. How can I install it on my Debian machine without causing conflicts with the already installed `openjdk` packages?


title: Is there any ftp command to resume upload?

text: Oh! with my slow net connection, I am badly stuck. I was uploading a video file from local box to remote one via ftp. But net failed.I know there is a command named reget to resume download but Is there any command to resume upload.? If no then I am hit.


title: Cross LFS - PPC - Error while compiling

text: I'm trying to build a CLFS for a PPC 8270 processor. All is fine until I use the `make ARCH=powerpc CROSS_COMPILE=${CLFS_TARGET}-` command.               CC      arch/powerpc/kernel/align.o     arch/powerpc/kernel/align.c: In function 'fix_alignment':     arch/powerpc/kernel/align.c:704:33: error: variable 'instruction' set but not used [-Werror=unused-but-set-variable]     cc1: all warnings being treated as errors          make[1]: *** [arch/powerpc/kernel/align.o] Error 1     make: *** [arch/powerpc/kernel] Error 2      In `menuconfig`, I used the default configuration except I choose compatibily with PPC 82XX processor family.


title: Why sudo timestamp is not updated when NOPASSWD is set?

text: I've set up sudo not to prompt for password by editing the sudoers file:               myuser ALL=(ALL:ALL) NOPASSWD: ALL      And it works fine, running sudo with no password prompting. But when entering `sudo -v` I noticed that it prompted for password, only once. I know what `sudo -v` does, from the manual: > If given the -v (validate) option, sudo will update the user's time stamp, > prompting for the user's password if necessary. This extends the sudo > timeout for another 15 minutes (or whatever the timeout is set to in > sudoers) but does not run a command. And I know I don't need to use it anyway (or am I wrong?). The question is, why `sudo -v` prompted for password when sudo is configured not to ask that user from password? And especially when `sudo -v` is run afterwards another sudo command: why the timestamp isn't updated unless `sudo -v` is run exiplicitly? My machine is running Ubuntu Server 11.10 if that mattered. EDIT: running `sudo sudo -v` requires no password, but doesn't seem to update the timestamp because when immediately followed by `sudo -v`, it prompts for password again. What is the mechanism used in updating sudo timestamp? Why the timestamp is not updated when running any sudo command and then running `sudo -v` ??


title: FTP server - directories

text: I have been playing around with several ftp servers and can't get the configuration I want. I want to allow both anonymous and standard user login, user logins are fine with the default pure-ftpd config (users can get to their home directories), but I'd like anonymous users to have read only access to a subdirectory of my users home directory (~/web/ftp). Is there anyway to do this with pure-ftpd, or is there an alternative that could?


title: Egrep: contains and does not contain

text: egrep -i '12-12.*\swarning' log.file | cless      The above will produce two lines with the date `12-12`, followed by random characters, a white space, then `Warning` and more text.               2011-12-12 textetc Warning 1234     2011-12-12 textetc Warning 5678      I wish it only to return lines that DO NOT contain 1234 at the end. I'm using GNU grep 2.5.4. Currently, this is my workaround.               egrep -i '12-12.*\swarning' log.file > tmp.txt     egrep -i -v '1234' tmp.txt      I've tried piping the first to the second (without creating a file), but it either returns way too much, and it's all wrong, or it returns nothing at all.


title: filesystem image mounted with lofiadm looks smaller than expected

text: I have a .gz file and I'd like to see the content of it. I used lofiadm to mount it.               lofiadm /backup/file.gz ->>  returned /dev/lofi/1     mount -F ufs /dev/lofi/1 /mnt      Then I checked the content               /mnt> du -sh *     4K   etc     79M   kernel     8K   lost+found     13M   platform      The problem is size of file.gz was around 342 MB but the content is around 93 MB. I checked it with `ls -al` but there were no other file.               /dev/lofi/1            321M    93M   196M    33%    /mnt      Now I don't understand how that happens. File size was 342 MB but after mount it returns 92 MB


title: Where is the official udev source and other dev information?

text: I'm trying to find a changelog or commit history for `udevd`, but I can't seem to find the official source. Where is that?


title: Can use Password authentication with SFTP even though "PasswordAuthentication no" in /etc/ssh/sshd_config

text: I have enabled SSH-keys based authentication on the Ubuntu 14.04 server, disabled root login using SSH and can connect successfully using SSH-keys based authentication with my user account _blahblah_ on my Mac SSH client. However, to test the SSH login with Password authentication, I used the SFTP login in Filezilla for user account _blahblah_ with its password, and it allowed me to log in without the need for any SSH-keys based authentication. The `/etc/ssh/sshd_config` file is as below. As you can see, I have disabled `PasswordAuthentication`. I have already restarted the sshd daemon by using `sudo service ssh restart` after modifying this config file. Any ideas why this might be happening?               Port 8888     Protocol 2     HostKey /etc/ssh/ssh_host_rsa_key     HostKey /etc/ssh/ssh_host_dsa_key     HostKey /etc/ssh/ssh_host_ecdsa_key     HostKey /etc/ssh/ssh_host_ed25519_key     UsePrivilegeSeparation yes          KeyRegenerationInterval 3600     ServerKeyBits 1024          SyslogFacility AUTH     LogLevel INFO          LoginGraceTime 120     PermitRootLogin no     StrictModes yes          RSAAuthentication yes     PubkeyAuthentication yes          IgnoreRhosts yes     RhostsRSAAuthentication no     HostbasedAuthentication no          PermitEmptyPasswords no          ChallengeResponseAuthentication no          PasswordAuthentication no               X11Forwarding yes     X11DisplayOffset 10     PrintMotd no     PrintLastLog yes     TCPKeepAlive yes          AcceptEnv LANG LC_*          Subsystem sftp /usr/lib/openssh/sftp-server          UsePAM no     AllowUsers blahblah


title: Issue with mv command in a script

text: This must be a very simple issue to solve, but I am stuck (not a UNIX pro). I need to move a gz to a target directory, but I get a `No such file or directory`.               NOW=$(date +"%Y-%m-%d-%T")          DEST="~/scripts/backup"     SQL_DUMP="db_dump_$NOW.sql.gz"     echo "$SQL_DUMP"          drush sql-dump | gzip -9 > $SQL_DUMP     mv -t $DEST $SQL_DUMP      The `sql.gz` is created properly, only the last command does not work. How should I use it? Thanks.


title: How can I pass strings with single quotes to grep?

text: My desired outcome is the following: to recursively search a directory looking for a given string in all found files. The following command is my usual port of call:               find ./ | xargs grep -ns 'foobar'      However, when `foobar` has quotes the command fails and gives me a `>` prompt in the shell. The specific command that's causing the problem is as follows:               find ./ | xargs grep -ns 'add_action(\'save_post\','      I've tried to escape the quotes with backslashes but to no avail. What's the correct way to do this?


title: Permissions changed on /dev/nvidia* when GPU accessed as root on SUSE

text: I've got a Linux box running SLES11SP1 with 4 NVIDIA GPUs in it, for running CUDA programs. If the GPU is accessed by a process running as root, it changes the permissions on /dev/nvidia{0,1,2,3,ctl} to something inaccessible by non-root users. However, this behavior doesn't seem to occur when running on Ubuntu. Does anybody know what would cause this behavior on SLES, and how to disable it?


title: Create sub-directories and organize files by date

text: I have some directories of files copied from my security camera that I would like to organize into sub-directories by file date. So for example;               -rwxrwxrwx 0 root root 4935241 Jul 19  2012 DSCN1406.JPG     -rwxrwxrwx 0 root root 4232069 Jul 19  2012 DSCN1407.JPG     -rwxrwxrwx 0 root root 5015956 Jul 20  2012 DSCN1408.JPG     -rwxrwxrwx 0 root root 5254877 Jul 21  2012 DSCN1409.JPG      I would like a script that runs to see the files in that directory, then create the 3 needed directories named like;               drwxrwxrwx 1 root root     0 Sep  2 16:49 07-19-2012     drwxrwxrwx 1 root root     0 Sep  2 16:49 07-20-2012     drwxrwxrwx 1 root root     0 Sep  2 16:49 07-21-2012      And then move the files into the appropriate directories. Does anyone have any suggestions on a good scriptable way to accomplish this?


title: swap partition and its laws

text: I remember for choice of swap partition, we should use (swap > 2xRAM) at least.Of course it deprecated , because max of computer's ram is very high. kernel support it. **My question:** i remember each partition of swap just support 2G maximum, it means if you have 2G ram you should create 2 partition of 2G swap. _Did kernel solve it ? it mean can i create 4G swap for one partition?_


title: Get contact information of system administrator from the terminal

text: Do any of the common Unix/Linux platforms provide a way to query the system administrator contact information from the command line. Obviously a system admin might not include this information when they set up the server, but is there a way to ask for it when it is there (e.g., name or email)?


title: Internet connection help

text: So I just installed Elementary OS, and everything works perfect except for internet, I can't connect to the internet whatsoever, I cant tether through my phone, cant use ethernet, and don't even get wifi networks. I have a Toshiba S855D-00U with a Realtek RTL8188CE. I'm having trouble making work. How can I make it work on Elementary (Ubuntu 12.04)? Any help would be extremely appreciated, I'm totally new to Linux, so the simpler the response, the better.


title: What linux server settings allow my long running processes to keep running after the terminal is closed/terminated?

text: In previous jobs and experiences, I used screen or nohup to run my long running jobs from my terminal screen. Most, if not all of my previous jobs' servers dropped you if it didn't detect any activity after X amount of time. Even if I had set ServerKeepAlive and other settings in my .ssh/config file, in some cases I still got booted, probably because the server ignored my settings. I used nohup once or twice but I mainly use screen to keep my process running. Yesterday, I forgot to run my command with screen or nohup. I got booted off and I thought I was hosed. However, for some reason, the process was still running, even after several hours. I typed in `ps -ef | grep myprocname` and it was there until it was completed. I didn't run my process in the background (not sure if that makes a difference). I just type in `./script.sh` and let it run. What setting on the server allowed this fortuitous event to occur? I think the remote server is running Centos 6.4. Is this a Centos 6.4 thing, to not terminate processes when the parent process (in this case my shell) is killed? Do I need to go back to reading a Unix/Linux book since this is an easy question? Do I have my basic Unix facts wrong (about the parent process)? Did I get lucky?


title: Editing the .profile file to access

text: I am trying to source my .profile file to easily access a directory of javatools. The bash code below seems like it should work but it does not. Any help troubleshooting this script would be very much appreciated:               PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/     PATH=$PATH:~/bin          javatools() {         if [ $# -eq 0 ]         then             echo $'\nComplete list of tools:'             ls /Users/username/tools/javatools/         else             local toolToRun=/Users/username/tools/javatools/$1             java -Xmx4g -jar $toolToRun ${@:2}         fi     }      When I source the .profile file I receive the error:               syntax error near unexpected token `{'bash: /fise $# java -Xmx4g -jar $toolToRun ${@:2}gs/javatools/$1      Wihout the javatools section the PATH lines work without issue.


title: Faster awk script to get the substring / string we wanted

text: ORDER EVENT .........[] [] ... so many other tags... [Account<25106>=ACCT1] [Destination...] .. so many other tags.      I am currently trying to get the account like this. I tried using match in awk, but it seems slower. Can you suggest anything else other than the one below which is even faster?               j = index($0, "<25106>=");     account=substr($0, j + accountTagLength);     account=substr(account,1,index(account, "]") - 1);      Account is not 2nd field and the field position my vary.. Timings:               bash-3.2$ time head -1000000 temp.log | awk -F'<25106>=' '{print $2}' | sed -e 's/].*//' > /dev/null          real    0m2.410s     user    0m2.782s     sys     0m0.319s     bash-3.2$ time head -1000000 temp.log | awk '{j = index($0, "25106>="); if (j > 0) { account=substr($0, j + 7); substr(account,1,index(account, "]") - 1);} }'          real    0m1.690s     user    0m1.737s     sys     0m0.448s     bash-3.2$ time head -1000000 temp.log | awk '{j = index($0, "25106>="); if (j > 0) { account=substr($0, j + 7); substr(account,1,index(account, "]") - 1);} }'          real    0m1.588s     user    0m1.733s     sys     0m0.179s     bash-3.2$ time head -1000000 temp.log | awk -F'<25106>=' '{print $2}' | sed -e 's/].*//' > /dev/null                                    real    0m2.384s     user    0m2.762s     sys     0m0.272s     bash-3.2$ time head -1000000 temp.log | awk '{j = index($0, "25106>="); if (j > 0) { account=substr($0, j + 7); substr(account,1,index(account, "]") - 1);} }'          real    0m1.703s     user    0m1.709s     sys     0m0.484s          bash-3.2$ time head -1000000 dumper/cam_verbose.20120220.000.log | gawk 'match($0, /<25106>=([^]]+)/, ary) {account = ary[1]}'          real    0m3.449s     user    0m3.661s     sys     0m0.290s     bash-3.2$ time head -1000000 dumper/cam_verbose.20120220.000.log | gawk 'match($0, /<25106>=([^]]+)/, ary) {account = ary[1]}'          real    0m3.410s     user    0m3.551s     sys     0m0.236s     bash-3.2$ time head -1000000 dumper/cam_verbose.20120220.000.log | gawk 'match($0, /<25106>=([^]]+)/, ary) {account = ary[1]}'          real    0m3.361s     user    0m3.487s     sys     0m0.286s     bash-3.2$ time head -1000000 dumper/cam_verbose.20120220.000.log | awk '{j = index($0, "25106>="); if (j > 0) { account=substr($0, j + 7); substr(account,1,index(account, "]") - 1);} }'          real    0m1.626s     user    0m1.831s     sys     0m0.263s     bash-3.2$ time head -1000000 dumper/cam_verbose.20120220.000.log | awk -F '<25106>=' '{split($2, ary, /\]/); account = ary[1]}'          real    0m2.721s     user    0m2.808s     sys     0m0.265s     bash-3.2$ time head -1000000 dumper/cam_verbose.20120220.000.log | awk -F '<25106>=' '{split($2, ary, /\]/); account = ary[1]}'          real    0m2.787s     user    0m2.863s     sys     0m0.516s     bash-3.2$ time head -1000000 dumper/cam_verbose.20120220.000.log | awk -F '<25106>=' '{split($2, ary, /\]/); account = ary[1]}'          real    0m2.724s     user    0m2.882s     sys     0m0.278s     bash-3.2$ time head -1000000 dumper/cam_verbose.20120220.000.log | awk '{j = index($0, "25106>="); if (j > 0) { account=substr($0, j + 7); substr(account,1,index(account, "]") - 1);} }'          real    0m1.576s     user    0m1.748s     sys     0m0.235s          bash-3.2$ time head -100000 ORDER_EVENTS_CHAS_20120224.log | grep -oE '<25106>=([A-Za-z0-9]*)+' | cut -d= -f2 > /dev/null                                          real    0m2.098s     user    0m2.131s     sys     0m0.033s     bash-3.2$ time head -100000 ORDER_EVENTS_CHAS_20120224.log | awk '{j = index($0, "25106>="); if (j > 0) { account=substr($0, j + 7); print substr(account,1,index(account, "]") - 1);} }' > /dev/null          real    0m0.253s     user    0m0.275s     sys     0m0.040s     bash-3.2$ time head -100000 ORDER_EVENTS_CHAS_20120224.log | grep -oE '<25106>=([A-Za-z0-9]*)+' | cut -d= -f2 > /dev/null                                          real    0m2.070s     user    0m2.105s     sys     0m0.034s     bash-3.2$ time head -100000 ORDER_EVENTS_CHAS_20120224.log | grep -oE '<25106>=([A-Za-z0-9]*)+' > /dev/null          real    0m2.065s     user    0m2.090s     sys     0m0.037s         bash-3.2$ time head -1000000 ORDER_EVENTS_CHAS_20120228.log | awk -F'<25106>=' '{ substr($2,0,index($2,"]")-1);}'          real    0m3.426s     user    0m3.637s     sys     0m0.412s     bash-3.2$ time head -1000000 ORDER_EVENTS_CHAS_20120228.log | awk -F'<25106>=' '{ substr($2,0,index($2,"]")-1);}'          real    0m3.463s     user    0m3.603s     sys     0m0.408s     bash-3.2$ time head -1000000 ORDER_EVENTS_CHAS_20120228.log | awk '{j = index($0, "25106>="); if (j > 0) { account=substr($0, j + 7); substr(account,1,index(account, "]") - 1);} }'          real    0m2.247s     user    0m2.307s     sys     0m0.649s


title: Gzip decompress on file with other extension?

text: Is it possible to use `gzip` to decompress a gzipped file, without the gz extension, and without moving the file?


title: Allow non-root process to access all home directories without compromising security?

text: Any ideas how to allow one non-root process to access (read&write) all home directories without compromising security? Normal users should not have access to each other's home directories. All ideas are welcome, even crazy ones (nfs&kerberos setups?) :) I basically need to create web interface for user home directories, where the non-root process is the web server process. New files should have the home directory user as the owner. Is this even possible?


title: Can't boot FreeBSD after installation

text: I've installed FreeBSD on my system along with Windows 7 using this tutorial. When I turn on my PC the screen says something like this:               F1  FreeBSD     F2  Win     F3  ?          F6 PXE     Boot: F1 _      Pressing `F2` successfully boots my Windows 7. But when I press `F1` nothing happens, it just types out a `#` on the screen. Why is this happening? And how can I boot FreeBSD?


title: Use sed to fix broken newlines

text: I have a folder full of files, each with many hundreds of lines. Many of these files have occasional broken newlines: when I open them in vim, many have ^M^L interspersed where newlines should be. In vim, I can run `%s/^M^L/\r/g` which will correct them. However, I don't want to have to do this to every file. So I'm trying to do this in a bash script via sed, but it hasn't worked. I've tried both: `sed 's/^M^L/\r/g' filename` and               sed 's/^M^L/\     /g' filename      Note: each time ^M^L appears here, I have done ctrl-v ctrl-m, not just shift-6 (^) M. What am I doing wrong? More to the point, what do I need to do for this to work?


title: Resize vdi size doesn't work as supposed

text: I just installed the new one Debian xfce via VirtualBox, but decided to increase the vdi size from 8GB to 20GB (because it requires 42% of all disk space at this moment): > VBoxManage.exe modifyhd debian.vdi --resize 20000 VirtualBox Manager tells me that debian.vdi now has 20GB as supposed, but when I started Debian, the df output tells me that it has 8GB as earlier. Why?


title: Virtualbox: OS cannot use the new extended disk space (.vdi)

text: I am running Virtualbox. I increased the size of my hard disk (.vdi) from 10G to 15G. Now when I start my Mint vm, the hard disk reports as 7.5g (df) even though i extended it (fdisk -l). I am not sure what is the problem. Can anyone point me the problem?               $ df -h     Filesystem      Size  Used Avail Use% Mounted on     /dev/sda1     >>7.5G<< 7.1G   61M 100% /     udev            1.5G  4.0K  1.5G   1% /dev     tmpfs           581M  888K  581M   1% /run     none            5.0M     0  5.0M   0% /run/lock     none            1.5G   88K  1.5G   1% /run/shm          $ sudo fdisk -l     Disk /dev/sda: >>16.1 GB<<, 16106127360 bytes     255 heads, 63 sectors/track, 1958 cylinders, total 31457280 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: 0x000c55a4             Device Boot      Start         End      Blocks   Id  System     /dev/sda1   *        2048    15728639     7863296   83  Linux     /dev/sda2        15730686    16775167      522241    5  Extended     /dev/sda5        15730688    16775167      522240   82  Linux swap / Solaris          $ vboxmanage showhdinfo mint.vdi     UUID:                 a94931b9-673c-440a-ab6b-2c3eedd0cf93     Accessible:           yes     Logical size:         15360 MBytes     Current size on disk: 7806 MBytes     Type:                 normal (base)     Storage format:       VDI     Format variant:       dynamic default     Location:             /opt/virtualization/vm/mint.vdi


title: Using kernel cryptographic functions

text: Is it possible to use kernel cryptographic functions in the userspace? Let's say, I don't have `md5sum` binary installed on my system, but my kernel has `md5sum` support. Can I use the kernel function from userspace? How would I do it? Another scenario would be, if I don't trust the `md5sum` binary on my system (my system could have been compromised), but I trust my kernel (I am using cryptographically signed kernel modules).


title: How to make a directory public and private in a single bucket

text: I am using amazon S3 bucket to store my data in two different directories in single bucket, I want that my one directory should be globally accessible and another directory should be private. Is there any policy which I can use ?


title: Why must you be careful when using Bash's built in command history function to re-run previous commands that contain variables?

text: I know `!!` re-runs commands but what exactly would occur if I re-ran a command that had a variable in the command?


title: Force VPN using IPtables?

text: I want to force the use of VPN using iptables, therefore while VPN is disabled no outgoing traffic shall be allowed (except maybe some DHCP stuff...). Now i guess I could just block everything not going to the address of the VPN server? But then I still want to do another thing: I don't want to allow all traffic for some application, e.g. some shall have no internet access, some shall have only access to specific IP addresses. Is something like "application level" possible using iptables? Does iptables recognize, from which application traffic originates? And I guess when using VPN I can't filter for the real destination that comes behind the vpn server as it is probably encrypted in the vpn packets?


title: How to install synergy on RHEL5?

text: I'm trying to build from source using CMake as recommended (http://synergy- foss.org/pm/projects/synergy/wiki/Compiling)               [d3p299@we16410 synergy-1.3.7-Source]$ ./hm.py build     Running setup...     Error: Generator not specified, use -g arg (use `hm genlist` for a list of generators).      So I lsit the generators:               [d3p299@we16410 synergy-1.3.7-Source]$ ./hm.sh genlist     1: Unix Makefiles     2: Eclipse CDT4 - Unix Makefiles      Ok I need index 1, so I try:               [d3p299@we16410 synergy-1.3.7-Source]$ ./hm.py build -g 1      Error: option -g not recognized      Maybe the syntax of the command is wrong?               [d3p299@we16410 synergy-1.3.7-Source]$ ./hm.py usage     Usage: ./hm.py <command> [-g <index>|-v|--no-prompts|<command-options>]     Example: ./hm.py build -g 3      I am running the command correctly as suggested in the help command. What gives?


title: Where are NetworkManager's WiFi settings stored?

text: I remember the days of playing with /etc/$WE/wpa_supplicant.conf to try and force a semi-secure network on a debian based system, but now on to xubuntu, I haven't needed to do any *.conf-ing in a while (in terms of networking) As such, I'm interested to know; How do the nm gui's store network information? Can this be backed up or exported as a wpa_supplicant.conf file?


title: Fedora: System hangs after upgrade to FC18 (“started gdm”)

text: I've been upgrading my eee laptop from Fedora 17 to 18. After a reboot the system shows up the boot message               [  OK  ] Started GNOME Display Manager.      and does not go on any further. The system is alive, I can logon via ssh. Any suggestions how to fix or debug this issue any further? Thank you Chris               [xxx@eee X11]$  lspci |grep VGA     00:02.0 VGA compatible controller: Intel Corporation Atom Processor D4xx/D5xx/N4xx/


title: Configuring File Associations in Ubuntu with Wine

text: Related to this question, I have Ubuntu 20.04.1 LTS. I downloaded PlayOnLinux 4.1.9 (the Precise version) and used it to install Microsoft Office 2010 Pro. PlayOnLinux downloaded Wine 1.5.21 and whatever else it needed to install office. I did a customized installation and it seems to work fine. The only issue is now that I can't quite get file associations to work correctly. So for example, if I have a .docx document, I want to be able to just double click it and have it open with Microsoft Word. When I try to do that I get an error saying "IOPL not enabled" and the document never opens. I googled it and everyone said to open up wine configuration, go to libraries, add gdiplus and edit it to "Native (Windows)" but this still hasn't fixed the problem. I have no idea what this is or how it is supposed to work but can someone who does, please help. Currently I have to start Word and then use it to open up the document. That works fine. I am not very familiar with linux so hope this isn't too complicated and can be broken down into easy steps which I can follow and execute. Thank you.


title: How to rename a gnu screen session

text: I am running a screen session and I'd like to change it's name. I know that when starting a new screen session I can use the '-S' option to give it a name. How do I change that name once the session has already started? Thanks!


title: "No package <package name> available."?

text: I have installed a few packages using the yum package manager (e.g., I've installed the statistical programming language R), but lately I have been unable to install packages. For example, I want to install the package `tsclient` so that I can create a remote desktop connect with another computer, so at the terminal prompt I type `sudo yum install tsclient` and receive the following output:               Loaded plugins: langpacks, presto, refresh-packagekit     http://archive.linux.duke.edu/pub/fedora/linux/updates/16/i386/repodata/66dcc982036ed370618656c7b53dd7aa422663a305d2753590a01b9100080902-comps-f16.xml.gz:     [Errno 14] HTTP Error 404 - Not Found :     http://archive.linux.duke.edu/pub/fedora/linux/updates/16/i386/repodata/66dcc982036ed370618656c7b53dd7aa422663a305d2753590a01b9100080902-comps-f16.xml.gz     Trying other mirror.     http://fedora.mirror.netriplex.com/updates/16/i386/repodata/66dcc982036ed370618656c7b53dd7aa422663a305d2753590a01b9100080902-comps-f16.xml.gz:     [Errno 14] HTTP Error 404 - Not Found :     http://fedora.mirror.netriplex.com/updates/16/i386/repodata/66dcc982036ed370618656c7b53dd7aa422663a305d2753590a01b9100080902-comps-f16.xml.gz     Trying other mirror.     ftp://ftp.uci.edu/mirrors/fedora/linux/updates/16/i386/repodata/66dcc982036ed370618656c7b53dd7aa422663a305d2753590a01b9100080902-comps-f16.xml.gz:     [Errno 14] FTP Error 550 :     ftp://ftp.uci.edu/mirrors/fedora/linux/updates/16/i386/repodata/66dcc982036ed370618656c7b53dd7aa422663a305d2753590a01b9100080902-comps-f16.xml.gz     Trying other mirror. updates/group_gz                                      | 431 kB     00:00      Setting up Install Process No package tsclient     available. Error: Nothing to do      Why is this happening? How do I fix it? ADDITIONAL INFORMATION:               ls /etc/yum.repos.d/     adobe-linux-i386.repo  fedora-updates.repo     fedora.repo            fedora-updates-testing.repo


title: Location of inodes (ext)?

text: Say I want to observe how the flow from file name to cluster on hard disc goes. I get the inode number of I file (which is mapped in a directory data):               1863 autorun.inf      So, now i know that i have to look for the inode numbered `1863` which will contain the pointers to the data on the hard disc. Where is the inode data located and how does the os know where to find it?


title: SSH authentication: either SSH keys or one time password

text: I have an Ubuntu 10.04 Linux server that I normally ssh into (from my home machine) using ssh key authentication. However, sometimes I need to ssh remotely from potentially insecure machines (like internet cafes, public computers at the library, etc) on which my password could become compromised. In this case, I'd want to use a one-time password system like OTPW or Steve Gibson's Perfect Paper Passwords. How can I configure my server to **first check for ssh keys, then use an OTPW system** for authentication? (Would I have to make two users?)


title: permission and user/group of a program executed through a script

text: I am curious, in the following scenario, what kind of permission does a shell script or Java program has (owner/group/other)? There is a script called `run.sh`, and it in turn calls a Java program `a.java`. The script and the java is owned by user A and have `-rwxrw-r--` permissions. When they were run by user A, which permission group do they belong to? Do they get the permission from user A as a owner? And there is another user B, who is in the same group with user A. He execute `run.sh` and in turn calls the Java program. Now what permission group do they belong to? Do they get the permission from user B as a group? Maybe the program will try to write on a directory `/common/abc` which have a permission of `drwxrw-r--`, if the program have a permission of "other", it will fail. A point to notice, is that they both use the expression `sh run.sh` to run the script, so they don't need the execute permission. Does it only require the read permission?


title: Centos 6.5 from Desktop to basic server

text: I have already installed centos6.5 on a virtualbox, and I realized that I missed choosing the the basic server mode,can I change it now that the installation is over ?


title: Number of comma-separated fields in a text file

text: I'm trying to build an awk statement to read this file:               A   1,2,3   *     A   4,5,6   **     B   1     B   4,5     *      and build a file like this:               A   1,2,3   *    3   1   0.333     A   4,5,6   **   3   2   0.666     B   1            1   0   0     B   4,5     *    2   1   0.5      In this new file, the first three columns are the same as in the original file. The fourth column must contain the number of comma-separated elements in column 2. The fifth column must contain the number of characters in column 3. The last column contains the proportion of column 5 on column 4 (i.e., column 5 divided by column 4). I'm trying the following code:               awk '{print $1"\t"$2"\t"$3"\t"(NF","$2 -1)"\t"length($3)"\t"(length($3)/(NF","$2-1))}' file1 > file2      But I got the following output:               A   1,2,3   *    3,0   1   0.333333     A   4,5,6   **   3,3   2   0.666667     B   1            2,0   0   0     B   4,5     *    3,3   1   0.333333      I can't figure out what I'm doing wrong for column 4.


title: Add column based on search term

text: I have a file a:               aaa  bbb  ccc  DDD       ads  zzz  caa  DDD       aba  bab  cac  DAD       aad  cca  cas  SFD        and a file b:               DDD  5       DAD  13       SFD  11      I want to add a fifth column to file a based on file b, meaning search the term of column4 of file a in file b and add a fifth column to file a containing the respective value of column2 in file b. Can you help me?


title: Outlook on Kubuntu 14.0.4 with Wine

text: I have Kubuntu 14.04 and am mandated by my employer to use Outlook 2013 for company email for "security reasons". I currently solve this problem by having a virtual Windows 7. This seems like a bit of overkill. I have never used wine but in principle it would be an ideal solution. Can somebody please point me to a guide to using Office through wine? I have read that it is buggy on various posts but they are quite outdated. Does anybody have recent feedback on such an endeavour?


title: Tunnelling VPN through SSH mac

text: I have a pptp VPN server set up on my Raspberry Pi at home, and it works really well, except when I'm stuck behind my college's firewall. I can SSH into it through commonly open firewall ports (443, 8080), but I was wondering if I could do the same with VPN. The way I see it is it should work, since there are 4 ports that I know of open that I can SSH to my Raspberry Pi through (Not port 22 however!), but VPN just won't work. I have tried tinkering for the last two hours, but no luck. Has anyone done something like this before?


title: Synonyms (from a thesaurus) in Emacs

text: I use Emacs 23 on Debian sid. I can check the spelling of a word in Emacs with `M-$`. How can I obtain synonyms (using a thesaurus?) for a word in Emacs? None of the following were useful: one, two, three. If I download `synonyms.el` from the second link, where should I place it? Do I need to download a thesaurus as well?


title: Create a CentOS Guest img over Ubuntu

text: I want to create a basic CentOS 5.8 system from scratch. for now i build my own img for Ubuntu Guest (debootstrap), my host is a Ubuntu 12.04.1LTS but I don't know how to make for a CentOS, **is possible build CentOS from Ubuntu?**


title: SSH "command not found" for Zsh

text: Im using Zsh on the client and server. When I use ssh to run a command on the remote server it can not find the binary:               ssh gt "cd /home/****/app/staging && bundle exec rake db:migrate RAILS_ENV=staging"     zsh:1: command not found: bundle      I can run the same command fine if I SSH in with an interactive shell. On the server the `$PATH` is set in both .zshrc and .zshenv **EDIT** It appears `bundle` is not in my $PATH on the server. Maybe this has something to do with RVM (Ruby Version Manager) which hooks in to `cd`, so when you `cd` in to a directory with a `.rvmrc` file it sets up the Ruby environment and adds `bundle` to the $PATH. I need to find out if the `cd` hook is also triggered for non-interactive shells.


title: Can't get correct screen resolution on MacBook Pro 8,1 running Debian

text: I just installed the latest debian (6.0.3) on my MacBook Pro 8,1. My screen resolution is supposed to be 1280x800, but I can't get it higher than 1024x768. I tried using xrandr, but xrandr also tells me 1280x800 is not supported. How can I get the full resolution again?


title: "Permission denied" when starting binary despite "rwx" priviledge

text: I am trying to run the statistics software Stata 11 on Ubuntu 11.10. as a regular user and I get the following error message:               bash: xstata: Permission denied      The user priviledges seem ok to me as a linux newbie, tough:               -rwxr-x--x 1 root root 16177752 2009-08-27 16:29 xstata*      I would very much appreciate some advice on how to resolve this issue!


title: locale-dependent bash script: How to properly ensure locale?

text: I went through a strange bug in a bash script which is on another machine, accessed via ssh (or other ssh like clients). It was basically a menu, in particular showing IP address(es) of the machine it is hosted on. The important part is this code:               #!/bin/bash          function int-ips { /sbin/ifconfig |grep -B1 "inet addr" |awk '{ if ( $1 == "inet" ) { print $2 } else if ( $2 == "Link" ) { printf "%s:" ,$1 } }' |awk -F: '{ print $1 ": " $3 }'; }          echo $(int-ips)      (I just copy-pasted the above function from http://www.if-not-true-then- false.com/2010/linux-get-ip-address/) It was working perfectly on F19, on Mac OS X. Then another colleague tried it from his OS X, and, surprise!, absolutely nothing was printed. The script was still being executed on the same machine, it was just accessed by ssh from another client. It took me some time to understand it was a problem of locale: the language of the last machine was NOT English, and the function used to retrieve IP address use a "grep Link", the word "link" which happened to be translated for ifconfig with other locales, at least the one my colleague was using. Realising the existence of an awful source of bugs, I want to know how to shield myself properly against this kind of locale-dependence issue.   For example, I know I will use the "file" command to learn filetypes about inputs, and that I will probably use "grep" or so to analyse the results. ### My solution: Add this to the beginning of my script:               export LANG=C     export LC_ALL=C      (or en_US.utf8 instead of C maybe) My probably cleaner solution I'll do later:   1. SAVE current LANG and LC_ALL   2. export LANG=C ; export LC_ALL=C   3. execute my locale-dependant code   4. restore the user locale saved in 1) ### My questions: A) Is this fix ok? I mean, is there some experimented bash / nix coder who can warn me about some danger I don't see of using this method? (the more I get myself into nix/nux the more I'm sure of _nothing_ :P) B) Is there a neater / more elegant way of doing all this? P.S. FYI, but not relevant, IMHO:   The machine hosting the script is on a VM with Centos 6.4.   The machines from which we access the VM are on Fedora 19 or Mac OS X via ssh- terminal or Windows 7 via Putty


title: Is there any way to enable Ctrl+L to clear screen when 'set -o vi' is set?

text: When you press `CTRL+L` in bash default mode the screen is cleared. But when I run `set -o vi` and press `CTRL+L` the keystroke is printed (`^L`). Exists any way to keep this behavior?


title: Using bridge utils to connect two computers via Linux

text: I have been using bridge utils previously to connect my network connected computers to a single interface on my Linux computer. The problem I'm having is when I installed a new Linux (with Slackware) the two connected computers cannot even ping each other. Basically the computers are connected as:               client - server - client                |            [Internet]      So I am trying to get the two clients to connect to each other. Both can access the Internet, firewalls are shut off at both clients when testing. Internet is on eth0, and I have one bridge set up as               bridge name     interfaces     br0             eth1, eth2      `ip addr br0` and `ip route show` shows respectively               inet 10.0.0.1/24 brd 10.0.0.255     10.0.0.0/24 dev br0  proto kernel  scope link  src 10.0.0.1      So it seems to me like a call from my client should be routed directly to my br0 interface, which should get it right. I'm not an expert Linux user, so I'm not sure how to diagnose routing problems. My short question is therefore: How do I configure my Slackware distro to route two network cable attached computers to be able to see eachother, preferably using bridge utils?


title: In shell config scripts, how can I account for differences between coreutils on BSD compared to GNU?

text: Up until this month, my shell configs have been pretty simple (just a `.bashrc` or `.bash_profile` with some aliases mainly), but I have been refactoring it so I can get different behavior depending on whether I'm using zsh, and bash. They first source a generic shell config file that should work for whatever, then specialize for the specific shell being used (I symlink to this). I was surprised today when `ls` stopped working. It turned out that during refactoring `.bashrc`, there was an alias               alias ls='ls --color=always'      that was breaking things for `ls` in bash on Terminal in OSX. Once I saw that BSD `ls` likes `-G` for color, but GNU (or whatever was on Ubuntu) likes `\--color`, it was clear that quite a few options differ. My question is, what is the best way to account for differences in options and such between BSD and GNU coreutils? Should I test for an env variable in `if` blocks to see what OS is being used and apply correct behavior? Or does it make more sense to make separate config files for each OS? While answers to these questions may be subjective, it seems like a rundown of the scope of differences between BSD and GNU coreutils and strategies to work around these to make a generic config usable on most *nix would be fairly objective.


title: How to globally enable all of Gentoo's bash completions at once?

text: `eselect bashcomp enable` unfortunately seems to lack a `\--all` option, and I certainly don't want to manually activate each of the 194 entries. Can this be automated somehow, and set up such that packages installed afterwards _automatically_ have their bash completion activated?


title: Minix: Kernel Panic when booting from the Live CD

text: I followed the instructions in the Minix wiki on how to set up Minix in VirtualBox, but right after hitting enter on the boot screen, I get a kernel panic:               *** kernel messages:     ested 0     ...     kernel panic: cause_sig: sig manager 2 gets lethal signal 11 for itself     ...      I'm using VirtualBox 4.1.2 on Ubuntu 11.10. Am I doing anything wrong? How do I convince Minix to boot?


title: Is the `\` character escaping or becoming part of my ssh key password

text: If I do:               ssh-keygen -N password123\$ -f bobskeys      Is `\` escaping the `$` character or becoming part of the password? Or rather, will `bash` be doing any escaping before `ssh-keygen` gets the password value? Do I need to escape the `$` character? I'm running Centos 5.5 x64 and bash 3.2.25


title: Uppercase S in permissions of a folder

text: What does the letter `S` mean below? The file in question is a folder.                                                                 ![enter image description here](http://i.stack.imgur.com/fxqYF.png) I read here that an upper-case `S` can represent that the `setgid` bit is active for a **binary executable**. But this is a folder. Does it still mean that the `setgid` bit is activated for it? If so, what does that mean?


title: Why does my thumb drive go into read-only mode after a while?

text: My thumb drive auto-mounts as read-write, and I test it by writing a file. Then 18 hours later, I run a cron job that does               cp -f -u $i "$TARG"/$i      and I get the message,               cp: cannot remove `/media/HP USB FD/./bin_backup.zip': Read-only file system      Why has it flipped to read-only? I am running Fedora 16, and this has worked before; I'm not sure what changed to stop it from working (although I do rotate thumb drives). After a period of time, I get this in the dmesg log: (tl;dr summary - halfway down it says, `[3866698.685131] FAT-fs (sdb1): Filesystem has been set read-only`)               [3807719.969704]  sdb: sdb1     [3807719.984477] sd 18:0:0:0: [sdb] Attached SCSI removable disk     [3865771.716500] swapper/0: page allocation failure: order:2, mode:0x4020     [3865771.716506] Pid: 0, comm: swapper/0 Not tainted 3.2.9-2.fc16.x86_64 #1     [3865771.716508] Call Trace:     [3865771.716510]  <IRQ>  [<ffffffff8111fd66>] warn_alloc_failed+0xf6/0x160     [3865771.716524]  [<ffffffff8112d241>] ? wakeup_kswapd+0x101/0x160     [3865771.716529]  [<ffffffff81123c59>] __alloc_pages_nodemask+0x6f9/0x8c0     [3865771.716536]  [<ffffffff815dc633>] kmalloc_large_node+0x57/0x85     [3865771.716541]  [<ffffffff81168e7c>] __kmalloc_node_track_caller+0x19c/0x1f0     [3865771.716546]  [<ffffffff814c813b>] ? __alloc_skb+0x4b/0x240     [3865771.716549]  [<ffffffff814c8955>] ? skb_copy+0x45/0xb0     [3865771.716553]  [<ffffffff814c8168>] __alloc_skb+0x78/0x240     [3865771.716556]  [<ffffffff814c8955>] skb_copy+0x45/0xb0     [3865771.716576]  [<ffffffffa017a9a4>] tg3_start_xmit+0xa34/0xc80 [tg3]     [3865771.716583]  [<ffffffff814d7282>] dev_hard_start_xmit+0x322/0x6e0     [3865771.716590]  [<ffffffff814f2daf>] sch_direct_xmit+0xef/0x1c0     [3865771.716595]  [<ffffffff814d77c4>] dev_queue_xmit+0x184/0x600     [3865771.716600]  [<ffffffff81500985>] ? nf_hook_slow+0x75/0x150     [3865771.716605]  [<ffffffff8150f8d0>] ? ip_fragment+0x810/0x810     [3865771.716609]  [<ffffffff8150fa3b>] ip_finish_output+0x16b/0x2f0     [3865771.716613]  [<ffffffff81510598>] ip_output+0x98/0xa0     [3865771.716617]  [<ffffffff8150fc64>] ? __ip_local_out+0xa4/0xb0     [3865771.716621]  [<ffffffff8150fc99>] ip_local_out+0x29/0x30     [3865771.716626]  [<ffffffff8150fdef>] ip_queue_xmit+0x14f/0x3f0     [3865771.716630]  [<ffffffff81527204>] tcp_transmit_skb+0x3e4/0x8d0     [3865771.716634]  [<ffffffff81527d57>] tcp_write_xmit+0xf7/0xa20     [3865771.716638]  [<ffffffff8152a9f0>] ? tcp_v4_md5_lookup+0x10/0x20     [3865771.716643]  [<ffffffff815286e6>] __tcp_push_pending_frames+0x26/0xd0     [3865771.716647]  [<ffffffff81524e0d>] tcp_rcv_established+0x10d/0x8b0     [3865771.716651]  [<ffffffff8152d09f>] tcp_v4_do_rcv+0x27f/0x430     [3865771.716656]  [<ffffffff8152ee70>] tcp_v4_rcv+0x610/0x8e0     [3865771.716660]  [<ffffffff8150acf0>] ? ip_rcv_finish+0x380/0x380     [3865771.716663]  [<ffffffff8150acf0>] ? ip_rcv_finish+0x380/0x380     [3865771.716668]  [<ffffffff8150adcd>] ip_local_deliver_finish+0xdd/0x280     [3865771.716672]  [<ffffffff8150b138>] ip_local_deliver+0x88/0x90     [3865771.716676]  [<ffffffff8150aaa1>] ip_rcv_finish+0x131/0x380     [3865771.716680]  [<ffffffff8150b375>] ip_rcv+0x235/0x300     [3865771.716685]  [<ffffffff814d4e23>] __netif_receive_skb+0x523/0x5c0     [3865771.716690]  [<ffffffff814d5a20>] netif_receive_skb+0x80/0x90     [3865771.716694]  [<ffffffff814d5d89>] ? dev_gro_receive+0x1b9/0x2c0     [3865771.716699]  [<ffffffff814d5a80>] napi_skb_finish+0x50/0x70     [3865771.716703]  [<ffffffff814d5f85>] napi_gro_receive+0xf5/0x140     [3865771.716711]  [<ffffffffa0171362>] tg3_poll_work+0x7a2/0xce0 [tg3]     [3865771.716717]  [<ffffffff81056d45>] ? check_preempt_curr+0x75/0xa0     [3865771.716725]  [<ffffffffa017868f>] tg3_poll+0x6f/0x3c0 [tg3]     [3865771.716730]  [<ffffffff814d617b>] net_rx_action+0x12b/0x270     [3865771.716735]  [<ffffffff81096ebd>] ? sched_clock_cpu+0xbd/0x110     [3865771.716740]  [<ffffffff81075d58>] __do_softirq+0xb8/0x230     [3865771.716745]  [<ffffffff8109acc6>] ? do_timer+0x2d6/0x500     [3865771.716749]  [<ffffffff815ee8ec>] call_softirq+0x1c/0x30     [3865771.716754]  [<ffffffff810162f5>] do_softirq+0x65/0xa0     [3865771.716758]  [<ffffffff8107616e>] irq_exit+0x9e/0xc0     [3865771.716762]  [<ffffffff815ef1a3>] do_IRQ+0x63/0xe0     [3865771.716766]  [<ffffffff815e4aee>] common_interrupt+0x6e/0x6e     [3865771.716768]  <EOI>  [<ffffffff81094189>] ? enqueue_hrtimer+0x39/0xc0     [3865771.716775]  [<ffffffff8131237d>] ? intel_idle+0xed/0x150     [3865771.716779]  [<ffffffff8131235f>] ? intel_idle+0xcf/0x150     [3865771.716784]  [<ffffffff81494fb1>] cpuidle_idle_call+0xc1/0x280     [3865771.716788]  [<ffffffff8101322a>] cpu_idle+0xca/0x120     [3865771.716792]  [<ffffffff815c199e>] rest_init+0x72/0x74     [3865771.716797]  [<ffffffff81aebbfe>] start_kernel+0x3ba/0x3c5     [3865771.716801]  [<ffffffff81aeb347>] x86_64_start_reservations+0x132/0x136     [3865771.716804]  [<ffffffff81aeb140>] ? early_idt_handlers+0x140/0x140     [3865771.716808]  [<ffffffff81aeb44d>] x86_64_start_kernel+0x102/0x111     [3866698.685128] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)     [3866698.685131] FAT-fs (sdb1): Filesystem has been set read-only     [3866698.685145] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)     [3866698.685148] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)     [3866698.685149] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)     [3866698.685151] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)     [3866698.685153] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)     [3866698.685154] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)     [3866698.685156] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)     [3866698.685158] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)     [3866698.685161] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)     [3953054.903337] fat_get_cluster: 88 callbacks suppressed     [3953054.903340] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)     [3953054.903356] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)     [3953054.903359] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)     [3953054.903362] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)     [3953054.903364] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)     [3953054.903367] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)     [3953054.903369] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)     [3953054.903371] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)     [3953054.903374] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)     [3953054.903378] FAT-fs (sdb1): error, fat_get_cluster: invalid cluster chain (i_pos 496175)


title: Why is my hard drive out of space if gparted says I have 500+GB

text: I recently installed Debian on my machine and made separate `/` and `/home` partitions. Yet my disk usage analyzer shows that my `/home` is inside `/`. But `gparted` shows that `/home` is indeed in it's own partition, and has 500+ GB of free space. I checked my `/etc/mtab` and it shows that `/home` is mounted at `/dev/sdb6` whereas `/` is mounted at `/dev/sda1`. I don't understand what is wrong. I'm going to keep reading about partitioning, but I'd like to leave this question here to simmer to see if anyone has a quick answer. I put translations in the `gparted` window just in case. ![What The Heck](http://i.stack.imgur.com/ppLgk.png)


title: Change behaviour of numpad to dpad in GNOME 3.2

text: I'm a long-time Windows user who uses the numeric keypad with the numlock off for navigating text, highlighting it, etc. `Shift` + `Home` (`7` on the numpad) selects all text till the beginning of the line. In GNOME, pressing `Shift` + `Home` on the numpad inputs `7` instead of selecting all text till the beginning of the line. Is there a way to change the behaviour of the numpad in GNOME 3.2 to that of the direction pad?


title: Piping PS output into a Text file

text: So what im wanting to do is pretty basic.....but im not sure how to go about it. Lets say I have a program running, but I want to pipe the output of ps -C "ProgramXX" into a file. Normally Running ps -C "ProgramXX" Produces something to the effect of:               PID TTY TIME            CMD     123 ?   00:00:00    Program1     142 ?   00:00:00    Program1     165 ?   00:00:00    Program1     221 ?   00:00:00    Program1      Is their any "simple" way to just get the 1st columns and 4th column (ignoring the top heading line) into a text file. I figure you could run ps -C "Program1" >> Data.txt.....then maybe run a script to cut out the fat? This would be done in Bash btw. Maybe using grep or something.....but I wouldn't really know. This would be ran multiple times btw......so data.txt would continue to grow.


title: setup password less ssh between two accounts from third account

text: There are two unix accounts `A` and `B`. I want to configure password less ssh between these two accounts.This can be done without much pain but my problem is that there are mutiple accounts like `A` and `B` where I have to the same thing.I also have one admin account `C` (not `root`). So,I was thinking if it is possible to setup password less ssh connection between `A` and `B` from account `C` so that I can write a script and run it from account `C` every time I want do similar activity for different accounts. (Also ,all the accounts have the same password .)


title: Print given number in reverse order

text: clear     echo "Enter a number"     read n     sd=0     rev=0          while [ $n -gt 0 ]     do         sd=$(( $n % 10 ))         rev=$(( $rev *\ 10 + $sd ))         n=$(( $n / 10 ))     done          echo "Reverse number of entered digit is $rev"      From the above code I am unable to get the required output. Instead, this error is displayed.               ./Display: line 17: 0 *\ 10 + 4 : syntax error: operand expected (error token is "\ 10 + 4 ")     Reverse number of entered digit is 0 I don't know why this error is displayed, please help me to figure it out.


title: An -e option to cd builtin

text: According to Bash reference on Bash builtins: > `cd [-L|[-P [-e]]] [directory]` > > The -P option means to not follow symbolic links; symbolic links are > followed by default or with the -L option. If the -e option is supplied with > -P and the current working directory cannot be successfully determined after > a successful directory change, cd will return an unsuccessful status. Can somebody give me an example of situation when `-e` is useful? Right now, if I supply -P option with -e (`cd -P -e`), I'm getting a usage message along with an error telling me that -e is "invalid option". Why is that?


title: Why grp:lctrl_lshift_toggle still keeps right keys as switch triggers?

text: I ran the following command in my terminal:               setxkbmap -layout us,ru -option "grp:lctrl_lshift_toggle,ctrl:nocaps"      but for some reason, the effect is the same if I specified "grp:ctrl_shift_toggle" - both `Left-Shift+Left-Ctrl` and `Right-Shift+Right- Ctrl` change my layout. How can I fix it?