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

Use top to monitor only all processes with the same name fragment 'foo'
top accecpts a comma separated list of PIDs.

Print trending topics on Twitter

Look for IPv4 address in files.
It finds a SNMP OID too :-(

Switch to the previous branch used in git(1)
Very useful if you keep switching between the same two branches all the time.

Graphical tree of sub-directories with files
The command finds every item within the directory and edits the output so that subdirectories are and files are output much like the tree command

Print a row of characters across the terminal
Pure Bash This will print a row of characters the width of the screen without using any external executables. In some cases, COLUMNS may not be set. Here is an alternative that uses tput to generate a default if that's the case. And it still avoids using tr. $ printf -v row "%${COLUMNS:-$(tput cols)}s"; echo ${row// /#} The only disadvantage to either one is that they create a variable.

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"

Run a command when a file is changed

Quickly generate an MD5 hash for a text string using OpenSSL

find out zombie process
$8~osstat, $2~pid, $11~cmd


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: