Creating Custom Linux Commands
This is a guest post by Taylor Douglass
The other day I ran across a script at shell-fu that generates a random quote from their website (here). I thought it would be useful to make this a command that I could execute at any terminal at anytime. Let’s get started.
First of all you are going to need links. If you don’t have links or are not sure if you do or not, fire up a terminal and type the following:
# sudo apt-get install links
Next navigate to your /bin folder and create the file
# sudo touch shell-fu
Make the file readable and executable
# sudo chmod +rx shell-fu
Now edit the file and add the code for retrieving the shell-fu quote (I use nano for this)
# sudo nano shell-fu
# links -dump "http://www.shell-fu.org/lister.php?random" | grep -A 100 -- ----
^O (writes the file from nano)
^X (exits nano)
You now have a custom command named “shell-fu” that you can type from anywhere and retrieve a random shell-fu quote.
Popularity: 5% [?]
Tagged with: cli • command line • HowTo • Linux • tips • tricks
Filed under: Linux
Like this post? Subscribe to my RSS feed and get loads more!













Mmm, it doesn’t work for me.
I get:
grep: —-: No such file or directory
I did pretty much the same thing. I made a program with C++, compiled it and put it in /bin. To my surprise it actually worked.
ilSignorCarlo: I don’t know what grep does (noob to linux), but i reckon sudo apt-get install grep might work for you.