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.

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.

UpGuard checks and validates configurations for every major OS, network device, and cloud provider.

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:



May 19, 2015 - A Look At The New Commandlinefu
I've put together a short writeup on what kind of newness you can expect from the next iteration of clfu. Check it out here.
March 2, 2015 - New Management
I'm Jon, I'll be maintaining and improving clfu. Thanks to David for building such a great resource!

Top Tags



Commands by Bonster from sorted by
Terminal - Commands by Bonster - 27 results
function :h { vim +":h $1" +'wincmd o' +'nnoremap q :q!<CR>' ;}
2013-04-04 08:12:28
User: Bonster
Functions: vim

simple function i found somewhere to open vim help page from the shell

use :h like you would in vim

tree -L 1 -ChDit | tac
2012-07-28 13:47:41
User: Bonster

Go look at sample output first

This is kind of like the ls command but displays by modify time with size, date and color.

The newest files at the bottom of the screen (reverse using tac)

atool -x filename
2012-06-14 21:40:57
User: Bonster

easy extract files without remembering all the commands for different formats.

atools does other things also like listing archives content, converting from one format to another ...etc. Supports whatever is install on your system such as tar, zip, rar, 7z, rpm, deb, cab , ace, jar ...etc

for i in ?.ogg; do mv $i 0$i; done
2012-05-15 02:52:52
User: Bonster
Functions: mv













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

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

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 "[email protected]" 2>/dev/null'
2011-12-26 08:52:22
User: Bonster
Functions: alias

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

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

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/[email protected]/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

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

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

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

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

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

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

you need to have plowshare installed


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

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

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

Change the launcher of catfish to use a different file manager


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

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.