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

Print current running shell, PID
works as well as echo $0, but also prints process id, which pts you're using. echo $SHELL doesn't always get updated when changing shells, so this is a better solution than that. Just one more variation on a theme.

Directory Tree
tree has lots of parms - man is your friend

Convert files from DOS line endings to UNIX line endings
This method will also convert mac line endings.

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"

Tell what is encoded in a float, given its HEX bytes
It handles all possible combination of the hex bytes, including NaNs, Infinities, Normalized and Subnormal Numbers... $ This crazy DC stuff spent me a few days to write, optimize, polish and squeeze so that it works within the tight 255 character bound... $ You can modify it easily for other IEEE754 numbers, say, half, double, double-extended, quadruple $ (I hope someone will find this useful and submit more dc code to commandlinefu!)

iso to USB with dd and show progress status

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"

Download file with multiple simultaneous connections
jrk's aria2 example is incorrect. -s specifies the global connection limit; the per-host connection limit is specified with -x.

Calculate days on which Friday the 13th occurs
Alter the years in the first brace expansion to select your year range. Modify date format to your liking but leave " %w" at the end.

Print a row of 50 hyphens
Get there by going backwards and forgetting the numbers.


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: