NOT – The Best 25 Linux Commands

Here is another installment of Command Line Gems, I present you with the “Not” The best Linux Commands.

1) Save an HTML page, and covert it to a .pdf file

wget $URL | htmldoc --webpage -f "$URL".pdf - ; xpdf "$URL".pdf &

Uses htmldoc to perform the conversion

2) backup and synchronize entire remote folder locally (curlftpfs and rsync over FTP using FUSE FS)

curlftpfs ftp://YourUsername:YourPassword@YourFTPServerURL /tmp/remote-website/ && rsync -av /tmp/remote-website/* /usr/local/data_latest && umount /tmp/remote-website

connect to a remote server using ftp protocol over FUSE file system, then rsync the remote folder to a local one and then unmount the remote ftp server (FUSE FS)

it can be divided to 3 different commands and you should have curlftpfs and rsync installed

3)  Do some Perl learning…

podwebserver& sleep 2; elinks ''

Prerequisites: module Pod::Webserver installed. You can install it typing:
sudo perl -MCPAN -e 'install Pod::Webserver'
You can replace elinks with your fav browser. For FF:
podwebserver& sleep 2; firefox -remote 'openurl(, new-tab )'
If you have Firefox open, this will pop-up the index web in a new tab.

4) Serve current directory tree at http://$HOSTNAME:8080/

twistd -n web –path .

5) Convert (almost) any video file into webm format for online html5 streaming

ffmpeg -i input_file.avi output_file.webm

6) Compare an archive with filesystem

tar dfz horde-webmail-1.2.3.tar.gz

and you quickly know the files you changed

7) tar via network

tar cfX - exclude_opt_weblogic . | ssh tmp-esxsb044 "cd /opt/weblogic ; tar xf -"

8) download and install the software package in one step

rpm -ivh ''

9) Download all images from a site

wget -r -l1 --no-parent -nH -nd -P/tmp -A".gif,.jpg"

This recursively downloads all images from a given website to your /tmp directory. The -nH and -nd switches disable downloading of the directory structure.

10) check site ssl certificate dates

echo | openssl s_client -connect 2>/dev/null |openssl x509 -dates -noout
remotely connects to an https site, fetches the ssl certificate and displays the valid dates for the cert

11) get all pdf and zips from a website using wget

wget –reject html,htm –accept pdf,zip -rl1 url

If the site uses https, use:

wget --reject html,htm --accept pdf,zip -rl1 --no-check-certificate https-url

12) Download an entire static website to your local machine

wget –recursive  –page-requisites –convert-links

Very nice command when you want to download a site locally to your machine, including images, css and javascript

13) Quickly share code or text from vim to others.

:w !curl -F "sprunge=<-" | xclip is a code/text sharing site like pastebin, but it is easy to post stuff from the command line.

How it works:

:w !commandIn vim, w writes the current tab to a file when a filename is given afterwards, but if !command is given, the output is piped to the stdin of command.

curl -F "sprunge=<-" http://sprunge.uscurl is an HTTP client. The -F option does an HTTP post to the given address. The data in the quotes is passed in the post. The “sprunge=” part sets up a fieldname – the part that follows is what is associated with the name. The “<” tells curl to send data from the file descriptor that follows it. The “-” in bash is a file descriptor that points to stdin instead of an actual file; in this case, stdin is being piped in from vim. After we send the HTTP post to, it will give back a url that points to the data you just sent.

| xclipxclip is a utility that lets you put stuff in your clipboard or selection buffer. This part uses a bash pipe ( | ) to redirect the stdout of the previous command to the stdin of the next command. So, we’re capturing the URL that curl gave us and putting it into the selection buffer, ready to paste into IRC or a forum.


Of course, for this to work, you must have curl (which comes by default on most distroes), and xclip installed.

When you share the url, you can append “?lang” to highlight and have line numbers. Check out for line numbers and for highlighting.

If you prefer to use ctrl-v (paste from clipboard) instead of middle-click (paste from selection buffer), look up options on xclip – you can do that.

14) Create an SSH tunnel for accessing your remote MySQL database with a local port

ssh -CNL 3306:localhost:3306

15) Extract dd-image from VirtualBox VDI container and mount it

vditool COPYDD my.vdi my.dd ; sudo mount -t ntfs -o ro,noatime,noexex,loop,offset=32256 my.dd ./my_dir

Tested with NTFS and found on this site:

The first 32256 bytes is the MBR

16) Forward port 8888 to remote machine for SOCKS Proxy

ssh -D 8888

Simply change your web browser’s proxy settings to point to a SOCKS proxy at port 8888 and you’re good to go.

17)  Dump a web page

curl -s | hexdump -C|less

Useful to browse dangerous web sites.

18) Edit a google doc with vim

google docs edit –title “To-Do List” –editor vim

Google just released a new commend line tool offering all sorts of new services from the commend line. One of them is uploading a youtube video but there are plenty more google services to interact with.

Download it here:


This specific command courtesy of lifehacker:

Though all can be found in manual page linked above.

19) Colorful man

apt-get install most && update-alternatives –set pager /usr/bin/most

That command installs “most” and make this command as the default man reader. The “most” works like “less” (the current man reader), but it render colors for manpages and may do more things. Read “man most”.

You can see a preview here:

20) Mirror a directory structure from websites with an Apache-generated file indexes

lftp -e "mirror -c"

wget/curl/friends are not good with mirroring files off websites, especially those with Apache-generated directory listings. These tools endlessly waste time downloading useless index HTML pages. lftp’s mirror command does a better job without the mess.

21) Convert images to a multi-page pdf

convert -adjoin -page A4 *.jpeg multipage.pdf

The linux package imagmagick is required for this command

22) printing barcodes

ls /home | head -64 | barcode -t 4×16 | lpr

64 elements max on 16 rows, 4 cols.

GNU Barcode will adapt automagically the width and the eight of your elements to fill the page.

Standard output format is PostScript.

23) convert a web page into a png

touch $2;firefox -print $1 -printmode PNG -printfile $2

This requires the command-line print extension (see #2861 for more details). I use it to make up complex images with formatted text using CSS and whatnot. It’s a lot slicker than imagemagick for certain things. Now imagine using a local webserver with PHP and a database to generate the images. Oh, the possibilities…

24) Watch the progress of ‘dd’

pkill -USR1 ^dd$

The ‘dd’ command doesn’t provide a progress when writing data. So, sending the “USR1” signal to the process will spit out its progress as it writes data. This command is superior to others on the site, as it doesn’t require you to previously know the PID of the dd command.

25) Hex math with bc

echo 'obase=16; C+F' | bc

To do hex to binary: echo ‘ibase=16; obase=2; 16*16’ | bc # prints: 111100100
To do 16*16 from decimal to hex: echo ‘ibase=10; obase=16; 16*16’ | bc # prints: 100

You get the idea… Alternatively, run bc in interactive mode (see man page)

One thought on “NOT – The Best 25 Linux Commands”

Leave a Reply

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