title: How do I change folder timestamps recursively to the newest file?

text: I was wondering if anyone knows how to change the timestamps of folders recursively based on the latest timestamp found of the files in that folder. So for example:               jon@UbuntuPanther:/media/media/MP3s/Foo Fighters/(1997-05-20) The Colour and The Shape$ ls -alF     total 55220     drwxr-xr-x  2 jon jon    4096 2010-08-30 12:34 ./     drwxr-xr-x 11 jon jon    4096 2010-08-30 12:34 ../     -rw-r--r--  1 jon jon 1694044 2010-04-18 00:51 Foo Fighters - Doll.mp3     -rw-r--r--  1 jon jon 3151170 2010-04-18 00:51 Foo Fighters - Enough Space.mp3     -rw-r--r--  1 jon jon 5004289 2010-04-18 00:52 Foo Fighters - Everlong.mp3     -rw-r--r--  1 jon jon 5803125 2010-04-18 00:51 Foo Fighters - February Stars.mp3     -rw-r--r--  1 jon jon 4994903 2010-04-18 00:51 Foo Fighters - Hey, Johnny Park!.mp3     -rw-r--r--  1 jon jon 4649556 2010-04-18 00:52 Foo Fighters - Monkey Wrench.mp3     -rw-r--r--  1 jon jon 5216923 2010-04-18 00:51 Foo Fighters - My Hero.mp3     -rw-r--r--  1 jon jon 4294291 2010-04-18 00:52 Foo Fighters - My Poor Brain.mp3     -rw-r--r--  1 jon jon 6778011 2010-04-18 00:52 Foo Fighters - New Way Home.mp3     -rw-r--r--  1 jon jon 2956287 2010-04-18 00:51 Foo Fighters - See You.mp3     -rw-r--r--  1 jon jon 2730072 2010-04-18 00:51 Foo Fighters - Up in Arms.mp3     -rw-r--r--  1 jon jon 6086821 2010-04-18 00:51 Foo Fighters - Walking After You.mp3     -rw-r--r--  1 jon jon 3033660 2010-04-18 00:52 Foo Fighters - Wind Up.mp3      The folder "(1997-05-20) The Colour and The Shape" would have its timestamp set to 2010-04-18 00:52.


title: Displaying a specific date

text: I'm trying to display a specific date in Unix, using the date command, I can't figure out how to display a date other than today's date. For example, if I was trying to display `July 4, 2011` I use               $ date +"%B %d, %Y"      But I keep getting today's date in that format. How can I change it so that it displays the date I want?


title: Bash history with timestamps

text: I would like to keep timestamps on the commands logged in my Bash $HISTFILE, is it possible? I did not manage to set it up using `man bash` as an information source. My other options are as follows:               function thebanana() {       local -r -a bash_commands=(         "ls"         # ... more coconut commands       )       for bash_command in "${bash_commands[@]}"; do         printf "${bash_command}"         printf ":"       done     }     export HISTFILE=banana     export HISTIGNORE="$(thebanana)"     export HISTSIZE=999999     export HISTFILESIZE=999999999     export HISTCONTROL=ignoredups:erasedups      I should have mentioned I am on OS X Mountain Lion (sigh). `uname -a` gives me:               Darwin CoconutMac.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64      and `echo $BASH_VERSION` gives me:               3.2.48(1)-release      Tried adding this:               export HISTTIMEFORMAT='%b %d %I:%M:%S %p '      and it only prefixes this kind of timestamps to commands:               #1349057791      I try echoing back the variable (`echo $HISTTIMEFORMAT`), it has the right value. Interesting! I even removed .profile completely to debug this. Still only funny timestamps:               #1349058320      I don't know how to further troubleshoot this... :( **Solution** : I was using a script that reads the $HISTFILE directly, not the history built-in so the epoch-based timestamp (secs since Coordinated Universal Time (UTC) of January 1, 1970) was not being translated using the date formatting string. Plain-old `history` works fine, I'll use that instead.


title: Boot disk unavailable

text: ### Background I've got one 32GB SSD that I have Ubuntu 12.10 installed on (this drive is encrypted), and two 1.5TB drives that will serve as storage and backup respectively. I have formated both drives (sdb, sdc) as ext4 and added them to `fstab`:               UUID=f8522a6f-2c4a-4e6a-bc45-390c13973a4f /pool/single-storage-00 ext4 defaults 0 2     UUID=caf3f01d-5f44-4baf-a7c6-75e2df39d088 /pool/single-backup-00  ext4 defaults 0 2      ### Problem When I try to reboot after modifying fstab, the boot drive doesn't even show up in BIOS any more. If I unplug the two storage drives, Ubuntu is able to boot up normally (apart from not being able to locate the storage drives). I've also discovered that I can boot up when these drives are plugged in only if they aren't in `fstab`.


title: Really umount external drive

text: I had a USB drive mounted on `/dev/sdb1` and I want to reformat from NTFS to ext3. I did `umount -l` which unmounted the disk. I deleted the old partition using `cfdisk`. I ran `mkfs.ext3`, but got the error: > /dev/sdb1 is apparently in use... After googling I tried to `cat /proc/mounts` and found it there:               /dev/sdb1 /media/moviesold       How do I remove the reference from there? How did it get there? More specifically what can I run to "really umount"?


title: lvmetad hangs on startup

text: I got a machine running archlinux that have a problem on boot. It hangs for 90s waiting for pvscan on block devices, and then give up. (actually, the pvscan process are still stuck ,and any lvm command after that will hang too). Sometimes it works well. After some digging, it looks like lvmetad(8) is responsible for this hang, as it hangs itself at start:               lvmetad[360]: Cannot lock lockfile [/run/lvmetad.pid], error was [Resource temporarily unavailable]      If I kill it and start it again after boot, the hanging pvscan processes are unlocked, finish their works, and everything goes back to normal (lvm commands works again, etc.) You can see this in logs : Pastebin I tried to lower verbosity of lvmetad, but I only get the error given. _sometimes_ the boot is a little longer than usual (waiting for root partition), and lvmetad starts well (I'm not sure it's really related, though) Have you an idea on how to prevent this error ? Edit: I've collected more information:   * the "cannot log logfile" error appears when fcntl() fails with EAGAIN (a file to be locked is already shared-locked or exclusive-locked by another process)   * there is a lvmetad running on the system, with a very little pid (way littler than the failing process we see in logs)   * the lvmetad process spawned by lvm2-lvmetad.service is run with -f, so the running one is not this one   * the first one was started 3 seconds before the second (before systemd) the cleanup hook of lvm2 component for initrd should kill the early lvmetad, dont for a reason it does not work:               run_cleanuphook() {         kill $(cat /run/lvmetad.pid)     }      killing the process after boot don't work neither I took a debug trace (can't post a third link, I put it at the end of the second paste), and it looks like the main thread is waiting for terminations of other threads, and there is a client_thread stuck on a read on fd 6 (/run/lvm/lvmetad.socket)


title: When was the script started?

text: What I want is,               -bash-3.2$ ps -aef | grep 29137     jeeadm    9794  1190  0 09:22 pts/2    00:00:00 grep 29137     jeeadm   29137     1  0 Sep02 ?        00:00:21 Java      Second Row, Fifth Column entry, as in the output it's just showing the date, Anyway to get the full time-stamp?


title: How can I create a udev rule to mount a USB drive read only?

text: I'm trying to set a particular USB drive to always mount read only. If I plug it in, it is seen as `sdb` with a single partition, `sdb1`. Here are some relevant `udevadm` lines (not the entire output of course):               $ udevadm info -a -n /dev/sdb1       looking at device '/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.4/2-1.4:1.0/host21/target21:0:0/21:0:0:0/block/sdb/sdb1':         KERNEL=="sdb1"         SUBSYSTEM=="block"         DRIVER==""         ATTR{ro}=="0"         ATTR{size}=="976768002"         ATTR{stat}=="     473    30586    33938     3460        5        0       40     1624        0     2268     5084"         ATTR{partition}=="1"      OK, so I wrote the following `udev` rule and saved it as `/etc/udev/rules.d/10-usbdisk.rules`:               SUBSYSTEM=="block",     ATTR{size}=="976768002",     MODE="0555"      According to this, using `size` should be enough but I have also tried other permutations. In any case, the rule does seem to be read (again, selected output lines, you can see the entire output here:               $ udevadm test $(udevadm info -q path -n /dev/sdb1) 2>&1     [...]     read rules file: /etc/udev/rules.d/10-usbdisk.rules     [...]     MODE 0555 /etc/udev/rules.d/10-usbdisk.rules:4      So, it _looks_ like the rule should be applied and it _looks_ like the `MODE="0555"` is the correct syntax. However, when I actually plug the disk in, I can happily create/delete files on it. OS: Debian testing (LMDE)   So, what am I doing wrong? How can I mount a particular USB drive as read only automatically **using udev** 1? 1 I know how to do this with fstab but fstab settings are ignored by gvfs. My objective is to have this mounted automatically as read only in the GUI. Presumably this will have to be done via udev or gvfs somehow.


title: How to determine why a machine is running slowly?

text: I log into a linux server (installed as a virtual machine) using a graphical ssh client (securessh). This server runs a tomcat5.5 server where nexus is installed. When I type commands or delete/copy small files (around 5-6 MB), the shell takes a long time to respond (from 10 seconds to almost a minute). I have tried to run `top` to see if any processes use a lot of memory/cpu time:               top - 13:34:41 up 86 days, 16:04,  1 user,  load average: 2.13, 0.99, 1.94     Tasks:  63 total,   1 running,  62 sleeping,   0 stopped,   0 zombie     Cpu(s):  2.0%us,  1.5%sy,  0.0%ni, 96.2%id,  0.2%wa,  0.0%hi,  0.1%si,  0.0%st     Mem:   3896416k total,  3097824k used,   798592k free,   167180k buffers     Swap:   915664k total,       84k used,   915580k free,  2409236k cached            PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                20436 tomcat55  20   0  359m 217m  13m S   18  5.7   2713:04 jsvc                                       Only the tomcat55 user use a significant amount of resources. Based on the above output is seems that this user only spends 5.7% of the mem and only 5.7% of the cpu. Am I misreading `top`'s output? Why is the machine performing so poorly if the CPU and memory are so underutilized? * * * **Edit** : I have now tried to run atop and get:               ATOP - repository         2011/09/20  16:08:48               10 seconds elapsed     PRC | sys   0.17s | user   0.03s | #proc     64 | #zombie    0 | #exit      4 |     CPU | sys      2% | user      1% | irq       0% | idle    198% | wait      0% |     cpu | sys      1% | user      1% | irq       0% | idle     98% | cpu001 w  0% |     cpu | sys      0% | user      0% | irq       0% | idle     99% | cpu000 w  0% |     CPL | avg1   0.05 | avg5    0.92 | avg15   1.29 | csw      976 | intr      61 |     MEM | tot    3.7G | free  656.7M | cache   2.4G | buff  170.9M | slab  241.3M |     SWP | tot  894.2M | free  894.1M |              | vmcom 781.9M | vmlim   2.7G |     DSK |         sda | busy      0% | read       0 | write      9 | avio    0 ms |     NET | transport   | tcpi      18 | tcpo      26 | udpi       0 | udpo       0 |     NET | network     | ipi       22 | ipo       26 | ipfrw      0 | deliv     22 |     NET | eth1     0% | pcki      34 | pcko      26 | si    2 Kbps | so   11 Kbps |            PID  SYSCPU  USRCPU  VGROW  RGROW  RDDSK  WRDSK  ST EXC S  CPU CMD     1/1         4687   0.06s   0.02s     0K     0K      -      -  NE   0 E   1% <lsb_release>      4689   0.04s   0.01s     0K     0K      -      -  NE   0 E   1% <apt-cache>         4684   0.04s   0.00s   132K   132K     0K     0K  --   - R   0% atop      4673   0.02s   0.00s     0K     0K     0K     0K  --   - S   0% sshd               4152   0.01s   0.00s     0K     0K     0K     0K  --   - S   0% vmware-guestd      2302   0.00s   0.00s     0K     0K     0K     4K  --   - S   0% kjournald      4688   0.00s   0.00s     0K     0K      -      -  NE   0 E   0% <sh>       4686   0.00s   0.00s     0K     0K      -      -  NE   0 E   0% <sh>          If I understand this correct there a no 'zombies' but still they take up most of the cpu time (it jumps from 199% to 200%). Is this expected behavior?


title: Can't figure out which Cent OS to download

text: I'm not sure if this belongs here, but I really need help on which Cent OS version to download. There's some linux distros that I want to try, but none of the websites are as user friendly as Ubuntu =( Which one should I download from this list? http://mirror.rackspace.com/CentOS/6.3/isos/i386/


title: apt-get update and package authentication

text: Sometimes when you try to apt-get install a program, you get a warning message about how some packages couldn't be authenticated. Doing an apt-get update will sometimes fix the problem, but sometimes it won't. How does apt-get update fix this problem? Does this type of authentication necessarily involve ssl? Why does it sometimes not fix the problem?


title: Convert .bdf/.pcf font to .psf(u) for using as consolefont?

text: I am using Arch Linux. Is it possible to convert a BDF or PCF font to a PSF font for use in console/CONSOLEFONT in rc.conf? I haven't found anything that can do it,except bdf2psf which I got the source but couldn't find out how to use it, the man page was very hard to understand. Thanks in advance for any help.


title: Selecting a managed switch with Linux, for use in mesh network project (batman-adv)

text: I am interested in trying out batman-adv to manage a mesh network comprised of point-to-point radios (mesh links) and cellular modems (gateways). Each node would have one p2p radio, and some nodes would also have one cell modem. All nodes would also have a device that uses the network (small embedded device with ethernet interface), so in total there are three ethernet devices. In order to keep the power and size foot print small, I want to stay away from using a computer with three nics, and I was wondering if there are routers (no need to be wireless, 802.11 won't be used) that would be suitable (linux, access to all ethernet interface, can support batman-adv) For example, maybe routers that support dd-wrt can have batman-adv loaded and used in such a manner?


title: Which services should be disabled?

text: Following is the output of `$chkconfig | grep 5:on` on my laptop running Fedora 14.               NetworkManager  0:off   1:off   2:on    3:on    4:on    5:on    6:off     acpid           0:off   1:off   2:on    3:on    4:on    5:on    6:off     auditd          0:off   1:off   2:on    3:on    4:on    5:on    6:off     avahi-daemon    0:off   1:off   2:off   3:on    4:on    5:on    6:off     cpuspeed        0:off   1:on    2:on    3:on    4:on    5:on    6:off     haldaemon       0:off   1:off   2:off   3:on    4:on    5:on    6:off     ip6tables       0:off   1:off   2:on    3:on    4:on    5:on    6:off     iptables        0:off   1:off   2:on    3:on    4:on    5:on    6:off     irqbalance      0:off   1:off   2:off   3:on    4:on    5:on    6:off     lvm2-monitor    0:off   1:on    2:on    3:on    4:on    5:on    6:off     mdmonitor       0:off   1:off   2:on    3:on    4:on    5:on    6:off     messagebus      0:off   1:off   2:on    3:on    4:on    5:on    6:off     netfs           0:off   1:off   2:off   3:on    4:on    5:on    6:off     nfslock         0:off   1:off   2:off   3:on    4:on    5:on    6:off     rpcbind         0:off   1:off   2:on    3:on    4:on    5:on    6:off     rpcgssd         0:off   1:off   2:off   3:on    4:on    5:on    6:off     rpcidmapd       0:off   1:off   2:off   3:on    4:on    5:on    6:off     rsyslog         0:off   1:off   2:on    3:on    4:on    5:on    6:off     smolt           0:off   1:off   2:on    3:on    4:on    5:on    6:off     udev-post       0:off   1:on    2:on    3:on    4:on    5:on    6:off      I don't use NM for connecting to the Internet. So I think that should be stopped right away. Also I have ext4 filesystem so I assume lvm2-monitor can be safely turned off. My primary usage is surfing net and coding in Python (newbie though). Which services should I disable so that unnecessarily resources don't remain busy? Thanks.


title: Ubuntu 10.10 installed from windows 7: how to expand drive?

text: I'm new to Linux. I've installed Ubuntu 10.10 from Windows 7. It's not in Virtual PC, it is independent. It uses a virtual drive in `c:`, I have chosen it to be 10 Gb. Now I want to increase the size of this drive. How to do this? I've configured the system for PHP MySQL and installed a lot of software and fixed wireless connection problems a lot of things i don't want to loose these things and start troubling again. I heard of backups, but I think it will take too long. Is there any other simple and fast way?


title: How to list files sorted by modification date recursively (no stat command available!)

text: How can I get the list of all files under current directory along with their modification date and sorted by that date? Now I know how to achieve that with `find`, `stat` and `sort`, but for some weird reason the `stat` is not installed on the box and it's unlikely that I can get it installed. Any other option? PS: `gcc` is not installed either


title: goaccess won't run when called from CGI script

text: I'm trying to make a CGI script (for nginx) that outputs an html page containing the usage statistics for my server. I'm using goaccess 0.7.1 and CentOS 5 x86. I've configured nginx to run my bash script (`stats.sh`) for requests on port 8080. The bash script looks like this:               #!/bin/bash          cat /var/log/nginx/mydomain.access.log | goaccess -a > stats.html          echo Content-Type: text/html     echo Content-Length: $(stat -c%s stats.html)     echo     cat stats.html      When I run `./stats.sh`, everything works fine. It prints a bunch of html code in the console window, and if I open stats.html, I see a bunch of html code. **THE PROBLEM IS** , when I try to access `http://www.mydomain.com:8080/`, I just get a blank page. Now when I open stats.html on the server, it's completely empty. I've confirmed the following permissions:   * `stats.sh`: `-rwxr-xr-x`   * `stats.html`: `-rw-rw-rw-`   * `goaccess`: `-rwxr-xr-x` I also know that CGI is working properly because if I modify `stats.sh` to only output the contents of `stats.html` (without writing to the file), it works fine when I hit `http://www.mydomain.com:8080/`; it just sends whatever data was in `stats.html` from before. So something is going wrong with calling goaccess in a CGI script. Does anyone know why? **UPDATE** I also tried this:               echo "<!DOCTYPE hmtl>TEST" > stats.html      and it works fine when I hit `http://www.mydomain.com:8080/`, so something is going wrong when running `goaccess` from FastCGI. I also tried specifying the full path to `goaccess` (`/usr/local/bin/goaccess`):               /var/log/nginx/mydomain.access.log | /usr/local/bin/goaccess -a >stats.html 2>stats.err      but this also did not work.


title: Check if script is started by cron, rather than invoked manually

text: Is there any variable that cron set when it's running a program ? If the script is running by cron, I'll skip some parts; otherwise invoke those parts. How can I know if the bash script is started by cron ?


title: Will I break debian etch if I install python-support 0.7.1 to it?

text: I try to install `s3cmd` into my debian etch, but the following error message comes up:               root@NAS-01G:~/src$ sudo apt-get install s3cmd     Reading package lists... Done     Building dependency tree... Done     Some packages could not be installed. This may mean that you have     requested an impossible situation or if you are using the unstable     distribution that some required packages have not yet been created     or been moved out of Incoming.          Since you only requested a single operation it is extremely likely that     the package is simply not installable and a bug report against     that package should be filed.     The following information may help to resolve the situation:          The following packages have unmet dependencies:       s3cmd: Depends: python-support (>= 0.7.1) but 0.5.6 is to be installed     E: Broken packages      I'm thinking of upgrade to `python-support 0.7.1`, will this break my system? Thanks.


title: How do you separate /bin and /sbin when making an RPM?

text: I'm trying to make a redis RPM using fpm When I run the following commands, all binaries are installed to /tmp/installdir/usr/local/bin               cd /tmp/redis2-8     PREFIX=/tmp/installdir/usr/local/ make      PREFIX=/tmp/installdir/usr/local/ make install       How could I compile redis so that the `redis-server` binary is installed to `/tmp/installdir/usr/local/sbin` and everything else (`redis-cli, redis- benchmark` ect.. ) is installed to `/tmp/installdir/usr/local/bin` ?


title: How to tell gzip to keep original file?

text: I would like to compress a text file using gzip command line tool while **keeping** the original file. By default running the following command               gzip file.txt      results in modifying this file and renaming it `file.txt.gz`. instead of this behavior I would like to have this new compressed file in **addition** to the existing one `file.txt`. For now I am using the following command to do that               gzip -c file.txt > file.txt.gz      It works but I am wondering why there is no easier solution to do such a common task ? Maybe I missed the option doing that ?


title: Any way to list wireless clients in range

text: I'm looking to see whether it's possible to implement a staff 'in office/out of office' facility by tracking the active wifi (phones/tablets/laptops) in the building. Is it possible to return a list (MAC addresses?) of active wifi clients even if they are not associated with an AP? I'm wondering whether I could put together a Linux-based solution that's totally independent from the company Access Points as they have no simple way to pull off a list of attached devices. Thanks


title: .lit reader for Linux

text: Is there any reader for ebooks in .lit format for Linux? Or is there one for Windows that I can run on my Linux with Wine? Distro: openSUSE 12.2 x86_64 and Linux Mint 12 x86_64


title: AWK help for filling up rest of the columns with &nbsp in file

text: I'm trying to get AWK filling up following text file for "empty" columns". Basic idea of finding longest line with AWK NF and checking which line has no value on that column. Then adding x times N/A for each empty column. This example is input space separated, but of course it can be changed easily to any character separated file. Input can be as:               aaa bbb ccc ddd     aaa      aaa bbb ccc     hhh ppp uuu     www yyy hhh     hhh 111 333 yyy ooo hyy uuuioooy       And output where amount of max columns in file is calculated and N/A added to columns that empty.               aaa bbb ccc ddd N/A N/A N/A     aaa N/A N/A N/A N/A N/A N/A     aaa bbb ccc N/A N/A N/A N/A     hhh ppp uuu N/A N/A N/A N/A      www yyy hhh N/A N/A N/A N/A      hhh 111 333 yyy ooo hyy uuuioooy


title: rsync and write permissions at the target

text: I always wondered why `rsync` tries to transfer a file to a remote location where it has _read/execute_ permissions for the target dir, but no _write_ permissions to create the actual destination file. This can be simulated even locally when trying to copy a file as a regular user to _/_ , `rsync` will transfer the whole file (also taking rather long for large files) and finally fails with               rsync: mkstemp "/.myTargetFile" failed: Permission denied (13)      So it already seems to fail at startup when trying to create the temporary file (the _dot_ -file) during transfer. Why doesn't it notice this and aborts early instead of trying to copy the whole file without having any write permissions? And where does it copy the file to if it can't create the temporary file? I can't see any memory increase of the rsync processes and also no corresponding file in _/tmp_. Seems like it directly discards the data at the destination but still keeps on with transferring.


title: How To Fix Grub Boot Error hd0 out of disk

text: After I updated Debian to Wheezy whenever I boot my computer I get `Grub boot error hd0 out of disk` and then a prompt comes up with `grub rescue>`. So far I have been unable to find a solution by googleing. When I run `grub-update` on a live system I get `bash: grub-update: command not found`.


title: Debug program in eclipse with a newly built compiler

text: I recently tried to build the new version of GCC (4.8.1) on Ubuntu 12.04. I managed to build everything correctly, it passed the tests and I installed the new compiler. I can build programs with the new compiler. I can run them. However, as soon as I try to debug them in eclipse it does not work. It gives me the following error message:               No source available for "main() at 0x8048693"      Is there something other than GCC that I should update to be able to debug? Edit: Here is the "program" I am trying to debug and how I compile it. test.cpp:               #include <iostream>          int main() {         std::cout << "Hello World!" << std::endl;         return 0;     }      compilation command:               g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/test.d" -MT"src/test.d" -o "src/test.o" "../src/test.cpp"


title: Finding out how many programs I have not installed from a list with grep/awk in archlinux

text: I want to see how many packages from a list are not installed. I use archlinux, so I use pacman -Q to determine if a package is installed. If it is not installed, it returns a message like: "error: package 'package-name' was not found". I thought I could use `grep -c 'error'` like this:               pacman -Q autoconf automake binutils bison fakeroot flex gcc libtool m4 make patch pkg-config | grep -c 'error'      But for me it returns: > error: package 'bison' was not found   >  error: package 'pkg-config' was not found   >  0 It returns 0, but I would like it to return 2. Even with awk it doesn't work:               pacman -Q autoconf automake binutils bison fakeroot flex gcc libtool m4 make patch pkg-config | awk '/error: / {count++} END {print count}'      For me, this returns: > error: package 'bison' was not found   >  error: package 'pkg-config' was not found So my guess is that variable `count` doesn't even have a value since it doesn't get printed. I also tried `wc -l`, but that doesn't work, it just returns 0 for me. What is the correct way to print the number of not-installed packages? EDIT: I noticed when I do:               pacman -Q autoconf automake binutils bison fakeroot flex gcc libtool m4 make patch pkg-config > tempfile       cat tempfile      The two rows containing the error message are not added to `tempfile` (the rest of the command output does). Thought this might help solving this problem.


title: How to run jgrasp on ubuntu?

text: I have problems with jgrasp. I get the following error message when I run it. > ----jGRASP exec: javac -g R.java ----jGRASP wedge: could not execute javac > ---- error number 2. ---- ---- Target does not exist or is not on PATH. ---- > ---- ---- PATH is ":/usr/lib/jvm/java-6-openjdk- > amd64/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games". > > ----jGRASP: operation complete. what should i do please help


title: rsync and backup and changing timezone

text: I back up my pictures from my camera using rsync, using:                rsync -vzrtl --progress --stats --timeout=0 host destination      Now I was in a different timezone when I did my first backup then I moved to a different timezone and I changed it on my laptop (I use ubuntu 10.04.4). Today I was backing up my pictures and I found that the timestamp were different (I mean the timestamps you can see with 'ls -lt'), so rsync would copy the whole directory (I always run rsync with the option -n first to know the list of files it would transfer). Now this is just stupid, because the files are actually the same. So I changed back to the previous timezone, in fact the file timestamps changed to the same on my camera - this I find weird somehow. I run rsync again and the files are still different :@ Now, I don't want to copy the files again, this would be stupid, can you suggest a clean solution? How can I prevent this in the future? why the files are still different, if I changed to the previous timezone? * * * I found that the access and change time are different for the files, using stat. For example: on host                  File: `DSC00003.JPG'        Size: 3068392    Blocks: 6016       IO Block: 32768  regular file      Device: 821h/2081d Inode: 2109        Links: 1      Access: (0755/-rwxr-xr-x)  Uid: ( 1000/simona)   Gid: ( 1000/simona)      Access: 2013-03-26 00:00:00.000000000 +0000       Modify: 2007-12-25 22:48:20.000000000 +0000      Change: 2007-12-25 22:48:20.000000000 +0000      and on the destination                  File: `DSC00003.JPG'        Size: 3068392    Blocks: 6008       IO Block: 4096   regular file      Device: 802h/2050d Inode: 245762      Links: 1      Access: (0755/-rwxr-xr-x)  Uid: ( 1000/simona)   Gid: ( 1000/simona)      Access: 2013-03-26 10:24:49.000000000 +0000      Modify: 2007-12-25 22:48:20.000000000 +0000      Change: 2013-02-09 00:11:09.000000000 +0000      Is there a way to prevent rsync to overwrite pictures that have been modified more recently on the destination?


title: How do i move a pieces of data between two words if the data has a % percent symbol at the begining?

text: I have a log file looking somtheing like :               SWEs-elmPCI-A-01(config)#      class AutoQoS-VoIP-RTP-Trust                                    ^     % Invalid input detected at '^' marker.          SWEs-elmPCI-A-01(config)#      class AutoQoS-VoIP-Control-Trust                                    ^     % Invalid input detected at '^' marker.          SWEs-elmPCI-A-01(config)#      policy-map AutoQoS-Police-CiscoPhone     SWEs-elmPCI-A-01(config-pmap)#      Now i have to look for all the lines begining with `%` symbol between the lines containing hash `#` and put it into another error log file. if you consider the above then this should go into error log file.                  SWEs-elmPCI-A-01(config)#          class AutoQoS-VoIP-RTP-Trust                                        ^         % Invalid input detected at '^' marker.              SWEs-elmPCI-A-01(config)#          class AutoQoS-VoIP-Control-Trust                                        ^         % Invalid input detected at '^' marker.              SWEs-elmPCI-A-01(config)#


title: Why does yum continue to complain about a missing dependency that is already installed?

text: I have a self-created rpm for mapserver 6.2.1 that I want to support Oracle, but I am having a lot of difficulties getting it all to work. I have installed the oracle-instantclient12.1-basic-12.1.0.1.0-1.x86_64 as an rpm, and the sdk and sqlplus as zip files in my ORACLE_HOME. This seemed to be the only way to ensure the sdk files is at the correct location, for mapserver to recognize. So my mapserver rpm builds but when I try to install it on the build server, it complains:               Setting up Install Process     Resolving Dependencies     --> Running transaction check     ---> Package mapserver.x86_64 0:6.2.1-2 will be updated     --> Processing Dependency: mapserver = 6.2.1-2 for package: mapserver-perl-6.2.1-2.x86_64     --> Processing Dependency: mapserver = 6.2.1-2 for package: mapserver-python-6.2.1-2.x86_64     ---> Package mapserver.x86_64 0:6.2.1-12.el6 will be an update     --> Processing Dependency: libclntsh.so.12.1()(64bit) for package: mapserver-6.2.1-12.el6.x86_64     --> Running transaction check     ---> Package mapserver.x86_64 0:6.2.1-12.el6 will be an update     --> Processing Dependency: libclntsh.so.12.1()(64bit) for package: mapserver-6.2.1-12.el6.x86_64     ---> Package mapserver-perl.x86_64 0:6.2.1-2 will be updated     ---> Package mapserver-perl.x86_64 0:6.2.1-12.el6 will be an update     ---> Package mapserver-python.x86_64 0:6.2.1-2 will be updated     ---> Package mapserver-python.x86_64 0:6.2.1-12.el6 will be an update     --> Processing Dependency: libclntsh.so.12.1()(64bit) for package: mapserver-python-6.2.1-12.el6.x86_64     --> Finished Dependency Resolution     Error: Package: mapserver-6.2.1-12.el6.x86_64 (geodata)            Requires: libclntsh.so.12.1()(64bit)     Error: Package: mapserver-python-6.2.1-12.el6.x86_64 (geodata)            Requires: libclntsh.so.12.1()(64bit)     You could try using --skip-broken to work around the problem     You could try running: rpm -Va --nofiles --nodigest      Obviously libclntsh.so.12.1 is already installed through yum and located at the exact same spot as when the package was built. What am I doing wrong?


title: Getting cpu usage same every time.

text: When I execute following command to get cpu usage , I get nice + user cpu usage.               top -b -n1 | grep "Cpu(s)" | awk '{print $2 + $4}'       **Output:**               14.5      Here I am getting problem is that the output depends on top command thus it doesn't change instantly as top command. So I am not getting correct cpu instantly. It gives same output and not changing. I want to get realtime cpuusage in output. Please help me to improve my command.


title: selinux, dovecot and sieve

text: I've just started learning to configure SELINUX and this morning on my CentOS 6.4 x64 system, with postfix/dovecot/mysql installed, I woke up to the following selinux issue               found 1 alerts in /var/log/audit/audit.log     ----------------------------------------------------------------------------          SELinux is preventing /usr/libexec/dovecot/lmtp from write access on the directory sieve.          *****  Plugin catchall (100. confidence) suggests    ***************************          If you believe that lmtp should be allowed write access on the sieve directory by default.     Then you should report this as a bug.     You can generate a local policy module to allow this access.     Do     allow this access for now by executing:     # grep lmtp /var/log/audit/audit.log | audit2allow -M mypol # semodule -i mypol.pp     # semodule -i mypol.pp      When I run               grep lmtp /var/log/audit/audit.log | audit2allow -M mypol # semodule -i mypol.pp      I get               module dovecot 1.0;     require {             type dovecot_etc_t;             type dovecot_t;             class dir write;     }     #============= dovecot_t ==============     allow dovecot_t dovecot_etc_t:dir write;      and then when I run               semodule -i mypol.pp      I get               libsepol.print_missing_requirements: dovecot's global requirements were not     met: type/attribute dovecot_etc_t (No such file or directory).     libsemanage.semanage_link_sandbox: Link packages failed (No such file or directory).     semodule:  Failed!      This has worked for me in the past but it's stumped me this time :s. Can anyone push me in the right direction, please?


title: Make application listen to hosts under a different gateway

text: **Network Structure** A typical college network. Different Hostels connected through LAN. All hosts in a hostel use the same gateway. I can directly communicate to hosts in other hostels using their unique ip. **My query** I run Dota/Warcraft under Linux through Wine. For LAN games, Warcraft only automatically detects servers created by hosts using the same gateway (in my case, created by hosts in my hostel). For others, there is a tool called BattleLan where one can add the ip hosting the server and enables it to show up in Warcraft normally. Unfortunately, this tool doesn't work through wine. However, the concept seems simple to me and I believe can be easily implemented. I just need to make this application listen to port 6112 of some ip (right?). Any help/leads?


title: How to set jsse.enableSNIExtension to false when running Java programs?

text: I am trying to set the Java system property `jsse.enableSNIExtension` to `false`, but when I try running this `java` just outputs help information:               java -Djsse.enableSNIExtension=false       What am I doing wrong?


title: What is Arch Fallback in Arch boot menu?

text: What is exactly "Arch Fallback" in the **Arch** boot menu?


title: Compiling a simple character device driver as a module

text: I wrote a simple character device driver & wanted to cross-compile it for craneboard (ARM architecture). My file name is `gDev.c`. I copied the file to `kernel/drivers/char` directory in craneboard source. I modified the `Kconfig` file in that same directory & added the following lines to it.               config TEST_GCHARD         tristate "My Character driver"         default m      I added the following line to the Makefile in the same directory.               obj-$(CONFIG_TEST_GCHARD)   += gDev.o      I added the following line in the `am3517_crane_defconfig` in `arch/arm/configs` directory.               CONFIG_TEST_GCHARD=m      My problem is, when I set it as `m` in `am3517_crane_defconfig`, the file is not getting included for compilation. But, if I change it as `y`, it is getting compiled. But, I need it to be a module which I must `insmod` after board boots up. Please guide me whether I'm missing any steps.


title: Bash string concatenation used to build parameter list

text: Given this piece of bash:               PARMS='-rvu'     PARMS+=" --delete --exclude='.git'"     echo $PARMS     rsync ${PARMS} . ${TARGET}      The echo shows the PARMS string as expected, no error is displayed, but rsync silently acts as if the options added by the += did not exist. However, this works as expected:               PARMS='-rvu'     rsync ${PARMS} --delete --exclude='.git' . ${TARGET}      I guess I screwed something up with bash quotes (always had problems with those), but not exactly sure what and why are the options ignored even though the string seems to have been built correctly.


title: modify file ownership for files inside tar archive

text: I am working as user, and I would like to create a tar archive, which when unpacked (by root) will extract its files with root ownership (otherwise root would have to change the ownership manually for each file, after the files have been extracted to its destination). I have found `fakeroot` which seems to do exactly that. But i am not able to find the syntax which I need to use to create my archive. How can I create a tar.xz archive, so that the files have root ownership when unpacked by root?               do something with fakeroot ...     tar cfpJ foo.tar.xz foo/


title: Desktop appears as a terminal when viewed via VNCserver client

text: I have installed vnc server on a RHEL 6.5 machine using the following commands:               yum -y install tigervnc-server xorg-x11-fonts-Type1      and have made the changes to the `/etc/sysconfig/vncservers` file to add the user and set the password and adjusted the resolution. When I try to access the server via vnc client I am seeing something like this (NOT THE ORIGINAL IMAGE but a look alike) instead of the desktop: ![the desktop via vnc client](http://i.stack.imgur.com/TgSeX.png) I found an other issue which is relevant to the same issue, Why VNC not showing actual Remote Desktop, but was unable to understand from it how I can make it work on a RHEL 6.4 machine. Here is the snapshot of `/.vnc/xstartup`: ![](http://i.stack.imgur.com/uVNSC.png) ![](http://i.stack.imgur.com/6Wnd2.png)


title: How to merge output of two running log files in real-time

text: I have been analysing how a Linux USB driver works using two disparate methods:   1. examining the output of `usbmon`, which is a hex dump-ish view of what's being sent "on the wire".   2. adding `printk()` statements to the kernel driver module source and reloading it into the kernel. The output of these methods is available to me through `cat /sys/kernel/debug/usb/usbmon/1u` and `cat /var/log/kern.log` respectively. What I would now like to now do is merge these two files in real-time, so I can see the `printk()` logging messages I have inserted into the kernel driver interleaved with the lines of hex being sent across the wire. For example, I might put a `printk()` statement at the beginning and end of a piece of driver code that I know sends USB data, and I want to be able to view the hex (from `usbmon` that got sent in between, e.g. > Entering function sendImportantUSBData() // from driver code printk()   >  0a ff bbbb ac 0993 b3332 // from usbmon log   >  Exiting function sendImportantUSBData() // from driver code printk() I know `tail` can show the last `n` lines of a single file. I also know that the tool `multitail` can do some merging, though I didn't see any relevant details regarding timing sensitivity and what effect it has on merge line order accuracy. Is there an appropriate tool for what I have described that either `a)` does accurate merging of time-sensitive logs or `b)` allows one to specify a relatively small time interval for when merging should be done? In the latter case, I can probably insert sleep statements into the driver code at critical points to make sure the merging tool has time to read my `printk()` output before the driver moves onto the next USB transaction which would generate further hex from `usbmon`.


title: Naming the output of convert command and piping it to mail

text: Here is what I'm trying to do:               convert -strip -interlace Plane -gaussian-blur 0.05 -quality 85% -resize 35% 189_0538.JPG - | uuencode - img.jpg | mail -s "Some Picture" someid@somemail.com      The output of convert (Image Magick) should be named (file name) and it should be sent as a normal picture mail attachment. The above command does not work. EDIT1: The error that I get when I run the above command is:               uuencode: fopen-ing -: Unknown system error


title: SSH: "Connection closed by remote host" randomly while working on an interactive session

text: I am working on a remote server, on which I do numerical simulation using the OpenFOAM computational fluid dynamics library. I built a collection of Python scripts to automate my parametric studies and they seem to be working well. I connect to the server using SSH, and I launch the scripts in an interactive shell. Sometimes, under conditions I'm still unable to identify, the server closes the SSH session. I currently use the `screen` window manager as a workaround, but still seems like an issue to me. Here is an exemple of output I get:               <lots of output before that>     Dumping up_half1 faces to "final_up_half1.obj"     Dumping cyclic match as lines between face centres to "final_up_half0up_half1_match.obj"     Writing repatched mesh to 0          End          Killing PID 32536     Connection to hpc4 closed by remote host.     Connection to hpc4 closed.     ➜  ~      Please note that the simulation is not completed: after the termination of the application which print `End` on screen, another one should start and perform some treatments. So here's the question: What could be the cause of such disconnections?


title: Why did dd create a different uuid?

text: root@debian:/home/tiger# dd  if=/dev/sda  of=/dev/sdb  bs=10240k     11447+1 records in     11447+1 records out     120034123776 bytes (120 GB) copied, 4729.59 s, 25.4 MB/s     root@debian:/home/tiger# blkid     /dev/sda1: UUID="54AF-15B1" TYPE="vfat"      /dev/sda2: UUID="28D02E2FD02E03A2" TYPE="ntfs"      /dev/sda5: UUID="a3464de4-5676-4ae3-b37a-a1f40708d5ec" TYPE="swap"      /dev/sda6: UUID="8b29114c-4f89-4c96-b0c0-579ce58c7345" TYPE="ext3"      /dev/sdb1: UUID="54AF-15B1" TYPE="vfat"      /dev/sdb2: UUID="28D02E2FD02E03A2" TYPE="ntfs"      /dev/sdb5: UUID="a3464de4-5676-4ae3-b37a-a1f40708d5ec" TYPE="swap"      /dev/sdb6: UUID="d38e60d8-6bfe-49f9-a381-d89b3b9bbb7f" SEC_TYPE="ext2" TYPE="ext3"       Why doesn't `/dev/sda6`'s uuid equal `/dev/sdb6`'s? * * * **Edit** , answering questions from comments:   1. sda and sdb are same size disk   2. The output of `blkid -p` is:              root@debian:/home/tiger# blkid -p /dev/sda6       /dev/sda6: UUID="8b29114c-4f89-4c96-b0c0-579ce58c7345" VERSION="1.0" TYPE="ext3" USAGE="filesystem"


title: Why CRONTAB tasks are lost when quit Putty session?

text: I logged to remote computer, running under Solaris, using Putty and added some jobs to be run by _cron_. When I quit console and logged once again all jobs was lost.               crontab -l myuser      How do I persist jobs to be run even after I quit console?


title: Can I run Bash scripts in FreeBSD without modifying them?

text: Correct me if I'm wrong:   * "sh" script != "bash" script   * Linux script are written in Bash   * Bash script usually `#!/bin/sh`   * In GNU/Linux, `/bin/sh` is Bash   * In FreeBSD, `/bin/sh` is not bash, it's the true `sh` So if I want to use a Linux script in FreeBSD, and I run `./script.sh` in the shell, it will run the Bash script in "sh" and not Bash, since `/bin/sh` in FreeBSD is not Bash. Is there a way I could run those Bash scripts, without modifying it? So no modification to the `#!/bin/sh` statement in the script file to point somewhere else? I would like to run Bash script trough Zsh, if possible. Don't want to install Bash, and since Zsh can run Bash scripts...


title: How useful is Linux scripting?

text: I am a beginner user of Linux and have worked primarily with GUI. I am trying to move to intermediate level by learning the shell commands. In online Linux forums it's often the consensus that to be an advanced Linux user one should know scripting. I myself have no experience with scripting the OS and don't know what the hype is about. My understanding is that its just a convenient way for system admins to take backups by issuing a set of copy commands. Is this understanding correct? What type of advanced tasks are commonly performed using scripting? On the scale of 1 to 10, 1 being overrated hype and 10 being the magic potion for all your Linux woes, where does linux scripting stand?


title: merging LVM volume groups

text: **Situation:** I have a server with 4 1TB drives in LVM as shown below. The server is a openvz hardware node with a dozen or so openvz containers. At this time each container uses one disk only. This was designed at the time to maintain most control and separation over the disk io load.               # pvdisplay -s       Device "/dev/sdd1" has a capacity of 227.51 GiB       Device "/dev/sdc1" has a capacity of 427.51 GiB       Device "/dev/sdb1" has a capacity of 427.51 GiB       Device "/dev/sda2" has a capacity of 407.02 GiB      ATM each PV is set up with it's own separate VG:               # vgdisplay -s       "vg04" 931.51 GiB [704.00 GiB used / 227.51 GiB free]       "vg03" 931.51 GiB [504.00 GiB used / 427.51 GiB free]       "vg02" 931.51 GiB [504.00 GiB used / 427.51 GiB free]       "vg01" 931.02 GiB [524.00 GiB used / 407.02 GiB free]      A number of LV's exist over these VG's:               # lvdisplay | grep Name       LV Name                /dev/vg04/swap       VG Name                vg04       LV Name                /dev/vg04/vz       VG Name                vg04       LV Name                /dev/vg03/swap       VG Name                vg03       LV Name                /dev/vg03/vz       VG Name                vg03       LV Name                /dev/vg02/swap       VG Name                vg02       LV Name                /dev/vg02/vz       VG Name                vg02       LV Name                /dev/vg01/swap       VG Name                vg01       LV Name                /dev/vg01/root       VG Name                vg01       LV Name                /dev/vg01/vz       VG Name                vg01      **Problem:** One container has now grown to a size where I need to split it over two disks in order to handle the load. Essentially I'd like to merge two LV's - /dev/vg03/vz and /dev/vg04/vz into one LV striped over two disks. How do I best accomplish that? Would vgmerge be able to do this? The manpage for vgmerge is rather brief and I've not been able to find any more in-depth discussion of it's use. In the end I could accomplish the objective by moving things around but there is a lot of data in play and these are production servers so I'd rather try to avoid that if possible.


title: Synaptics two-finger-tap right-click happens on non-tap

text: Pardon the horrendous title, I'm not exactly sure how to summarize the issue I'm having. Basically, I have synaptics, and I right-click by tapping two fingers on the touchpad because my touchpad doesn't have any buttons. This is great, but I get all sorts of extra right-clicks because unlike left-clicking (tapping with a single finger), the right-click doesn't require the contact to be brief. Left-click (single-finger) requires the tap to be a tap, i.e. if I put a finger on the touchpad, leave it there for a moment, and then raise it, it is _not_ a click. That's great. Right-click (double-finger) does not require a tap, i.e. if I put two fingers on the touchpad, leave them there for a moment, and then raise them, it _is_ a right click, thrown when my fingers leave the touchpad. This is a problem. It's especially annoying because I use two-finger scroll, so I get random right-click events if I didn't scroll enough, or was going to scroll then decided not to, etc. How could I go about fixing this?


title: Why is apt filling up disk space that `apt-get clean` frees?

text: Every now and then I've to run `apt-get clean` on some small systems I manage I want to free up some disk space and `apt` is slowly filling up my disk. A `apt-get clean` often releases 700 mb of disk space. Why is `apt` filling up my disk. I rarely use `apt`, so it are no my actions that make `apt` filling disk space. Some systems are not even connected to the Internet. How do I stop `apt` from filling up my disk?


title: Colors for menu bar and the scroll bar on emacs 24

text: I'd like to change the colours of the menu bar and the scroll bar of emacs 24. The instructions of EmacsWiki (the above links) do not work. This might be because I am using emacs 24. According to the page ColorTheme on EmacsWiki, emacs 24 has a new colour system, so I tried some colour themes and to modify them. (Menu bar→Options→Customize Emacs→Custom Themes) But I could not find the faces which I should customise. **Could you tell me how to change the colours of the menu bar and the scroll bar of emacs 24?** Environment: openSUSE 12.3, KDE 4.10.5, Emacs 24.2.1 (x86_64-suse-linux-gnu, GTK+ Version 3.6.4)


title: Recursive wget eventually starts failing with "Unable to resolve host" / "Temporary failure in name resolution"

text: When recursively `wget`-ting a fairly large site, after downloading 18 MB or so, `wget` starts complaining "Unable to resolve host" and/or "Temporary failure in name resolution", even though I can look up the host just fine with `host` or `dig`. On the advice of various fora, I tried:   1. commenting out the `hosts` line in `/etc/nsswitch.conf`   2. replacing potentially dodgy nameservers in `/etc/resolv.conf` with Google's `8.8.8.8` and `8.8.4.4`   3. explicitly adding the name to `/etc/hosts` It doesn't seem to matter whether or not I set `\--no-dns-cache` in the `wget` command line; the same thing happens. I can't tell if `wget` is eventually going to finish, or if it's going to stay stuck in this state. It'd be nice if it finished, since I need it to `\--convert-links`. I'm running `wget` 1.11 (compiled from source, because 1.12 and later have broken the behavior of `\--no-clobber` with `\--convert-links`, at least for my purposes) on a Linux Mint 14 system. What causes this? Is there a way to fix it?


title: In Unix speak what is the difference between a shell script and an executable?

text: I have seen this question on this site and this prompted me to ask this question . I want to know in Unix speak what is the difference between an executable and a shell script ?


title: Difference between environment variable and shell variable

text: It is said that environment variables are inherited in child processes but shell variables are not. However the following test shows shell variables are seen in child process just as environment variables. What is the difference?               > bash --version     GNU bash, version 3.2.39(1)-release (x86_64-suse-linux-gnu)     Copyright (C) 2007 Free Software Foundation, Inc.     > export TEST="ENV_TEST"    #env var     > sh -c "echo \$TEST"     ENV_TEST     > TEST="SHELL_TEST"         #shell var     > sh -c "echo \$TEST"       #shell var is seen in child process     SHELL_TEST


title: Shell script fails: Syntax error: "(" unexpected

text: I've been working on a script that automates setting up a development environment for Raspberry Pi development (step by step details that work are here). The script is linked in that article but convenience you can find it here also. Now when run this script install and sets up the environment without error but you have to enter your sudo password more than once due to sudo's time-out value by default. So I started experimenting by removing all the sudo lines and running the whole script via sudo at the command line like so:               kemra102@ubuntuvm:~$ sudo ./pi_dev_env_install.sh      This works fine as expected and gets most of the way through until this point:               ./pi_dev_env_install: 68: ./pi_dev_env_install.sh: Syntax error: "(" unexpected      Now this line worked fine previously when not running the whole script with sudo. There is nothing about this line running as sudo that should stop it working to my knowledge, does anyone have any ideas?


title: Indicate mute/unmute with i3status

text: Is there a way to indicate if the sound is set to mute or not using `i3status`? I know how to show the volume (as explained in `man i3status`), but it doesn't distinguish between mute or just 0% volume.


title: Trying to "locate" and then open a file

text: Suppose that I have a file named `filename123.txt` and it is the single file that is named so, and I can `locate` it with the command `locate filename123`. And it returns only this file. Now I want to open it with `vi`/`vim`. But I don't want to go to that location and type the `vi` command followed by filename. Here I want the result of `locate filename123` to be appended to the vi command. How can I do so? I already tried:               locate filename123 | vi      But this does not works. And this error comes in terminal:               santosh@santosh:~$ locate filename123 | vi     Vim: Warning: Input is not from a terminal     Vim: Error reading input, exiting...          Vim: Finished.                         santosh@santosh:~$


title: How to restore GRUB after windows XP installation?

text: After I've installed windows xp for dual booting, I need to restore grub of my archlinux installation. I did it a lot of times with windows 7, but this time heavens decided to torture me. I have opensuse liveKDE usb drive inserted into my laptop. My currect drive is /dev/sda with /dev/sda1 -> archlinux /; /dev/sda2 -> /home; /dev/sda3 -> windows xp. In liveKDE konsole I mount my /dev/sda1 to /mnt/arch, chroot /mnt/arch /bin/bash and run grub. Trying root (hdX,Y) I get "selected disk does not exist". So I try grub-install /dev/sda, which gives me "Not found or not a block device". I have tried other variants like grub-install.unsupported /dev/sda, which gave me "/dev/loop0 does not have any corresponding BIOS drive", arrrr! I'm out of options here, does anybody have an idea of some competent liveCD to start with. I tried Super Grub Disk, didn't work cause it froze all the time. Tried Rescatux but it does not have grub available in terminal.


title: Route VPN traffic through socks proxy

text: There is no way to set proxy on an unrooted Android, but there is an option to connect to VPN. In my network VPN connection is not allowed! so I am looking for a way to run a local VPN server on my computer and route it's traffic through a socks proxy (in a way that when I connect my android device to this VPN all my traffic routed through this socks proxy). What's the options?


title: Does my Ubuntu have module for USB 2.0?

text: I copy some files between my external HDD and Lenovo T400 laptop. The external HDD is 7 years old and has "USB 2.0" on its enclosure, and the laptop is 3 years old. The copying speed is mostly 8.3MB/sec, and no more than 10MB/sec. I wonder if there is module for USB 2.0 loaded? If not, how shall I get one? The output of `lsmod | grep hci` is               firewire_ohci 40172 0     firewire_core 56906 1 firewire_ohci.       I guess both are about firewire not USB. Note `lsmod | grep HCI` returns nothing. Thanks!


title: Convert formatted dates to seconds since the epoch

text: I have a file:               pablo tty8 Thu Nov 1 12:51:21 2012 still logged in      (unknown tty8 Thu Nov 1 12:50:57 2012 - Thu Nov 1 12:51:21 2012 (00:00)      pablo tty2 Thu Nov 1 12:50:39 2012 still logged in      pablo tty7 Thu Nov 1 12:49:45 2012 - Thu Nov 1 12:50:56 2012 (00:01)      (unknown tty7 Thu Nov 1 12:34:32 2012 - Thu Nov 1 12:49:45 2012 (00:15)      I want to replace the file in the above date for a second. I want to print:               pablo tty8 1351770681 still logged in      (unknown tty8 1351770657 - 1351770681 (00:00)      pablo tty2 1351770639 still logged in      pablo tty7 1351770585 - 1351770656 (00:01)      (unknown tty7 1351769672 - 1351770585 (00:15)      I tried this command:               gawk --posix 'function my()     {"date -d \047"$0"\047 +%s" | getline b;      gsub( /[A-Za-z]{3} [A-Za-z]{3} [0-9] ([0-9]{2}:){2}[0-9]{2} [0-9]{4}/,b );print}     { my() }' file      The above command does not work:               $ gawk --posix 'function my()     > {"date -d \047"$0"\047 +%s" | getline b;      > gsub( /[A-Za-z]{3} [A-Za-z]{3} [0-9] ([0-9]{2}:){2}[0-9]{2} [0-9]{4}/,b ); print}     > { my() }' ta     date: błędna data: `pablo tty8 Thu Nov 1 12:51:21 2012 still logged in '     pablo tty8  still logged in      (unknown tty8 1351897200 - 1351897200 (00:00)      date: błędna data: `pablo tty2 Thu Nov 1 12:50:39 2012 still logged in '     pablo tty2 1351897200 still logged in      date: błędna data: `pablo tty7 Thu Nov 1 12:49:45 2012 - Thu Nov 1 12:50:56 2012 (00:01) '     pablo tty7 1351897200 - 1351897200 (00:01)      (unknown tty7 1351897200 - 1351897200 (00:15)      How to improve the above command?


title: Mutt scripting: interactive dialog macro using `dialog`

text: I would like to do the following:   * Press a macro combination   * Enter a script of my own making (Python) which has user interaction (think: UNIX `dialog` utility for shell scripts)   * Do some processing based on the dialog response   * Run some _other_ `mutt` macro based on the dialog response (e.g. if X, do Y; else do Z) Is this possible?


title: Trouble RDPing to Windows 7 Service Pack 1 from Remmina Remote Desktop

text: After adding Service Pack 1 to my work computer, I get permissions errors when trying to RDP to work. I have no issues if I'm using the Microsoft Remote Desktop client. I'm using Ubuntu 10.10 with Remmina Remote Desktop (I'll add the version when I get home, whatever is default in the base repository). Remmina (which is really nice, btw) uses FreeRDP. I can't seem to find any other reports of this. Anybody have an suggestions? Here is the screenshot (edit: not enough rep to post image, transcribed). And yes, I ignored the fact that it works on the MS client and checked that the permissions it asks for were fulfilled. > To log on to this remote computer, you must be granted the Allow log on > through Terminal Services right. By default, members of the Remote Desktop > Users group have this right. If you are not a member of the Remote Desktop > Users group that has this right, or if the Remote Desktop Users group does > not have this right, you must be granted this right manually. I really don't want to reboot into Windows 7 or run a VM just to RDP to work. Thanks in advance.


title: How to move rc.conf HARDWARE section to /etc/modules-load.d/?

text: I've just begun moving my Arch system to systemd, and started by moving the deprecated parts of rc.conf to their respective configuration files. The rc.conf wiki article lists files for most options, and I assume I should just move the relevant lines from rc.conf to those files. But what about the HARDWARE sections? A directory is listed there: /etc/modules-load.d/.


title: Overriding the shade of color displayed

text: I have to work on systems which display some colors that are hard to read. I ssh into these systems, but don't have _management permission_ to change the colors they display. Is there any way I can override the shade's of colors in my terminal emulater? (I use `konsole`)


title: How to get size of a block special file?

text: I need to be able to determine the size of a block special file. For example, given `/dev/sda`, I need a command that will provide the size of the device. (By size I mean capacity, since this is a storage device.) * * * **Rationale:** I can store information in the device with:               echo "12345" >/dev/sda  # needs to be run as root      _(Don't run that command by the way... unless you don't care about your data.)_ However, I need to know how much data I can store on the device and I don't know how to do that.


title: How to escape a Whole Variable?

text: In the answer of thisquestion: https://superuser.com/questions/163515/bash-how-to-pass-command-line- arguments-containing-special-characters It said that we have to put an arg of a function in Doublequotes to escape the entire argument (as in `"[abc]_[x|y]"`). But what if the special character is `"` at the start (`"[abc]_[x|y]"`), we can't do the following:               program  ""[abc]_[x|y]"  anotheragument      How can I escape the `"` in this case?


title: How to configure Ethernet in Gentoo on s390x?

text: I've booted from SLES 10 SP2 CD and installed Gentoo. Now I'm trying to make Ethernet work (it is working in SLES). I found this document, but in current kernel (2.6.38.2) sysfs layout is some different, for example, there is no `parameters` file in qeth device directory, but it have separate file `portname`. After `echo 0.0.0100,0.0.0101,0.0.0102 > /sys/bus/ccwgroup/drivers/qeth/group` sysfs contains new directory `/sys/devices/qeth/0.0.0100` with few files and directories inside. File `portname` contains "no portname required". But when I'm trying to write 1 to file `online` it says:               -bash: echo: write error: No such device      I also tried to write "OSAPORT" to `portname`, 0 and 1 to `layer2` with no success. I still can not create `eth0` interface. What am I missing and how to corretly make `eth0` configured at boot time in Gentoo?


title: grub-install from live CD

text: I have removed my MBR by mistake. Now I can't boot Ubuntu, so I want to reinstall grub. I'm getting this error:               grub-install --boot-directory=/media/cab64688-2d97-4bbd-9f32-7bc0badb40a8/boot /dev/sdb     rm: cannot remove `/media/cab64688-2d97-4bbd-9f32-7bc0badb40a8/boot/grub/915resolution.mod': Read-only file system      So, the problem is that my existing Ubuntu partition is mounted read only. When I try:               sudo mount /dev/sdb7  /media/ubuntu_mpt     mount: block device /dev/sdb7 is write-protected, mounting read-only      So I failed to install grub since I'm in read only mode. Any ideas? **EDIT:** After apt-get install grub, I repeated the process and got:               Probing devices to guess BIOS drives. This may take a long time.     Unknown partition table signature     sed: can't read /media/cab64688-2d97-4bbd-9f32-7bc0badb40a8_/boot/grub/device.map: No such file or directory     grep: /media/cab64688-2d97-4bbd-9f32-7bc0badb40a8_/boot/grub/device.map: No such file or directory     /dev/sda does not have any corresponding BIOS drive.


title: How to inject keystrokes via a shell script?

text: I'm trying to inject keystrokes into the input daemon so as to simulate typing from a Bash script. Is this possible, and if so, how can I make it happen?


title: How to give apache web directory access to other FTP user where parent directory is restricted

text: I tried hard but not able to give access of web directory to other user for FTP. Below are the directories which are under directory `/var/www/html`               1) nice_call     2) poor_call     3) great_call      /var/www/html is owned by apache user as well as all above mentioned directories is also owned by apache. I just want to give read+write access to one more user named as `ftp_user` for directory `poor_call` not for other directories. I am also ready to give 777 access to directory `poor_call` to resolve this issue. Please note that I am having root access to execute any command to resolve this issue.   It will be great if someone can help on it.parent-directory


title: SFTP with Mysql user pass instead of PAM

text: Is there a way for people to log onto a debian server via sftp using just mysql database table as authentaction. IE not adding a user to the system? I know it can be done over ftp and TLS but i really dont want to use that method Thanks


title: symbolic link to a large file

text: I have a large(1 TB) file that I would like to download from the centos server via http, should I create a symbolic link to the file to the http file directory? would the link work? the file is too large to be copied over given the server hdd. if not, what are the alternatives?


title: Change size of system console as user

text: At uni, I'm using a terminal to log into a text console of some unix server. As the monitors are 17" and the console is displayed full screen, it's a bit annoying to look at the screen with the default column and row size. Is it possible, as a user, to change the size of the console, either by increasing the number of rows & columns or by even decreasing the used resolution if the monitor (i.e. adding an unused border around it)?


title: what is the difference between X11 and Xlib?

text: I am not sure if I have got it right. Xlib is a library to interact with X server. X11 is just another name for X server. Is X server just a single library? if so, why we can't access it directly? why we need Xlib? Thanks in advance


title: Why can't I run GUI apps from 'root': "No protocol specified"?

text: I installed debian onto my machine last night. Now, I don't understand why I can't run GUI apps from a terminal when running as root. For example:               sudo -i     glxgears      Generates the following output:               No protocol specified     Error: couldn't open display :0      But when I first open the terminal I can run `glxgears` from the user account. Its only after I do `sudo -i` that the problem crops up. This happens for any GUI app that I try to run. I think its probably related to X11, but I'm not sure.


title: How to list all the files which were not created on Thursday

text: I need to delete old backups but I only want to keep Thursday Backups and delete the rest of the backups. Give me some kungfu tips. I'm on RHEL if that makes a difference.


title: Cant create encrypted partitions during Debian installation

text: I am using debian 7.4 cd. When I set a partition as '/' during manual partition.It is fine. However when I then try to use it as 'physical volume for encryption'...everything works fine it erases and writes random data BUT THEN mount point '/' disappears! . And when I try to proceed with installation,it says "NO root file system is defined.Please correct this from partitioning menu" And when I try to make '/', I cant modify the partition to be used as '/' because it says-"No modification can be made.In use as physical volume for encrypted volume" I am following these instructions:http://www.debianuserforums.org/viewtopic.php?f=9&t=460


title: Best usb boot drives for Linux?

text: I am looking for a buyer's guide on usb boot drives that will be used for booting Linux distros. Specifically, I have the following concerns:   * Should I opt for USB 2.0 or 3.0?   * Are there size limitations, like 2GB vs 8GB vs 16GB?   * Are there specific brands to favor or avoid? (ie formatting issues)   * Does the physical style have any affect? Any other considerations are more than welcome. I have been considering the Kingston Digital DataTraveler SE9 16GB USB 2.0 in particular. I will likely be using UNetbootin to add the distros. This will be used to explore new distros and portable booting.


title: VPN error 619 - "A connection to the remote computer could not be established."

text: Have been trying to get this PPTP VPN working on a CentOS 6 x64 VPS for a few days but im getting: > "Error 619 - A connection to the remote computer could not be established." I did research on Google and most of the time it was due to routers not allowing VPN passthrough or whatnot, however I have another CentOS VPS setup exactly the same (used the same guide to set it up) and it works perfectly.. I did find some error messages in the "/var/log/messages" log that I looked up on Google but couldn't find any results on how to fix it. Hopefully someone else could help me out with this. > Mar 8 20:14:50 direct pppd[1507]: pppd 2.4.5 started by root, uid 0   >  Mar 8 20:14:50 direct pppd[1507]: Using interface ppp0   >  Mar 8 20:14:50 direct pppd[1507]: Connect: ppp0 <--> /dev/pts/1   >  Mar 8 20:15:20 direct pppd[1507]: LCP: timeout sending Config-Requests   >  Mar 8 20:15:20 direct pppd[1507]: Connection terminated.   >  Mar 8 20:15:20 direct pppd[1507]: Modem hangup   >  Mar 8 20:15:20 direct pppd[1507]: Exit.   >  Mar 8 20:15:20 direct pptpd[1506]: GRE: read(fd=6,buffer=611860,len=8196) > from PTY failed: status = -1 error = Input/output error, usually caused by > unexpected termination of pppd, check option syntax and pppd logs   >  Mar 8 20:15:20 direct pptpd[1506]: CTRL: PTY read or GRE write failed > (pty,gre)=(6,7)   >  Mar 8 20:15:20 direct pptpd[1506]: CTRL: Client 76.177.167.162 control > connection finished It seems to be working correctly up until "LCP: timeout sending Config- Requests"


title: Does named pipe modify the filesystem?

text: As title. If I create a named pipe and then read/write on it, is the filesystem where the named pipe resides affected? I.e. is the data buffered on the filesystem until read, or does it reside in memory only?


title: Fedora won't start after update

text: About 1 month ago I installed the newest version of Fedora, so that I had both Windows and Fedora on one machine. Today it showed me that update are available and I should restart. After installing the updates Fedora tried to boot again, but unfortunately it won't start anymore: After the loader (fedora logo) I only get a black screen instead of the login. The same happens when I chose "Fedora rescue". Fortunately Windows still works. Update: My graphic card is AMD Radeon™ HD 5000 Series.


title: .forward file username and folder separator

text: I found (I'm learning how e-mail works) a `.forward` file in a user home folder; emails should be forwarded to mailboxes of other users. Email addresses are written in `user+folder` addressing notation, but instead of a `+` sign I found `-` sign; if I would like forward a spam message to Spam folder of a `user` I would write `user+Spam@domain.com`, but I found `user- Spam@domain.com`. The file contains email addresses in form: This is an email server using Postfix.               user1-folder@domain.com`      user2-folder@domain.com       userN-folder@domain.com      Is there any difference?


title: Setting up diskless workstation for multiple clients

text: I have mostly everything working except I'm not sure how to handle /var. If I set R/W on the kernel parameter, everything works as expected.               append initrd=/images/fedora/initrd.img-2.6.38-8-generic.nfs root=/dev/nfs rw nfsroot=10.129.1.113:/admin/linux/fedora/root      However, I don't want that, I want each workstation to have its own `/tmp` and `/var`. What options do I have? The issue I'm currently facing is that Ubuntu is expecting existing directories inside `/var/lib`. I've added a line in my fstab for `/var/lib` but since it's not already there, Gnome refuses to boot. Here's my `fstab` file.               proc            /proc           proc    defaults        0       0     /dev/nfs       /               nfs    defaults          1       1     tmpfs       /dev        tmpfs   defaults    0   0     tmpfs            /tmp            tmpfs   defaults        0       0     tmpfs           /var/run        tmpfs   defaults        0       0     tmpfs            /var/lock       tmpfs   defaults        0       0     tmpfs           /var/tmp        tmpfs   defaults        0       0     tmpfs           /var/log        tmpfs   defaults        0       0     #tmpfs           /var/lib        tmpfs   defaults        0       0


title: Remind syntax combining a weekly event with a time range

text: How should I write "Every Tuesday, Thursday, Friday after 2011 Sep 13, but before Sep 28, with reminder 1 day before event". Now I got `REM Tue Thu Fri 13 Sep 2011 +1 UNTIL 28 Sep 2011 MSG Esem`, but it doesn't seem to work correctly.


title: Can't boot after installing FreeBSD in VMware Workstation

text: I'm trying to install FreeBSD 9.1-i386 in VMware Workstation. I'm following the guide in the manual on freebsd.org to do this. When I come to the partitioning part I use the guided setting and it looks as following: ![enter image description here](http://i.stack.imgur.com/y1pYv.png) After this I commit the changes and it passes all the checksums. After this it reboots, I don't know if this is normal behavior or not but I think so. Anyway, when it tries to boot I get the error below. I tried to solve it based on something I found online but it didn't work: ![enter image description here](http://i.stack.imgur.com/bp5Xy.png)


title: .screenrc setting to make the silence notification to stay

text: Is there an option for .screenrc file so that the silence message ``<c-a>`_` stays on the terminal until I press any keyboard button?


title: How do I pass a list of files to grep

text: I am using `find` and getting a list of files I want to `grep` through. How do I pipe that list to `grep`?


title: Does mkswap check that a partition is a swap partition before formatting it?

text: I checked the man page for mkswap and was left confused whether mkswap tests whether a partition is of type 82 before formatting it. Background: I am using Ubuntu 11.04, and I had just set up my swap partition to be encrypted, using ecryptfs-setup-swap, which adds a reference to the encrypted swap partition to /etc/fstab and to the actual partition to /etc/crypttab. The actual partition is referred to by the device name, /dev/sdb1 in my case. If I understand correctly, during boot, the virtual partition is created and formatted as a swap partition, generating a new UUID each time, so it cannot be specified by UUID. This leaves me concerned that if I install a new hard drive or otherwise rearrange the physical drives, mkswap would try to format the wrong partition. If it fails because the partition isn't a swap partition, then no problem, as swap is rarely used. If it succeeds in formatting the wrong partition, then big problem.


title: Mirror RHEL repositories

text: I'm attempting to install Spacewalk 1.8 with mrepo and create a mirror of RHEL 5&6 packages to use for frequently spun up development VMs. There are several guides that indicate I should use mrepo with gensystemid to register individual repositories as systems on RHN and then use the entitlements granted to my rhel systems. However gensystemid fails because /usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT is not present. It's not clear to me where I get this cert, whether it is included with an official rhel install, or if it is pulled in after using rhn_register, or if this the "key" per se that you purchase with the Satellite product that allows you to mirror? Several unhelpful how-to's say it's included with CentOS and it is not, nor is it present in rhn-tools rpm.


title: CentOS restore firewall after `service iptables panic`

text: My friend and I were doing some firewall configurations and in the meanwhile he thought it was a good idea to type `service iptables panic`. Now we cannot put the firewall back on the original state (default). It blocks all connections. We have tried everything:               iptables -F service      iptables save service      iptables stop service      iptables start etc....      What can we do to restore original and clean firewall configurations?


title: Eval command in unix

text: Can someone convert this code? I got this from the web. I am new on this and don't know how `eval` works. Originally, there is a parameter from a command that is either a plus (+) sign or a minus (-) sign. But since I only need now the addition (its not in the parameter anymore), I want this to do addition automatically.               -|+) eval '(('jd2=${jd1}${5}${6}'))'     jd2date $jd2      Pardon if the way I am asking is confusing.


title: How do I resolve the following error during "configure: error: XSLT configuration could not be found"

text: When compiling Icecast 2, I get this error when I run `autogen.sh`:               $ autogen.sh     ... stuff ommitted     configure: error: XSLT configuration could not be found      What is the reason for it, and how do I fix it?


title: What does this error mean: "igmp[1435]: setsockopt IP_MSFILTER"?

text: My network connection is pretty crappy today so I looked at my router (TP-LINK TD-W8950ND) logs and can see these entries a few times every minute:               Date/Time   Facility    Severity    Message     Sep 7 22:26:16  user    notice  igmp[1435]: setsockopt IP_MSFILTER      This router runs on some kind of *nix kernel, so maybe this looks familiar to someone. I wonder if it has anything to do with my poor connection?


title: Interrupt process in samba share mounted folder breaks mount

text: I can successfully mount a Samba share on a local folder in Opensuse 12.1:               sudo mount -t cifs -o username=<username>,password=<password> //<win-box>/<share> <mountpoint>      The problem comes if i interrupt (`^C`) for example a long `cp` process in `<mountpoint>`: I get               > cp -r BIG_FOLDER/ /tmp     ^C     > ls     ls: reading directory .: Permission denied      The only solution I found is to `sudo umount <mountpoint>` then mount again. Any advice is welcome!


title: ssh tunnel on ssh tunnel between Windows and two Linux machines

text: I have the following configuration and want to establish a tunnel on a tunnel. I read already the following topic: How to put a tunnel in a tunnel? My configuration:               Notebook --> Linux Server A --> Linux Server B      Notebook: Windows XP with putty   Linux Server A and B: Ubuntu 10.10 I have a ssh connection with a tunnel from my notebook via putty to Server A. Now I want to establish a tunnel from Server A to B, so that I can connect with an IDE directly to my jboss on Server B. This is the command I tried on Server A to establish a tunnel:               ssh -t -L 8080:localhost:8080 Server B -p 8822      This won't work. Anybody an idea how to establish a working tunnel?


title: How to enable SSD TRIM support on Fedora 17?

text: I used to install Linux on HDD. It's easy. But now I have a SSD, and I want to install Fedora 17 on it. What should I do to make Fedora 17 issue TRIM commands to the SSD?


title: Cisco AnyConnect on Fedora

text: I have downloaded the setup for Cisco AnyConnect client from our client's secure web URI. This setup script was for 32 bit machine while mine is a 64 bit one. However, I managed to install the client installing 32 bit dependencies of the AnyConnect. However, now when I try to connect to VPN location, it prompts me for `"Warning: The following Certificate received from the Server could not be verified:"` and provide two options `Disconnect or Accept`. I am accepting that certificate but still AnyConnect is continuously prompting me for this certificate accpetance and after some tries it errors out to be "Timed Out". What can be the reason?


title: How to average time commands?

text: I am `time`ing some of my commands. Now to average the measures, I'd like to run and time my commands a specified number of times, and get the results with a calculated mean and standard deviation. The result would be like:               avgtime -n 100 my_command          real    0m5.388s stdev 0m0.068s     user    0m5.380s stdev 0m0.067s     sys     0m0.004s stdev 0m0.000s      Is there a UNIX tool for this? Does GNU/Linux have one?


title: Exim4 as smarthost with SSL?

text: I want to use exim4 as a smarthost to send email using an smtp mail account over ssl. I've seen the hosts_require_tls option, but I need SSL and not TLS. How should I do this?


title: Make awk use bash with the system() command

text: Is there a way to make awk use bash instead of sh when running system commands using the `system()` call? I want to use some bash-specific features such as [[ ]] and < > string comparison operators:               gawk 'BEGIN {system("if [[ \"porc\" == \"porc\" ]]; then echo yes; else echo no; fi")}'     sh: [[: not found


title: Bash - Split the previous commands parameters

text: How would one parse the previous command in bash? **Example:**               root$ ssh foo@1.2.3.4     root$ echo !$ &>/tmp/foo.txt     root$ cat /tmp/foo.txt     foo@1.2.3.4      **Goal:**   Send just the ipaddress `1.2.3.4` to foo.txt * * * I've attempted to used awk, but have not found success               #doesn't work     cat /tmp/foo.txt |awk '{print $2,$3,$4}'       I've also attempted to parse out just the digits using sed               #doesn't work     sed 's/.//p' /tmp/foo.txt      sed 's/[0-9]//p' /tmp/foo.txt      **Considerations**   1.2.3.4 will always be a number between 0.0.0.0 and 255.255.255.255   The user name `foo` can be any length   foo@1.2.3.4 is _not_ necessarily the only parameter passed into ssh (eg.. ssh 1.2.3.4 -l foo) **Resources**   http://stackoverflow.com/questions/1733692/how-to-use-sed-awk-or-gawk-to- print-only-what-is-matched   http://stackoverflow.com/questions/2777579/sed-group-capturing   http://www.grymoire.com/Unix/Sed.html Update   **Further Clarification**   The end goal will be to create a function in my .bashrc that will allow me to easily remove a conflicting ssh key.               root$ ssh foo@1.2.3.4       #some big error message warning about man in the middle attack     root$ ssh-keygen -R 1.2.3.4