### All commands (14,030) the last day the last week the last month all time sorted by date votes

• -44
ipconfig /all
· 2009-03-06 17:36:07

• -73
· 2009-11-09 20:26:50
• EDIT: Trolling crap removed ;) takes approx 6 secs on a Core 2 Duo @ 2GHz, and 15 secs on atom based netbooks! uses monoid (a,b).(x,y)=(ax+bx+ay,ax+by) with identity (0,1), and recursion relations: F(2n-1)=Fn*Fn+F(n-1)*F(n-1) F(2n)=(Fn+2*F(n-1))*Fn then apply fast exponentiation to (1,0)^n = (Fn,F(n-1)) . Note that: (1,0)^-1=(1,-1) so (a,b).(1,0) = (a+b,a) and (a,b)/(1,0)=(a,b).(1,0)^-1=(b,a-b) So we can also use a NAF representation to do the exponentiation,http://en.wikipedia.org/wiki/Non-adjacent_form , it's also very fast (about the same, depends on n): `time echo 'n=1000000;m=(n+1)/2;a=0;b=1;i=0;while(m>0){z=0;if(m%2)z=2-(m%4);m=(m-z)/2;e[i++]=z};while(i--){c=a*a;a=c+2*a*b;b=c+b*b;if(e[i]>0){t=a;a+=b;b=t};if(e[i]<0){t=a;a=b;b=t-b}};if(n%2)a*a+b*b;if(!n%2)a*(a+2*b)' | bc` Show Sample Output

-134
time echo 'n=1000000;m=(n+1)/2;a=0;b=1;i=0;while(m){e[i++]=m%2;m/=2};while(i--){c=a*a;a=c+2*a*b;b=c+b*b;if(e[i]){t=a;a+=b;b=t}};if(n%2)a*a+b*b;if(!n%2)a*(a+2*b)' | bc
· 2009-09-10 09:00:44
• Calculates nth Fibonacci number for all n>=0, (much faster than matrix power algorithm from http://everything2.com/title/Compute+Fibonacci+numbers+FAST%2521 ) n=70332 is the biggest value at http://bigprimes.net/archive/fibonacci/ (corresponds to n=70331 there), this calculates it in less than a second, even on a netbook. UPDATE: Now even faster! Uses recurrence relation for F(2n), see http://en.wikipedia.org/wiki/Fibonacci_number#Matrix_form n is now adjusted to match Fn at wikipedia, so bigprimes.net table is offset by 1. UPDATE2: Probably fastest possible now ;), uses a simple monoid operation: uses monoid (a,b).(x,y)=(ax+bx+ay,ax+by) with identity (0,1), and recursion relations: F(2n-1)=Fn*Fn+F(n-1)*F(n-1) F(2n)=Fn*(2*F(n-1)+Fn) then apply fast exponentiation to (1,0)^n = (Fn,F(n-1)) . Note that: (1,0)^-1=(1,-1) so (a,b).(1,0) = (a+b,a) and (a,b)/(1,0)=(a,b).(1,0)^-1=(b,a-b) So we can also use a NAF representation to do the exponentiation,http://en.wikipedia.org/wiki/Non-adjacent_form , it's also very fast (about the same, depends on n): `time echo 'n=70332;m=(n+1)/2;a=0;b=1;i=0;while(m>0){z=0;if(m%2)z=2-(m%4);m=(m-z)/2;e[i++]=z};while(i--){c=a*a;a=c+2*a*b;b=c+b*b;if(e[i]>0){t=a;a+=b;b=t};if(e[i]<0){t=a;a=b;b=t-b}};if(n%2)a*a+b*b;if(!n%2)a*(a+2*b)' | bc` Show Sample Output

-135
time echo 'n=70332;m=(n+1)/2;a=0;b=1;i=0;while(m){e[i++]=m%2;m/=2};while(i--){c=a*a;a=c+2*a*b;b=c+b*b;if(e[i]){t=a;a+=b;b=t}};if(n%2)a*a+b*b;if(!n%2)a*(a+2*b)' | bc
· 2009-09-10 08:58:47
• The end of unix time and the 32bit era will be Tue Jan 19 03:14:07 UTC 2038 . `date -ud @\$[2**31]` date: invalid date `@2147483648' . In 64bit you have much longer, at least to: `date -ud @\$[2**55]` `Sun Jun 13 06:26:08 UTC 1141709097` Show Sample Output

-148
date -ud @\$[2**31-1]
· 2009-09-11 08:48:50
• ‹ First  < 560 561 562

### 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

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Fix "broken" ID3 tags in the current directory and subdirectories
Some MP3s come with tags that don't work with all players. Also, some good tag editors like, EasyTAG output tags that don't work with all players. For example, EasyTAG saves the genre as a numeric field, which is not used correctly in Sansa MP3 players. This command corrects the ID3 tags in MP3 files using mid3iconv, which comes with mutagen. To install Mutagen on Fedora use "yum install python-mutagen"

Print all lines between two line numbers
This command uses awk(1) to print all lines between two known line numbers in a file. Useful for seeing output in a log file, where the line numbers are known. The above command will print all lines between, and including, lines 3 and 6.

[re]verify a disc with very friendly output
[re]verify those burned CD's early and often - better safe than sorry - at a bare minimum you need the good old `dd` and `md5sum` commands, but why not throw in a super "user-friendly" progress gauge with the `pv` command - adjust the ``-s'' "size" argument to your needs - 700 MB in this case, and capture that checksum in a "test.md5" file with `tee` - just in-case for near-future reference. *uber-bonus* ability - positively identify those unlabeled mystery discs - for extra credit, what disc was used for this sample output?

Fork Bomb for Windows
Quick and dirty forkbomb for all flavors of windows Do not use in production. Replace start with a command of your choice, this will just open a new command prompt and is pretty tricky to stop once started

list files recursively by size

Run a command, redirecting output to a file, then edit the file with vim.
This is one of those 'nothing' shell functions ...which I use all the time. If the command contains spaces, it must be quoted, e.g. \$ vimcmd 'svn diff' /tmp/svndiff.out If I want to keep the output of the command that I'm running, I use vimcmd. If I don't need to keep the output, I use this: \$ vim

New Maintainer for CommandLineFu
Welcome to Jon H. (@fart), the new maintainer of CommandLineFu. . In the absence of a forum, I encourage people welcome him, here, in the comments. . Also... What would you like to improve/change about the site?

Label EXT2/EXT3 File System

currently mounted filesystems in nice layout
Particularly useful if you're mounting different drives, using the following command will allow you to see all the filesystems currently mounted on your computer and their respective specs with the added benefit of nice formatting.