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

Top 10 Memory Processes
It displays the top 10 processes sorted by memory usage

Block all FaceBook traffic

Route outbound SMTP connections through a addtional IP address rather than your primary

create a simple version of ls with extended output
create a short alias for 'ls' with multi-column (-C), file type syntax additions (slashes after directories, @ for symlinks, etc... (-F), long format (-l), including hidden directories (all ./, ../, .svn, etc) (-a), show file-system blocks actually in use (-s), human readable file sizes (-h)

A DESTRUCTIVE command to render a drive unbootable
Overwrites the boot sector. Since this doesn't overwrite any data, you can usually recover by re-creating the partition table exactly the same as before you zeroed it. This can also help sometimes if you install a new drive in a Windows machine which can't read it.

Sort specific lines while editing within vi
Sort lines within vi editor. In this example sort lines 33-61 and lines 4-9 asciibetically.

speedtest
alias speedtest='wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip'

Change proccess affinity.
Set the affinity of a process to a particular core(s). Arguments for processor include a comma separated list, or a range. (example: 1,2 or 0-3) You can use top in smp mode (Press 1) to see the changes to the affinity.

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!)


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: