A few weeks back I ran into a situation that required me to locate a data given a file with various variations of that data. I proceeded to grep for each form of the string (e.g., “teh”, “the”, “tte”) I could think of, but wasn’t getting the results I wanted. After a bit of poking [...]
Archive for 'UNIX Shell'
Every year or two I try to re-read manual pages and documentation about my favorite UNIX tools (bash, awk, sed, grep, etc.). Each time I do this I pick up some cool new nugget of information, and refresh my mind on things that I may have forgot. While reading through an article on sort, I [...]
Chris Dew wrote up a neat trick on how to recover files if deleted on Linux, yet still open by a process. This works on Solaris as well. =) $:~:uname -a SunOS somehost.com 5.10 Generic_127112-11 i86pc i386 i86pc $:~:echo “sup prefetch.net folks?” > testfile $:~:tail -f testfile &  17134 $:~:rm testfile $:~:ls /proc/17134/fd/ 0 [...]
So this may be a little basic, but I find myself using these two shortcuts quite a bit while at the shell. If you ever find yourself wanting to “reuse” the last argument in a command — for example, here I move a file from one location into /var/tmp and I want to “cd” into [...]
I was recently debugging an issue with a shell script, and noticed that the shell was exiting with an exit code greater than 100 when it received a SIGTSTP signal: $ cat test #!/bin/bash sleep 60 # Window one $ ./test + Stopped ./test Home:~ matty$ echo $? 146 # Window two $ kill -18 [...]
If you’re a frequent user of the bash shell, I would suggest taking a peek at the GNU reference guide next time you have a chance. There are a lot of cool built in functions/commands within bash that are pretty neat. To get an idea of what these built in commands are: $ ps PID [...]