Print a random number between 1 and 50 with a normal distribution around the center. The numbers around the middle are the most likely to occur and the farther you get from that the less and less common they are. You can test this and observe the number distribution with this command:
for i in `seq 100000`; do echo $[(${RANDOM}%40+${RANDOM}%40)/2+1]; done | sort -n | uniq -c
Show Sample Output
Grab 4 bytes from www.random.org over ssl and format them as an integer
Here's a bash version using an array.
If you don't have seq, you can use perl.
This is longer than others on here. The reason for this is I have combined two different matrix commands so it would work on all computers. I logged onto my server through a computer and it worked fine. I logged into my server through a mac and it looked $4!t so I have made one that works through both. Show Sample Output
Add `-maxdepth 1` to find to exclude subfolders.
`shuf` generate random permutations. `-i`, `--input-range=LO-HI` and `-n`, `--head-count=COUNT` output at most COUNT lines Show Sample Output
2d6 dice:
awk 'BEGIN { srand(); a=int(rand()*6)+1; b=int(rand()*6)+1; print a " + " b " = " a+b }'
3 + 6 = 9
Show Sample Output
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)
Choose random file from current folder. Avoids using ls.
Seeing that _sort_ its been used, why not just _use_ it. ;) Show Sample Output
use it to stagger cronjob or to get a random number increase the range by replacing 100 with your own max value Show Sample Output
To install on centos 6.2 for Centos auto accept: yum install fortune* -y yum install cowsay* -y Removed the -f command as I dont know how, but it works without it. Almost the same but one folder higher =).
I use this command to select a random movie from my movie collection.. Show Sample Output
The same thing using only Bash built-in's. For readability I've kept the variables out, but it could me made extremely more compact (and totally unreadable!) by stuffing everything inside the single echo command.
Good if you have your music like Artist/(Year) Album/Song
This is /bin/sh compatible.
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!
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!
commandlinefu.com is the place to record those command-line gems that you return to again and again. 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.
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: