5 Really Cool Linux Command Line Tricks To Solve Real World Problems

By | 02/08/2013

Command line is lot more than working inside the box. You can do amazing stuff with command line. In this article, we will focus on 5 real world problems/requirements and their solutions from Linux command line prospective. We will study new tricks and usage of useful scripts and command line utilities.

NOTEAll the examples are tested on bash shell (Ubuntu 13.04).

Amazing Linux command line tricks

1. Hidden e-mail ID trick

If you own a Unix/Linux blog and want to display your e-mail address in a way that there is no scope of it being misused by spammers then try the following trick (assuming e-mail address to be dummy@mylinuxbook.com):

First, run the following command :

$ echo dummy@mylinuxbook.com | tr a-z@. n-za-m.@

This should produce following output :


Now, to play cool, just display the following command on your blog :

echo qhzzl.zlyvahkobbx@pbz | tr a-z@. n-za-m.@

This is because whenever somebody will copy and run this command on Linux, he/she will get your e-mail ID as output.

$ echo qhzzl.zlyvahkobbx@pbz | tr a-z@. n-za-m.@

That’s cool, isn’t it? (Learn Linux tr command to decode this example)

2. Quick file sharing trick (Share one or more files)

If you want to share a file or folder from your current directory in your local network then you can quickly create a web server for this purpose. All you require is python installed on your system. Once Python is installed, this is what you have to do :

$ python -m SimpleHTTPServer

The above command will start a basic HTTP web server on port 8000 of your system. You can verify it by typing following in your web browser :


Here is a screen-shot of directory listing from my web browser :


So, other users on your network can easily download required files from your web server.

3. Quick file sharing trick (Share single file)

There exists a python script WOOF (Web Offer One File) through which a single file can be quickly shared across the local network. For a user, who wants to share and access files on a local network, all that is required is woof script (can be downloaded from here) and a web browser. Web browser is required because woof provides a URL as output and through that URL a user in the local network can fetch the required file.

Here is how you can run woof :

$ ./woof helloWorld
Now serving on

As you can see in the example above, I used woof script to transfer a file named ‘helloWorld’. In the output, woof returned a web URL. Now, the user who wants to fetch this file can type in this URL in a web browser and the file will be downloaded.

Here is the snapshot :



4. Youtube videos download trick

For command line lovers, the world is command line only. They want every work to be done from command line only. Recently we published an article on command line music players. Here we will describe a command utility through which you can download youtube videos from command line. The name of that command line utility is youtube-dl. All you require is python 2.6 or greater installed on your system.

Once youtube-dl is installed, all you need to do is :

$ youtube-dl http://youtu.be/7M-jsjLB20Y
 Setting language
 7M-jsjLB20Y: Downloading video webpage
 7M-jsjLB20Y: Downloading video info webpage
 7M-jsjLB20Y: Extracting video information
[download] Destination: 7M-jsjLB20Y.flv
[download] 100.0% of 1.99M at   30.68k/s ETA 00:00

So you can see that the command youtube-dl followed by a youtube URL was all that was required to download the video. Now you can open it with any command line video player like VLC and enjoy the video.

youtube-dl is a feature rich utility, you can also download video in another format. All you need to use is -f option of this utility. Here is what the man page of this utility has to say about -f option :

-f FMT, –format=FMT
Specify the video format (quality) in which to download the video.

For youtube.com, in particular, the meaning of the format codes is given as:

WebM video at 480p: 43
WebM video at 720p: 45
H264 video in MP4 container at 480p: 18
H264 video in MP4 container at 720p: 22
H264 video in MP4 container at 1080p: 37
H264 video in FLV container at 360p: 34
H264 video in FLV container at 480p: 35
H263 video at 240p: 5
3GP video: 17

For more options, see the man page of youtube-dl.

5. Command line Facebook access trick

Trick anyone by accessing facebook from command line. There exists a command line utility fbcmd through which you can access your facebook accounts. Obviously, you need to have PHP installed on your system for this utility to work. Once PHP is installed, download the script from here or here.

Once done, now run the script.

This is what I got when I executed the script :

$ ./fbcmd_update.php 

fbcmd update utility [version 3.0]


Preference file:                 [/home/mylinuxbook/.fbcmd/prefs.php]

Software development branch:     [master]
Software library destination:    [/usr/local/lib/fbcmd/]
Copy script to bin dir?:         [Yes]
Bin dir location:                [/usr/local/bin/]
Script name:                     [fbcmd]
Auto-restart when necessary:     [Yes]

Welcome!  This appears to be the first time running fbcmd_update.

To change any of the above settings, modify your preferences file
To change your preferences file location, set an FBCMD environment var.

Otherwise, The above default settings are fine for most users

To finish the installation:

   $ sudo php fbcmd_update.php sudo
   $ php fbcmd_update.php

Look at the last paragraph, it asks to execute these two commands to complete the installation. This is what I got when I executed these two commands :

$ sudo php fbcmd_update.php sudo

fbcmd update utility [version 3.0]


$ php fbcmd_update.php

fbcmd update utility [version 3.0]




fbcmd version: [none] --> [1.1]

Note: fbcmd_update.php is now at [/usr/local/lib/fbcmd/fbcmd_update.php]
so you can remove the old one at [/home/mylinuxbook/Desktop/fbcmd_update.php]

type fbcmd to begin

Installation is completed. Now, this is what I did :

$ fbcmd

Welcome to fbcmd! [version 1.1]

This application needs to be authorized to access your facebook account.

Step 1: Allow basic (initial) access to your acount via this url:


to launch this page, execute: fbcmd go access

Step 2: Generate an offline authorization code at this url:


to launch this page, execute: fbcmd go auth

obtain your authorization code (XXXXXX) and then execute: fbcmd auth XXXXXX

Then I typed the command :

$ fbcmd go access

This command opened facebook.com in my web browser and after logging in, this is what I got :


Once I pressed okay, I was redirected to a URL which said that this URL is your password.


I saved the URL and then executed the following command :

$ fbcmd go auth

and the following page opened :

fbcmd_save_login_infoHitting the generate button generated a code that is needed by the command line application. Then I executed the following command :

$ fbcmd auth [my-code]

and here what was displayed in output :

fbcmd [v1.1] AUTH Code accepted.
Welcome to FBCMD, Himanshu Arora!

most FBCMD commands require additional permissions.
to grant default permissions, execute: fbcmd addperm

So, seems like fbcmd is all set to run. Here is how I updated my status through this command line utility :

$ fbcmd FEED1 "Accessing facebook from Linux command line. :-)"

So, I used FEED1 command of fbcmd utility post a message. I confirmed it on my facebook page :


Here you go. A facebook post now is as easy as running a ‘ls’ command on prompt. Through this utility you can do a lot of facebook stuff. Visit this page for complete list of commands.



Sometimes you get bored of working on Linux command line, now watch STAR WARS on command line itself.

All you need to do is :

$ telnet towel.blinkenlights.nl

And the show begins :







2 thoughts on “5 Really Cool Linux Command Line Tricks To Solve Real World Problems

Leave a Reply

Your email address will not be published. Required fields are marked *