change the terminal title dynamically in X11

2010-01-09 1 min read Bash GNOME Linux

I was actually looking for this for quite sometime. Some years back in my bashrc was the proper setting for setting the terminal title when I did a cd, and I had completely forgotten how to do it. So today I searched quite a few commands the environment variables for doing the same and found it again.

Here it is (Just put this in your bashrc or bash_profile):

export PROMPT_COMMAND=’echo -ne ”\033]0;`pwd`”; echo -ne ”\007”’

Continue reading

shell — one liner to selectively change case

2010-01-07 2 min read Bash

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 file had to be converted but only selective lines containing the work important. Okay now that too is not so difficult, I thought. But again the file size was huge, it had some 9 million lines. So, I just thought of trying my skills of shell programming (dont have much of it anyway). So here’s what I did:

Continue reading

View the newest xkcd comic.

2009-12-07 1 min read Bash Linux

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.

$ xkcd(){ local f=$(curl -s <a href="http://xkcd.com/">http://xkcd.com/);display $(echo "$f"|grep -Po '(?<=")http://imgs.xkcd.com/comics/[^"]+(png|jpg)');echo "$f"|awk '/<img src="http://imgs.xkcd.com/comics/.?" title=./{gsub(/^.title=.|".?$/,"");print}';}

To get a random xkcd comic, I also use the following:

xkcdrandom(){ local f=$(wget -q <a href="http://dynamic.xkcd.com/comic/random/">http://dynamic.xkcd.com/comic/random/ -O -);display $(echo "$f"|grep -Po '(?<=")http://imgs.xkcd.com/comics/[^"]+(png|jpg)');echo "$f"|awk '/<img src="http://imgs.xkcd.com/comics/.?" title=./{gsub(/^.title=.|".?$/,"");print}';}

Continue reading

Insert a comment on command line for reminder

2009-12-05 1 min read Bash Linux

<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 used directly on the command line so I can save in the history a brief description of what command does.

* View this command to comment, vote or add to favourites * View all commands by vgagliardi

commandlinefu.com

by David Winterbottom (codeinthehole.com)

URL: <a href="http://feedproxy.google.com/~r/Command-line-fu/~3/_5hXsFUuAwc/insert-a-comment-on-command-line-for-reminder">http://feedproxy.google.com/~r/Command-line-fu/~3/_5hXsFUuAwc/insert-a-comment-on-command-line-for-reminder

bash colors

2009-11-16 0 min read Bash
\"People
Image via Wikipedia

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 here is the one liner for you all:

Continue reading
Older posts Newer posts