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

Quickly analyse an Apache error log
This searches the Apache error_log for each of the 5 most significant Apache error levels, if any are found the date is then cut from the output in order to sort then print the most common occurrence of each error.

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

pretend to be busy in office to enjoy a cup of coffee
Dialog's gauge widget accepts progress updates on stdin. This version runs dialog once and updates it every second. There's no need to use timeout which causes screen flicker since it restarts dialog for each update.

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"

diff process output
Execute a process or list of commands in the given interval and output the difference in output.

silent/shh - shorthand to make commands really quiet
Sometimes I just want to run a command quietly but all that keyboard shifting makes my fingers hurt. This little function does the job eg.: $ if shh type less; then PAGER=less; fi

updatedb for MAC OSX
MAC OSX doesn't come with an updatedb command by default, this will emulate the updatedb thats on a typical Linux OS. Simply add it to your ~/.bash_profile

Detect illegal access to kernel space, potentially useful for Meltdown detection
Based on capsule8 agent examples, not rigorously tested

return external ip
curl inet-ip.info -> 113.33.232.62\n curl inet-ip.info/ip -> 113.33.232.62 curl inet-ip.info/json -> JSON print curl inet-ip.info/json/indent -> JSON pretty print curl inet-ip.info/yaml -> YAML format curl inet-ip.info/toml -> TOML format http://inet-ip.info

Create a temporary file
To create directory, use: $ tempdir=$(/bin/mktemp -d)


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: