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

Show biggest files/directories, biggest first with 'k,m,g' eyecandy
I use this on debian testing, works like the other sorted du variants, but i like small numbers and suffixes :)

Diff two directories by finding and comparing the md5 checksums of their contents.
Compares the md5 checksums of the contents of two directories, outputting the checksum and filename where any files differ. Shows only the file name, not the full path.

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

Umount only the NFS related to 'string'
Sometimes, you have a lot of NFS in the server and you can't or shouldn't use umount -a. Whis this command, you only umount the fs related to the 'string'

bulk rename files with sed, one-liner
Far from my favorite, but works in sh and with an old sed that doesn't support '-E'

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"

Replace all backward slashes with forward slashes
Use -i to edit file directly: sed -i 's|\\|\/|g' file

list files recursively by size

Run a command that has been aliased without the alias
Most distributions alias cp to 'cp -i', which means when you attempt to copy into a directory that already contains the file, cp will prompt to overwrite. A great default to have, but when you mean to overwrite thousands of files, you don't want to sit there hitting [y] then [enter] thousands of times. Enter the backslash. It runs the command unaliased, so as in the example, cp will happily overwrite existing files much in the way mv works.

grep for minus (-) sign
Use flag "--" to stop switch parsing


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: