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:
This command displays a simple menu of file names in the current directory. After the user made a choice, the command invokes the default editor to edit that file.
* Without the break statement, the select command will loop forever
* Setting the PS3 prompt is optional
* If the user types an invalid choice (such as the letter q), then the variable $f will become an empty string.
* For more information, look up the bash's select command
This command displays a list of lines that are longer than 72 characters. I use this command to identify those lines in my scripts and cut them short the way I like it.
It's hard to beat C. This is just slightly faster than the bc version on my machine.
Requirements: libgmp headers, gcc.
Using avidemux to convert multiple files that are in the folder where the command was executed.
Display man page in plain text
for bash commands don't use man use help
Overwrites the boot sector. Since this doesn't overwrite any data, you can usually recover by re-creating the partition table exactly the same as before you zeroed it. This can also help sometimes if you install a new drive in a Windows machine which can't read it.
notice what happens when there is more than one unread message in a thread...
also people please dont hardcode the password when you use curl. Leave it out and curl will ask you when it runs. Please...?
This command allow you to ignore certain directories on SVN commands, like SVN STATUS. It is sad see a lot of temporary files from templates_c for each "svn status", no? ;-)
This works only on directories under revision control.
This helped me find a botnet that had made into my system. Of course, this is not a foolproof or guarantied way to find all of them or even most of them. But it helped me find it.
Force the user you want to watch doing things into doing his things in a screen session. Then simply attach yourself to that session with the command shown above.
Works only if you are on the same machine, of course
Opens a file or URL in the user's preferred application.
OS: Debian based (or those that use dpkg)
Equivalent to doing a dpkg -S on each file in $PATH, but way faster.
May report files generated though postinstall scripts and such. For example . It will report /usr/bin/vim .. which is not not a file installed directly by dpkg, but a link generated by alternatives hooks
Connect to a machine running ssh using mac address by using the "arp" command
Removes trailing newline; colon becomes record separator and newline becomes field separator, only the first field is ever printed. Replaces empty entries with $PWD. Also prepend relative directories (like ".") with the current directory ($PWD). Can change PWD with env(1) to get tricky in (non-Bourne) scripts.
This version uses Pipes, but is easier for the common user to grasp... instead of using sed or some other more complicated method, it uses the tr command
A x509 certificate and a rsa key file have in common a parameter called modulus, it is a very long hexadecimal number.
That value is unique for each certficate / key pair.
The command allows to do the check of this pair of values in a script using a great feature of bash. "