Get Examples for Bash Commands in Your Terminal

This one is by the great shell-fu, a website with many bash examples.

The following script is a powerful enhancement for the bash experience, and a great addition to the manpages, it allows you to query shell-fu for examples about almost any bash command you might want to use.

The following code is by shell-fu and is available here.

In order for this to work, you’ll need to have “lynx” – the command-line web browser. You can install it in Ubuntu with this command:

sudo apt-get install lynx

Here is the code:

Open a new file and type this:

1
2
3
4
#!/bin/bash
lynx -width=$COLUMNS -nonumbers -dump "http://www.shell-fu.org/lister.php?tag=$1" | \
sed -n '/^[a-zA-Z]/,$p' | egrep -v '^http|^javas|View Comm|HIDE|] \+|to Share|^ +\*|^ +[HV][a-z]* l|^ .*efu.*ep.*!$' | \
sed -e '/^  *__*/N;s/\n$//g' | \less -rX;

Save the file as sheg (or any other name, sheg stands for shell examples)

Now make the script executable:

chmod +x sheg

Now move the file to /usr/local/bin

That’s it, you can use the script like this:

sheg bc

Or

sheg sed

Enjoy


If you enjoyed this post, make sure you subscribe to my RSS feed!

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

No related posts.

Tags: , , ,

Thursday, February 26th, 2009 Bash

4 Comments to Get Examples for Bash Commands in Your Terminal

  • Jadu Saikia says:

    Nice one. useful link and script, thanks.
    I have some bash scripting work on my blog http://unstableme.blogspot.com. you might like it.

  • Amir Watad says:

    Thank you Jadu for the comment, I like the design of your blog. Will have a small journey there :)
    BTW, for the next time, prefix your url with http:// so it gets linkified (I already fixed it for you) ;)

  • Very nice tip, this one will come in handy quite a bit.

  • Amir Watad says:

    Hey Billy,
    Thanks for your comment. And good work in your website (I’m far from being a gamer though)

  • Leave a Reply

    my email
    my photo
    Hi,
    My name is Amir Watad. I have a BSc. in biomedical engineering from The Biomedical Engineering school , Technion , Israel, and a BSc. in electrical engineering from The Electrical Engineering school , Technion , Israel.
    I'm a Verification Engineer in Mellanox Technologies Ltd.
    I love Linux, the Command Line and the OpenSource Community.
    I used to write Poems (Arabic) when I was able to find time for this.
    February 2009
    S M T W T F S
    « Jan   Mar »
    1234567
    891011121314
    15161718192021
    22232425262728
    SEO Powered by Platinum SEO from Techblissonline

    Twitter links powered by Tweet This v1.7.4, a WordPress plugin for Twitter.