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

Analyse compressed Apache access logs for the most commonly requested pages

In (any) vi, add a keystroke to format the current paragraph.
That goes into your $HOME/.exrc file. " Nice macro to reformat lines: map ^A !}fmt Note that the ^A has to be input by typing ^V^A.

last.fm rss parser
Quick and kludgy rss parser for the recent tracks rss feed from last.fm. Extracts artist and track link.

Slow down the screen output of a command
(example above is the 'ls' command with reduced output speed)

Make the "tree" command pretty and useful by default
I got really tired of having tree always show me tons of .svn and .git stuff that I don't care about. With this alias, "tree" uses pretty colors, snazzy line graphics, and ignores any source control and package mumbojumbo. (Customize the *.*.package glob, of course.)

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Short one line while loop that outputs parameterized content from one file to another
The above is an example of grabbing only the first column. You can define the start and end points specifically by chacater position using the following command: $ while read l; do echo ${l:10:40}; done < three-column-list.txt > column-c10-c40.txt Of course, it doesn't have to be a column, or extraction, it can be replacement $ while read l; do echo ${l/foo/bar}; done < list-with-foo.txt > list-with-bar.txt Read more about parameter expansion here: http://wiki.bash-hackers.org/syntax/pe Think of this as an alternative to awk or sed for file operations

list block devices
Shows all block devices in a tree with descruptions of what they are.

Recursively change permissions on files, leave directories alone.

Clone /
Clone linux installation.


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: