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

2012-05-20 - test
test
2012-05-20 - test
test
2012-05-20 - test
test
2012-05-20 - Test tweets
YU not working?
Hide

Tags

Hide

Functions

Commands by eastwind

Commands by eastwind from sorted by
Terminal - Commands by eastwind - 64 results
for img in *.png; do convert "$img" "$img.jpg" ; done
cat /etc/debian_version
2011-12-11 11:13:16
User: eastwind
Functions: cat
-6

work on any debian based GNU/Linux distro

mplayer -af scaletempo=scale=1.5 foo.mp3
cat /dev/scd0 > ~/audio_image.iso
2011-09-24 15:29:27
User: eastwind
Functions: cat
-8

you should umount /dev/cdrom before using this cli

dd if=/dev/cdrom of=~/cd_image.iso
2011-09-24 15:27:04
User: eastwind
Functions: dd
3

create an iso from your cd/dvd-rom device . You need to umount /dev/cdrom

before using the cli

cat $(ls -c | grep ogg | tac ) > directory/test.ogg
mkdir $(date +%Y_%m_%d)
fusermount -u ~/sshfs_mounted_directory
sudo deborphan | xargs sudo apt-get -y remove --purge
echo "scale=6;2048 / 2.345" | bc
echo Your_Chinese_Char | uniconv -encode Chinese-WB
2010-04-05 10:57:42
User: eastwind
Functions: echo
0

This CLI requiere the uniconv package that is provided with the yudit unicode editor .

The wubi86 is a way to type chinese far quicker than pinyin .

More infor on wikipedia : http://en.wikipedia.org/wiki/Wubizixing , http://www.yale.edu/chinesemac/wubi/xing.html

time Command >/dev/null
tr '\n' '\t' < inputfile
tr '\t' '\n' < inputfile
cut -f2 file.txt | cut -d " " -f1
texmacs --delete-font-cache
2010-03-14 13:30:54
User: eastwind
-1

after installing new fonts ( tfm , pfb , cjk , truetype ... ) manually in your ~/.Texmacs/fonts , it doesn't always reload it properly , just refresh it by delete the old cache fonts

in sample output , I just installed TrueType Chinese CJK fireflysung fonts supports

/usr/sbin/dmidecode | grep -i "current speed"
ssh-keygen -T moduli-2048 -f /tmp/moduli-2048.candidates
2010-01-29 19:35:21
User: eastwind
Functions: ssh ssh-keygen
1

this command test the moduli file generated by the command ssh-keygen -G /tmp/moduli-2048.candidates -b 2048 . The test can be long depend of your cpu power , around 5 minutes to 30 minutes

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