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
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
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
Shorter version using --tag
Might be more useful if you were able to print it in Days HH:MM:SS format as:
perl -e '@p=gmtime(234234);printf("%d Days %02d:%02d:%02ds\n",@p[7,2,1,0]);'
But I'm not exactly sure how to replace the 234234 with the output of the countdown time. (Having some problems with nested quoting/command substitution). Help would be appreciated :)
terms inclosing '()' must be enclosed by "" (soft quotes) bash variables must be referenced: b $x/$y ugly bracket checking (balanced, fractions...) default precision 2 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: