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 look at xkcd in my news reader, but it displays the image's title attribute only for a few seconds which makes reading the longer ones more challenging. So I use this to display it in my console.
Here's an alternative if you don't have seq.
This version uses a bash function and does not print the path to the module.
If you don't have seq or shuf, bash can be used.
If you don't have seq, you can use perl.
Here's a perl version that only considers printable characters. Change the regex /[[:print:]]/ to look for different sets of delimiter characters.
xxd can convert a hexdump back to binary using the -r option which can be useful for patching or editing binary files.
Here's a bash version.
If you do not have shuf or an -R option in sort, you can fall back on awk. This provides maximum portability IMO. The command first collects words from the dictionary that match the criteria - in this case: lower case words with no punctuation that are 4 to 8 characters long. It then prints 4 random entries. I decided to print each word on a separate line to improve readability.
If your wc does not have the -L option, you can use awk.
This version uses read instead of eval.
Here's a bash version using an array.
This version compresses the data for transport.
A bash version.
This version does not rely on a 3rd party service. Just put this in a bash cgi on your own server.
Another option is openssl.
This will first remove any leading white space. If the line then starts with a comment character, it is cleared. If the result is an empty line, it's deleted. This allows for comment lines with leading white space.
Fun idea! This one adds seconds and keeps running on the same line. Perl's probably cheating though. :)
Today I needed a way to print various character classes to use as input for a program I was writing. Also a nice way to visualize character classes.