commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. 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.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
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.
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:
Some commands (such as netcat) have a port option but how can you know which ports are unused?
Displays the duplicated lines in a file and their occuring frequency.
Low on disk space? Check the largest installed RPMs for delete canditates.
Can pipe to tail or change the awk for for file size, groups, users, etc.
This command is much quicker than the alternative of "sort | uniq -c | sort -n".
I use this to generate a playlist with all the podcasts I listen to.
Ordered from most recent to older.
The pipe to head removes the listing of . as the largest directory.
This command checks for the number of times when someone has tried to login to your server and failed. If there are a lot, then that user is being targeted on your system and you might want to make sure that user either has remote logins disabled, or has a strong password, or both. If your output has an "invalid" line, it is a summary of all logins from users that don't exist on your system.
Very useful when you need disk space. It calculates the disk usage of all files and dirs (descending them) located at the current directory (including hidden ones). Then sort puts them in order.
Sort a list of IPV4 addresses in numerical order. Great as a filter, or within vim using !}
Often, when sorting you want the sort to ignore extraneous characters. The b, d, and f tell sort to ignore leading blanks, use 'dictionary order' (ignore punctuation), and ignore (fold) case. Add a "u" if you only want one copy of duplicate lines.
This is a great command to use within vim to sort lines of text, using !}sort -bdf
I use this on debian testing, works like the other sorted du variants, but i like small numbers and suffixes :)
Probably only works with GNU du and modern perls.
The value for the sort command's -k argument is the column in the CSV file to sort on. In this example, it sorts on the second column. You must use some form of the sort command in order for uniq to work properly.