defines a handy function for quick calculations from cli.
once defined:
? 10*2+3
Show Sample Output
This is a very simple way to input a large number of seconds and get a more useful value in minutes and seconds. Avoids useless use of echo. Show Sample Output
Easily convert numbers to their representations in different bases. Passing "ibase=16; obase=8; F2A" to bc will convert F2A (3882 in decimal) from Hex to Octal, and so on. Show Sample Output
You're behind on your TV catch-up, but how far behind? This command tries to open mplayer against all files in the current dir. If it's a video file it will contain ID_LENGTH, which is summed and output in hours, minutes and seconds. Someone better at awk could probably reduce this down a lot. Show Sample Output
Use the standard calculator bc to convert decimals to hex Show Sample Output
queries local memcached for stats, calculates hit/get ratio and prints it out. Show Sample Output
-l auto-selects many more digits (but you can round/truncate in your head, right) plus it loads a few math functions like sin(). Show Sample Output
Faster then all other commands here at cmdlinefu with the same purpose. Show Sample Output
This is a quick and dirty way to generate a (non-floating-point) CPU-bound task to benchmark. Adjust "20" to higher or lower values, as needed. As a benchmark this is probably a little less bogus than bogomips, and it will run anywhere 'bc' does. Show Sample Output
Useful for quick calculations at the command line. $math_expr is any arithmetic expression (see sample output): 4.5*16+3^2 s(3.1415926/2) More options in the bc man page. Show Sample Output
Use this to find identify if dirs mostly contain large or small files. Show Sample Output
Colorify colors input by converting the text to a number and then performing modulo 7 on it. This resulting number is used as the color escape code. This can be used to color the results of commands with complex outputs (like "482279054165371") so if any of the digits change, there's a good chance the color will change too. I say good chance because there's only 7 unique colors here, so assuming you were watching random numbers, there would be a 6/7 chance that the color would change when the number changed. This should really only be used to help quickly identify when things change, but should not be the only thing relied upon to positively assert that an output has not changed. Show Sample Output
Infinitely plays beeps with sinusoidally changing sound frequency. Ideal for alarm on an event.
One pipe less. Show Sample Output
Want to run scripts/programs in the system after starting X minute [ For letting the system to free ]? This will give uptime in minute.
a() function in bc is for arctangent, available if using -l option included. Show Sample Output
Change the scale to adjust number of decimal places prefix the command with "time" to benchmark the computer (compare how long it takes to calculate 10000 digits of pi on various computers). Show Sample Output
Run CPU benchmark from command line
# 4 cores with 2500 pi digits
CPUBENCH 4 2500
.
every core will use 100% cpu and you can see how fast they calculate it.
if you do 50000 digitits and more it can take hours or days
Show Sample Output
This function make it easy to compute X/Y as a percentage. The name "wpoxiy" is an acronym of "what percentage of X is Y" Show Sample Output
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: