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:
I prefer to use this and not the -n variety, so I get DNS-resolved hostnames. Nice when I'm trying to figure out who's got that port open.
It bypasses encryption overhead of SSH and depending on configuration can be significantly faster.
It's recommended to use only in trusted networks.
A short, *easy-er* to remember command for stripping whitespace and comments from a config file, (or any file for that matter).
Remember regex as:
slash, space, star.
pound, slash, bar.
pointy-hat, dollar. (or "caret, dollar" if you must)
When you don't have c_rehash handy. Really simple - if you have a .pem file that doesn't really contain a x509 cert (let's say, newreq.pem), it will create a link, simply called '.0', pointing to that file.
avoid rm to be recursive until you complete the command: put the -rf at the end!
When a fs hangs and you've just one console, even # ls could be a dangerous command. Simply put a trailing "&" and play safe
If your last command was a dud, your bash prompt will be angry at you. Otherwise it's happy. Soon you will crave its constant approval and your linux skills will improve simply to avoid low self-esteem.
less symbols, tab completion.
including # export SIMPLE_BACKUP_SUFFIX="_`date +%F`" in your .bashrc provides you to easily timestamp your files
Windows only: stops windows update and the nagging restart window.
You need your admin password for this one.
when editing .bash_profile (or .bashrc), run this to use the new version without having to exit and open a new terminal
Note you have also the --xml option ;)
defines a handy function for quick calculations from cli.
Useful if non-ascii characters in filenames have been improperly encoded. Replace "PROBLEM" with the incorrect characters (e.g. 'é'), and "FIX" with the correct ones (e.g. '?').
This command will replace all the spaces in all the filenames of the current directory with underscores. There are other commands that do this here, but this one is the easiest and shortest.
Found it on snipt, pok3, is it yours?
I put my user = m33600, the password and the status was my robot message:
Settima robot message: ALARM ZONE 3 (sent via command line).
Now bots may have their identity on twitter...
Skype has an internal regex which depicts the emoticons it supports. However you cannot simply search the binary file for it. This small 181 character line will do just that, provided skype is running. And of course, only works in linux.
Use this if you don't have access to GNU grep's -B option.
Don't have GNU tar installed that supports the redirect option (-C)? Use this.
Oracle DBA remove some logfiles which are still open by the database and he is complaining the space has not been reclaimed? Use the above command to find out what PID needs to be stopped. Or alternatively recover the file via:
cp /proc/pid/fd/filehandle /new/file.txt
Type this into windows via run and it will display to you your complete policy for windows. This includes group policy, security policy and your active directory account (min password etc)....