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 evandrix from sorted by
Terminal - Commands by evandrix - 49 results
awk '{s+=$1}END{print s}' <file>
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
2012-10-11 09:32:20
User: evandrix
Tags: python

Sample USAGE: f = open(os.path.join(__location__, 'bundled-resource.jpg'));

git checkout HEAD~2 -- /path/to/dir
plink -agent gist.github.com
import unicodedata; map(unicodedata.name, '\u2022'.decode('ascii'))
setopt correct
2012-09-11 01:47:20
User: evandrix
Tags: zsh

zsh has a powerful correction mechanism. If you type a command in the wrong way it suggests corrections. What happend here is that dir is an unknown command and zsh suggests gdir, while maybe ls was what you wanted.

If you want to execute gdir hit y (yes)

If you want to try to execute dir anyway hit n (no)

If you want to execute completely different spelt command like ls hit a (abort) and type your command

If you want to execute a similar spelt commant like udir hit e (edit) and edit your command.

gpg -c sensitive.txt; gpg sensitive.txt.gpg
alias g='git'
2012-08-31 05:12:56
User: evandrix
Functions: alias
Tags: git

g clone --local --bare . /repo.git

g remote add alias /repo.git

g push alias branch

g log -p filename

g checkout SHA1_rev

g reset --hard

g checkout -b new_branch

g ls-files --deleted

wget -mk -w 20 http://www.example.com/
nohup matlab -nosplash -nodesktop -nodisplay -nojvm -logfile output.log -r "function(0)" >output &
for %%f in (*.json) do type %%f >> aggregate.json
svn import /home/kaz/myproject svn+ssh://svn.FOO.codehaus.org/home/projects/FOO/scm/project1/trunk
cd /System/Library/LaunchDaemons; sudo launchctl load -w com.apple.metadata.mds.plist
for file in "* *"; do mv "${file}" "${file// /_}"; done
pdftk file.pdf dump_data output | grep -i Num
seq 1 1000000 | while read i; do echo -en "\r$i"; done
for i in $(seq 1 20); do while read line; do echo "$i: $line"; done<$i.py; done
history | cut -c8- | sort | uniq -c | sort -rn | head
netstat -tn | awk 'NR>2 {print $6}' | sort | uniq -c | sort -rn
grep --include=*.py -lir "delete" .
echo "John's" | grep -Po '\b\w+(?<!s)\b'
find . \( -name "*.as[pc]x" -o -name "*.htm*" \) -exec grep -Hi "jquery-1" {} +
egrep '(expr1|expr2)' file
2011-07-14 14:22:11
User: evandrix
Functions: egrep

to find occurances of expr1 OR expr2

response.headers['Cache-Control'] = 'public, max-age=60';
2011-07-11 23:35:36
User: evandrix

possible options:

* Varnish

* Squid in reverse proxy mode

* Django's cache framework

* rack-cache

* or CDN, like Akamai

comm -12 FILE1.sorted FILE2.sorted > common