Commands by kaan (6) the last day the last week the last month all time sorted by date votes

• 6
awk '{sum+=\$1; sumsq+=\$1*\$1} END {print sqrt(sumsq/NR - (sum/NR)**2)}' file.dat
· 2009-03-24 21:56:40
• The arguments of "seq" indicate the starting value, step size, and the end value of the x-range. "awk" outputs (x, f(x)) pairs and pipes them to "graph", which is part of the "plotutils" package.

2
seq 0 0.1 20 | awk '{print \$1, cos(0.5*\$1)*sin(5*\$1)}' | graph -T X
· 2009-03-24 21:46:59
• Displays six rows and five columns of random numbers between 0 and 1. If you need only one column, you can dispense with the "for" loop. Show Sample Output

3
seq 6 | awk '{for(x=1; x<=5; x++) {printf ("%f ", rand())}; printf ("\n")}'
· 2009-03-24 21:33:38
• This example calculates the averages of column one and column two of "file.dat". It can be easily modified if other columns are to be averaged.

2
awk '{sum1+=\$1; sum2+=\$2} END {print sum1/NR, sum2/NR}' file.dat
· 2009-03-24 21:22:14
• Another combination of seq and awk. Not very efficient, but sufficiently quick. Show Sample Output

14
seq 50| awk 'BEGIN {a=1; b=1} {print a; c=a+b; a=b; b=c}'
· 2009-03-24 20:39:24
• "seq 100" outputs 1,2,..,100, separated by newlines. awk adds them up and displays the sum. "seq 1 2 11" outputs 1,3,..,11. Variations: 1+3+...+(2n-1) = n^2 `seq 1 2 19 | awk '{sum+=\$1} END {print sum}' # displays 100` 1/2 + 1/4 + ... = 1 `seq 10 | awk '{sum+=1/(2**\$1)} END {print sum}' # displays 0.999023` Show Sample Output

4
seq 100 | awk '{sum+=\$1} END {print sum}'
· 2009-03-24 20:30:40

What's this?

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.

Check These Out

Search for a line of text in a directory of files recursively (while limiting to certain file extensions)

Check every URL redirect (HTTP status codes 301/302) with curl

Find unused IPs on a given subnet

Check motherboard manufacturer, product name, version and serial number
Very slick way to check your motherboard manufacturer, product name, version and serial number.

Gets all videos in your boxee queue with a URL associated with them and attempts to download each using get_flash_videos

Alias for getting OpenPGP keys for Launchpad PPAs on Ubuntu
Makes it easy to add keys to new ppa sources entries in apt sources.list Now to add the key for the chromium-daily ppa: \$ launchpadkey 4E5E17B5

Set laptop display brightness
Run as root. Path may vary depending on laptop model and video card (this was tested on an Acer laptop with ATI HD3200 video). \$ cat /proc/acpi/video/VGA/LCD/brightness to discover the possible values for your display.

Downsample mp3s to 128K
This will lower the quality of mp3 files, but is necessary to play them on some mobile devices.

Prefix every line with a timestamp