All commands (14,187)

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands


Check These Out

Sort the size usage of a directory tree by gigabytes, kilobytes, megabytes, then bytes.
Since coreutils 7.6 provides sort -h

Convert a flv video file to avi using mencoder

grep for minus (-) sign
Use flag "--" to stop switch parsing

Adding formatting to an xml document for easier reading
Sometimes you're trying to read through an xml file to determine whats wrong with it and a tool had removed all the linebreaks. xmllint will go ahead and make it pretty for you.

setup a tunnel from destination machine port 80 to localhost 2001, via a second (hub) machine.
this is handy when the hubmachine is the only machine that can connect to the destination machine (allowed on ip by firewall) and you want to access it from your laptop.

List your largest installed packages (on Debian/Ubuntu)
The other commands were good, but they included packages that were installed and then removed. This command only shows packages that are currently installed, sorts smallest to largest, and formats the sizes to be human readable.

Indent all the files in a project using emacs
use -iname \*[.ch] instead of -iname \*.c -o -iname \*.h

Clean swap area after using a memory hogging application
When you run a memory intensive application (VirtualBox, large java application, etc) swap area is used as soon as memory becomes insufficient. After you close the program, the data in swap is not put back on memory and that decreases the responsiveness. Swapoff disables the swap area and forces system to put swap data be placed in memory. Since running without a swap area might be detrimental, swapon should be used to activate swap again. Both swapoff and swapon require root privileges.

Perpetual calendar
Gets any date since today. Other examples of recognized expressions are "2 years 4 days ago", "7 months" (in the future), "next Sunday", "yesterday", "tomorrow", etc.

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.


Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: