Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. 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.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

Hide

Stay in the loop…

Follow the Tweets.

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

Subscribe to the feeds.

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:

Hide

News

2011-03-12 - Confoo 2011 presentation
Slides are available from the commandlinefu presentation at Confoo 2011: http://presentations.codeinthehole.com/confoo2011/
2011-01-04 - Moderation now required for new commands
To try and put and end to the spamming, new commands require moderation before they will appear on the site.
2010-12-27 - Apologies for not banning the trolls sooner
Have been away from the interwebs over Christmas. Will be more vigilant henceforth.
2010-09-24 - OAuth and pagination problems fixed
Apologies for the delay in getting Twitter's OAuth supported. Annoying pagination gremlin also fixed.
Hide

Tags

Hide

Functions

Commands by eastwind from sorted by
Terminal - Commands by eastwind - 71 results
ssh-keygen -G /tmp/moduli-2048.candidates -b 2048
2010-01-29 19:33:23
User: eastwind
Functions: ssh ssh-keygen
0

if you lost your moduli file in openssh server side you need generate new one with this command then test if the number generated can be used with ssh-keygen -T moduli-2048 -f /tmp/moduli-2048.candidates

set -o noclobber
2010-01-08 21:06:44
User: eastwind
Functions: set
0

If you set noclobber to on, bash won't allow redirection to overwrite existing files .

set -o noclobber command turn the option on (default it s off ) .

You can still append information but not overwrite the file .to turn it back off use : $ set +o noclobber .

I use it because i overwrite a file by accident , after thought , content of the file was very important , creating a one more file mean nothing for my hard disk (we are not anymore on the 64 k memory time) , but content of file is far much important . What we call exeprience :(

lame -V2 rec01.wav rec01.mp3
i="0"; while [ $i -lt 5 ] ; do xpenguins & i=$[$i+1] ; done
2009-12-27 21:05:33
User: eastwind
-2

just replace the number 5 with the variable you want , and the xpenguins software with the one you want

dumpe2fs -h /dev/DEVICE | grep 'created'
2009-12-12 14:47:33
User: eastwind
Functions: dumpe2fs grep
7

Knowing when a filesystem is created , you can deduce when an operating system was installed .

find filesystem device (/dev/) informations by using the cat /etc/fstab command.

ffmpeg -i Your_video_file -s 320x240 FILE.flv
mencoder -idx Your_Input_Video_File -ovc lavc -oac mp3lame -audiofile Your_Audio_track.mp3 -o Output_File.avi
locale | grep LANG=
mformat -f 1440 A:
2009-12-10 06:51:20
User: eastwind
Functions: mformat
-1

The 1440 is the number of bytes, and the A: specifies the floppy drive.

mount -t msdos /dev/fd0 /mnt/floppy
2009-12-10 06:46:53
User: eastwind
Functions: mount
-2

-t option tells the system to look for a msdos filesystem

The /dev/fd0 is your floppy drive ( This may be different for you check /dev folder to confirm)

/mnt/floppy is the point where you want to mount the device to

mencoder -ovc xvid -oac mp3lame -srate 44100 -af lavcresample=44100 -xvidencopts fixed_quant=4 Foo.wmv -o Bar.avi
mencoder infile.wmv -ofps 23.976 -ovc lavc -oac copy -o outfile.avi
mimms mms://Your_url.wmv
apt-cache show Your_package
dpkg -L Your_Package
convert sample.pdf sample.jpg
mount -t iso9660 /dev/cdrom /media/cdrom
mencoder input.flv -ovc lavc -oac mp3lame -o output.avi
2009-12-01 10:42:11
User: eastwind
0

Detect video size automatically , usually the flv video from youtube , dailymotion are in the /tmp directory . Just launch a video player or an ls -lh on it to find the one you want to convert.

ls -al
2009-11-12 12:27:32
User: eastwind
Functions: ls
-11

it does provide much more information , the owner , group , the size in byte , and the last modified time a file or directory was

ls -al : list all in long format

aptitude moo
2009-11-12 12:24:01
User: eastwind
6

this is a reference to Antoine de St. Exupery's "The Little Prince"

pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf
pdftk mydoc.pdf burst
2009-11-10 09:00:50
User: eastwind
3

Require the pdftk package

It ll split each page in your pdf file , into a new pdf file and report info on doc_data.txt

htlatex MyFile.tex "xhtml,ooffice" "ooffice/! -cmozhtf" "-coo -cvalidate"
2009-11-05 10:12:28
User: eastwind
2

require the tex4ht package . You can open the file with openoffice , I use it much for correct my spelling and grammar .

wmsetbg -s -u path_to_wallpaper
2009-10-21 11:23:54
User: eastwind
1

set directly the wallpaper on windowmaker , use this command with display of imagemagick :)

mencoder mf://image1.jpg,image2.jpg,image3.jpg -mf w=800:h=600:fps=25:type=jpeg -ovc copy -oac copy -o output.avi
2009-10-21 09:17:22
User: eastwind
-1

syntax :

mencoder mf://filemask -mf

option availble for mf :

* w=value : the width of the output, by d?fault : autodetected

* h=value : height of the output, by default : autodetected

* fps=value : framerate of the output, by default : 25

* type=value : file format type input , avaible: jpeg, png, tga, sgi