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.
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.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
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 use this command to select a random movie from my movie collection..
Prepending
env LC_CTYPE=C
fixes a problem with bad bytes in /dev/urandom on Mac OS X
Nobody wants the boss to notice when you're slacking off. This will fill your shell with random data, parts of it highlighted. Note that 'highlight' is the Perl module App::highlight, not "a universal sourcecode to formatted text converter." You'll also need Term::ANSIColor.
works at least in bash. returns integer in range 0-32767. range is not as good, but for lots of cases it's good enough.
Reads 4 bytes from the random device and formats them as unsigned integer between 0 and 2^32-1.
Sends random sounds to your sound card output (e.g. your speaker). Think... You can also run it remotely on another computer using SSH and scare its user!
Sends random beeps to your PC-speaker. Think... You can also run it remotely on another computer using SSH and scare its user! Don't forget to run it on your dedicated hosting server and watch sysadmin's action from data-center's live remote cameras!
Cycles continuously through a string printing each character with a random delay less than 1 second. First parameter is min, 2nd is max. Example: 1 3 means sleep random .1 to .3. Experiment with different values. The 3rd parameter is the string. The sleep will help with battery life/power consumption.
cycle 1 3 $(openssl rand 100 | xxd -p)
Fans of "The Shining" might get a kick out of this:
cycle 1 4 ' All work and no play makes Jack a dull boy.'
Works in sort (GNU coreutils) 7.4, don't know when it was implemented but sometime the last 6 years.
Great idea camocrazed. Another twist would be to display a different man page based on the day of the year. The following will continuously cycle through all man pages:
man $(ls /bin | sed -n $(($(date +%j) % $(ls /bin | wc -l)))p)
retrieves the html from a random command line fu page, then finds commands on the page and prints them
alternatively, pipe to bash (add "| bash" to the end) to execute the command (very risky)
edit: had to adjust to properly display the portion that replaces HTML characters (e.g. " -> ")
2d6 dice:
awk 'BEGIN { srand(); a=int(rand()*6)+1; b=int(rand()*6)+1; print a " + " b " = " a+b }'
3 + 6 = 9
If X is 5, it will about a number between 1 and 5 inclusive.
This works in bash and zsh.
If you want between 0 and 4, remove the +1.
You need to have fortune and cowsay installed. It uses a subshell to list cow files in you cow directory (this folder is default for debian based systems, others might use another folder).
you can add it to your .bashrc file to have it great you with something interesting every time you start a new session.
Of course you will have to install Digest::SHA and perl before this will work :)
Maximum length is 43 for SHA256. If you need more, use SHA512 or the hexadecimal form: sha256_hex()