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

Watch TCP, UDP open ports in real time with socket summary.

replace strings in file names
Uses vi style search / replace in bash to rename files. Works with regex's too (I use the following a script to fixup / shorten file names): # Remove complete parenthetical/bracket/brace phrases rename 's/\(.*\)//g' * rename 's/\[.*\]//g' * rename 's/\{.*\}//g' *

Show linux kernel modules dependencies
Use modprobe to list all the dependencies of a certain kernel module. Handy when debugging system issues.

Cut the first 'N' characters of a line
Saves one character, the original is probably clearer

Setting reserved blocks percentage to 1%
According to tune2fs manual, reserved blocks are designed to keep your system from failing when you run out of space. Its reserves space for privileged processes such as daemons (like syslogd, for ex.) and other root level processes; also the reserved space can prevent the filesystem from fragmenting as it fills up. By default this is 5% regardless of the size of the partition. http://www.ducea.com/2008/03/04/ext3-reserved-blocks-percentage/

zgrep across multiple files

Simulate typing

Put split files back together, without a for loop
After splitting a file, put them all back together a lot faster then doing $cat file1 file2 file3 file4 file5 > mainfile or $for i in {0..5}; do cat file$i > mainfile; done When splitting, be sure to do split -d for getting numbers instead of letters

Email yourself a quick message
Usage: mailme message This is a useful function if you want to get notified about process completion or failure. e.g. $ mailme "process X completed"

list all file extensions in a directory
A shorter version


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: