bash
shell — one liner to selectively change case
2010/01/07
Today I had a hard time, I had a herculian task of converting the case of file to upper case. Well that’s not difficult :), I know. What made it difficult was the fact that not the whole …
Know when you will type :q in your term instead of vi(m), the alias will chewed you out.
2009/12/20
most simple solution is to alias :q like so: alias :q=`echo ”This is not vim”` but as someone suggested in commandlinefu, you can use tput to put some color and fun into this. …
Display a block of text with delineated by a start pattern and an end pattern
2009/12/18
Taken idea from commandlinefu.com The command will display a segment from the file from the start pattern to the end pattern. function viewsegment() { tail -n +`fgrep -n -m 1 “$1” $3 | …
View the newest xkcd comic.
2009/12/07
This function displays the latest comic from xkcd.com. One of the best things about xkcd is the title text when you hover over the comic, so this function also displays that after you close the comic. …
Insert a comment on command line for reminder
2009/12/05
<a href="http://blog.amit-agarwal.co.in/category/linux/">Bookmark this category Insert a comment on command line for reminder […] $ ls -alh #mycomment […] Comments can be …
bash colors
2009/11/16
For those of the terminal freaks, color is a bliss. But have you tried all the colors in the terminal. Today someone forwarded me a bash one liner for the same. Not sure where he got this from, anyway …
Linux xdg-open — replacement for start in windows
2009/11/05
if you want to open any document with the default document handler from the bash prompt or command prompt in linux then the simplest way to do that is use ”xdg-open”. This can also …
Using nullglob and dotglob in bash scripts.
2009/11/04
<a href="http://www.cyberciti.biz/faq/bash-shell-check-for-any-mp3-files-in-directory/">Use BASH nullglob To Verify *.c Files Exists or Not In a Directory has a nice explanation on …
On screen display of a command
2009/10/08
<a href="http://blog.amit-agarwal.co.in/category/linux/">Bookmark this category delay: 2d On screen display of a command. $ date|osd_cat This is very useful if you need to show someone …
Get list of git repositories from command line.
2009/10/04
Earlier I had posted a small blog on teamgit. The problem still is that you have to manually go to the git.kernel.org page and get the list of the repo’s that you can download. How about a …
Change user, assume environment, stay in current dir
2009/10/03
<a href="http://blog.amit-agarwal.co.in/category/linux/">Bookmark this category Change user, assume environment, stay in current dir $ su — user I’ve used this a number of …
Database of vulnurability at milw0rm.com – udpate and makeindex with cron.
2009/09/08
I am quite regular visitor of milw0rm and generally try to keep up with the vul’s. For doing this I wrote a small scripts rather set of scripts to keep myself update. Here’s what …