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

Get your external IP address

2009-11-04 1 min read Bash Linux

$ echo -e "GET /automation/n09230945.asp HTTP/1.0rnHost: whatismyip.comrn" | nc whatismyip.com 80 | tail -n1

  • <a href="http://www.commandlinefu.com/commands/view/3962/get-your-external-ip-address">View this command to comment, vote or add to favourites
  • <a href="http://feeds2.feedburner.com/commands/by/Marko">View all commands by <a href="http://feeds2.feedburner.com/commands/by/Marko">Marko

<a href="http://www.commandlinefu.com"><img src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/header-logo.jpg" alt="" align="bottom" />

by David Winterbottom (<a href="http://codeinthehole.com">codeinthehole.com)

<a href="http://feedads.g.doubleclick.net/~a/JcVSM9r0yMSf6O0G2eSK5vyQGsU/0/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/JcVSM9r0yMSf6O0G2eSK5vyQGsU/0/di" alt="" align="bottom" />
<a href="http://feedads.g.doubleclick.net/~a/JcVSM9r0yMSf6O0G2eSK5vyQGsU/1/da"><img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~a/JcVSM9r0yMSf6O0G2eSK5vyQGsU/1/di" alt="" align="bottom" />

<img src="http://blog.amit-agarwal.com/wp-content/uploads/img.zemanta.com/~r/Command-line-fu/~4/7xln2n56mnk" alt="" width="1" height="1" align="bottom" />

URL: <a href="http://feedproxy.google.com/~r/Command-line-fu/~3/7xln2n56mnk/get-your-external-ip-address">http://feedproxy.google.com/~r/Command-line-fu/~3/7xln2n56mnk/get-your-external-ip-address<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://www.computer-realm.net/how-find-computers-ip/">How to Find Out Your Computer&#8217;s IP (computer-realm.net) <div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/42c8d78f-7105-47fc-9f21-6df9065a21a3/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_e29.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related pretty-attribution">

Continue reading

Stop long commands wrapping around and over-writing itself in the Bash shell

2009-10-12 1 min read Bash

Stop long commands wrapping around and over-writing itself in the Bash shell

shopt -s checkwinsize

add the command either in /etc/profile or ~/.bash_profile so that this is available to your shell.

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

commandlinefu.com

by David Winterbottom (codeinthehole.com)

URL: <a href="http://feedproxy.google.com/~r/Command-line-fu/~3/_0MaJbX9Jvo/stop-long-commands-wrapping-around-and-over-writing-itself-in-the-bash-shell">http://feedproxy.google.com/~r/Command-line-fu/~3/_0MaJbX9Jvo/stop-long-commands-wrapping-around-and-over-writing-itself-in-the-bash-shell<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://www.slumpedoverkeyboarddead.com/2009/08/22/reading-multiple-files-with-bash/">Reading Multiple Files with Bash (slumpedoverkeyboarddead.com) <div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/75f993fa-150b-4fdb-9cf5-d69437b87521/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_e13.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related pretty-attribution">

Continue reading
Older posts Newer posts