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:
The option --porcelain makes the output of git easier to parse.
This one-liner may not work if there is a space in the modified file name.
This command should be copy-pasted in Windows, but very similar one will work on Linux.
It uses wget and sed.
find files recursively from the current directory, and list the extensions of files uniquely
Can't see it here, but the non-breaking space is highlighted :)
cat -t -e
achieves something similar, but less colourful.
Could add more code points from https://en.wikipedia.org/wiki/Space_%28punctuation%29#Spaces_in_Unicode
I don't think it's possible to give a (background) colour to the tab itself, since a tab is, IIUC, simply a command to the terminal to move to the right. Nevertheless, this "highlighting" can be helpful when working with tab-separated files.
There can be more than one trailing slash, all of them will be removed.
Retrieves the current WAN ipv4 address via checkip.dyn.com.
This fixes the extra lines you get when you request only 1 paragraph using a little bit of grep. Just set p to the number of paragraphs you want.
Tries to avoid the fragile nature of scrapers by looking for user-input in the output as opposed to markup or headers on the web site.
Good for when your working on building a clean source install for RPM packaging or what have you. After testing, run this command to compare the original extracted source to your working source directory and it will remove the differences that are created when running './configure' and 'make'.
This command can rename all files in a folder changing all the dots in the filename for dashes, but respecting the final dot for the extension.
Use meaningful exit codes
change "source" to "cat" to view output instead of assigning
sed '$ d' foo.txt.tmp
...deletes last line from the file
Get the current cpu % usage on your system.
This probably only works without modifications in RHEL/CentOS/Fedora.
This command takes the content of a Parcellite-managed clipboard manager and add one level of indentation to it. It may be useful to indent a block of code which will enter inside another, already indented one but I use it mostly to indent code I will post in Stack Overflow questions and answers.
This command will find the highest context switches on a server and give you the process listing.