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

check open ports (both ipv4 and ipv6)

Emptying a text file in one shot
Within vi allow to empty a text file in one shot

Find and copy scattered mp3 files into one directory
I used this command to recursively gather all mp3 files that were previously imported into their own directories (sorted by band name) in Songbird.

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"

Terminate a frozen SSH-session
A key sequence for terminating a frozen session. Full sequence on a swedish keyboard: [ENTER] [ALTGR] tilde [SPACE] dot

IFS - use entire lines in your for cycles
When you use a "for" construct, it cycles on every word. If you want to cycle on a line-by-line basis (and, well, you can't use xargs -n1 :D), you can set the IFS variable to .

Convert tab separate file (TSV) to JSON with jq
With this command you can convert a tab separate file (TSV) into a JSON file with jq. For example, this input.tsv i-0b9adca882e5e6326 172.16.0.188 i-088dd69e5c3624888 172.16.0.102 i-0e70eac180537d4aa 172.16.0.85 will produce the showed output.

trace http requests with tshark
trace http requests on the specified interface. uses the amazing tshark tool (http://www.wireshark.org/docs/man-pages/tshark.html)

View and review the system process tree.
The "pstree" command uses special line-drawing characters. However, when piped into the "less" pager, these are normally disabled.

count files by type
displays a list of all file extensions in current directory and how many files there are of each type of extension in ascending order (case insensitive)


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: