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 Bonster

Commands by Bonster from sorted by
Terminal - Commands by Bonster - 24 results
for i in ?.ogg; do mv $i 0$i; done
2012-05-15 02:52:52
User: Bonster
Functions: mv
2

from

1.ogg

2.ogg

3.ogg

10.ogg

11.ogg

to

01.ogg

02.ogg

03.ogg

10.ogg

11.ogg

alias vless='/usr/share/vim/vimcurrent/macros/less.sh'
2012-04-28 23:01:25
User: Bonster
Functions: alias
7

use vim like less command pager but with color highlighting = pretty :p

also u can use /usr/share/vim/vim73/macros/less.sh

unoconv -f pdf filename.doc
2012-04-07 12:38:51
User: Bonster
6

convert to pdf and many other formats and vise versa

to get a list of supported formats, run

unoconv --show
xfwm4 --replace
inxi -F
alias o='xdg-open "$@" 2>/dev/null'
2011-12-26 08:52:22
User: Bonster
Functions: alias
-3

use xdg-open without looking at error messages

examples msg:

(nautilus:3955): Gtk-WARNING **: Theme parsing error: Notebook.css:21:15: Junk at end of value

unace x [file]
pastebinit [file]
2011-12-22 14:21:47
User: Bonster
-11

paste file to pastebin (other similar sites available, read man page).

make sure to have 'pastebinit' install

alias gtasks='chromium-browser --app=https://mail.google.com/tasks/ig'
2011-12-05 22:11:00
User: Bonster
Functions: alias
-4

requires a gmail account, it opens Google tasks in a self contain window, to write your todo list and have it sync online yay =)

tpb() { wget -U Mozilla -qO - $(echo "http://thepiratebay.org/search/$@/0/7/0" | sed 's/ /\%20/g') | grep -o 'http\:\/\/torrents\.thepiratebay\.org\/.*\.torrent' | tac; }
2011-10-26 12:15:55
User: Bonster
Functions: echo grep sed wget
3

usage: tpb searchterm

example: tpb the matrix trilogy

This searches for torrents from thepiratebay and displays the top results in reverse order,

so the 1st result is at the bottom instead of the top -- which is better for command line users

mplayer -rtsp-stream-over-tcp -user-agent QuickTime/7.6.4 http://trailers.apple.com/movies/HDmovie-h720p.mov
alias calc='python -ic "from math import *; from random import *"'
2011-10-24 08:15:41
User: Bonster
Functions: alias
-1

use python as calculator, press ctrl+d to exit

reminder: when doing factions add atleast one decimal number like so

22.0/7 or 22/7.0

awk '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j--] }'
2011-10-23 10:28:23
User: Bonster
Functions: awk
1

awk reverse order of lines (emulates "tac")

gsettings set org.gnome.desktop.background picture-uri file://"$(find ~/Wallpapers -type f | shuf -n1)"
2011-10-21 12:24:58
User: Bonster
Functions: set
3

Change Random Wallpaper on Gnome 3

sudo aptitude remove -P $(dpkg -l|awk '/^ii linux-image-2/{print $2}'|sed 's/linux-image-//'|awk -v v=`uname -r` 'v>$0'|sed 's/-generic//'|awk '{printf("linux-headers-%s\nlinux-headers-%s-generic\nlinux-image-%s-generic\n",$0,$0,$0)}')
2011-04-25 05:19:57
User: Bonster
Functions: awk sed sudo
-2

Same as 7272 but that one was too dangerous

so i added -P to prompt users to continue or cancel

Note the double space: "...^ii␣␣linux-image-2..."

Like 5813, but fixes two bugs: [1]This leaves the meta-packages 'linux-headers-generic' and 'linux-image-generic' alone so that automatic upgrades work correctly in the future. [2]Kernels newer than the currently running one are left alone (this can happen if you didn't reboot after installing a new kernel).

(sp-sc sop://broker.sopcast.com:3912/80562 8908 10999 &>/dev/null &); sleep 10; wait $(vlc http://localhost:10999); killall sp-sc
2011-04-06 00:08:38
User: Bonster
Functions: killall sleep wait
0

requires sp-auth installed

This command will auto kill sp-sc after vlc is closed, so u wont have to do it manually

plowdown http://www.megaupload.com/?d=abc1234567
2011-04-01 09:52:39
User: Bonster
3

you need to have plowshare installed

http://code.google.com/p/plowshare/

plowshare supports Megaupload, Rapidshare, 2Shared, 4Shared, ZShare, Badongo, Divshare.com, Depositfiles, Netload.in, Sendspace, Usershare, x7.to and some others file sharing services.

lynx --dump http://www.seeon.tv/channels| grep "/channels"|awk '{print $2}'|sort -u|while read links; do lynx --dump "$links"|awk '/view/ {print $2}'|sort -u; done
2011-04-01 05:58:20
User: Bonster
Functions: awk grep read sort
-1

This shows a list of channels from seeon.tv website to watch shows and movies

java -jar /path/to/filename.jar
2011-04-01 05:44:56
User: Bonster
-1

Use this to make a launcher for Java apps ( .jar files ) such as with jdownloader

catfish --fileman=nautilus --path=/home/<username> --hidden --method=find
2011-04-01 05:33:00
User: Bonster
0

Change the launcher of catfish to use a different file manager

Example:

using Find

catfish --fileman=nautilus --path=/home/ --hidden --method=find

using Locate

catfish --fileman=pcmanfm --path=/ --hidden --method=locate

Update Locate DB

sudo updatedb

gconftool-2 --set "/apps/metacity/general/action_middle_click_titlebar" --type string "minimize"
wineserver -k
2011-03-30 08:32:20
User: Bonster
6

kills all wine running apps and processes.

Make a hotkey for it when running wine games in fullscreen and it locks. This is a great way to escape from it.

sudo apt-get update 2> /tmp/keymissing; for key in $(grep "NO_PUBKEY" /tmp/keymissing |sed "s/.*NO_PUBKEY //"); do echo -e "\nProcessing key: $key"; gpg --keyserver pool.sks-keyservers.net --recv $key && gpg --export --armor $key |sudo apt-key add -; done
2011-03-30 08:18:54
User: Bonster
Functions: echo gpg grep sed sudo
5

You can choose these mirror servers to get gpg keys, if the official one ever goes offline

keyserver.ubuntu.com

pool.sks-keyservers.net

subkeys.pgp.net

pgp.mit.edu

keys.nayr.net

keys.gnupg.net

wwwkeys.en.pgp.net #(replace with your country code fr, en, de,etc)

ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -r 30 -s $(xwininfo -root | grep 'geometry' | awk '{print $2;}') -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 -y output.mkv
2010-10-04 19:56:02
User: Bonster
Functions: awk grep
2

requires ffmpeg & xwininfo to be installed

replace hw:0,0 with pulse if you like using pulseaudio

press q to quit