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 strzel_a

Commands by strzel_a from sorted by
Terminal - Commands by strzel_a - 25 results
firefox http://emacs.vote-system.com/
ssh -C USER@HOST tar -c --exclude /proc --exclude /sys / | tar -x
cd / ; tar -cvpzf backup.tar.gz --exclude=/backup.tar.gz --exclude=/proc --exclude=/lost+found --exclude=/sys --exclude=/mnt --exclude=/media --exclude=/dev /
2011-07-20 15:44:07
User: strzel_a
Functions: cd tar
0

Backup your entire system on a tar ball file format.

locate munin | xargs rm -r
apt-get -y install git-core gitosis; adduser --home /home/git --gecos "git user" git; su git -c "ssh-keygen -t rsa -f /home/git/.ssh/id_rsa; gitosis-init < ~/.ssh/id_rsa"
2010-12-19 20:37:12
User: strzel_a
Functions: apt install su
2

After, check if working by executing this command locally :

git clone git@192.168.0.18:repositories/gitosis-admin.git

Tutorial :

http://blog.hemca.com/?p=560

su - -m -p git
rm !(file_to_keep_undeleted)
2010-12-15 13:31:06
User: strzel_a
Functions: rm
5

Go to tmp :

cd /tmp; mkdir retmp; cd retmp

Create 10 files :

for i in {1..10}; do touch test$i; done

Remove all files except test10 :

rm !(test10)

find . -name .svn -print0 | xargs -0 rm -rf
wget -O gsplitter.crx "https://clients2.google.com/service/update2/crx?response=redirect&x=id%3Dlnlfpoefmdfplomdfppalohfbmlapjjo%26uc%26lang%3Den-US&prod=chrome&prodversion=8.0.552.224" ; google-chrome --load-extension gspliter.crx
2010-12-14 19:12:18
User: strzel_a
Functions: wget
-3

Download Gsplitter extension, and execute it with Chrome !

Or download it here :

https://chrome.google.com/extensions/detail/lnlfpoefmdfplomdfppalohfbmlapjjo

bind '"\t":menu-complete'
export TMOUT=10
2010-11-24 00:04:35
User: strzel_a
Functions: export
7

Useful in root's .profile - will auto-logout after TMOUT seconds of inactivity.

Close after `seconds` inactive.

export TMOUT=seconds

(unefunge)

`!!`
2010-11-19 17:40:01
User: strzel_a
4

\$ which python

/usr/bin/python

\$ ll `!!`

lrwxrwxrwx 1 root root 9 2010-11-08 22:01 /usr/bin/python -> python2.6

[Ctrl+_]
bind '"\C-l":"ls -l\n"'
2010-11-19 09:14:16
User: strzel_a
22

Now type Ctrl-l and it will list all files

ls --[TAB][TAB]
2010-11-18 15:31:28
User: strzel_a
Functions: ls
1

Use it for command like : mkdir, chown, ls, less...

!-2 && !-1
svn add `svn status | grep ? | cut -c9-80`
Esc-/ Esc-/
2010-11-17 23:24:11
User: strzel_a
5

Shortcut to list files in the current path.

ps ax -L -o pid,tid,psr,pcpu,args | sort -nr -k4| head -15 | cut -c 1-90
function clearIptables(){iptables -P INPUT ACCEPT; iptables -P FORWARD ACCEPT; iptables -P OUTPUT ACCEPT; iptables -F; iptables -X; iptables -L}
ll /root/ 2>&1 | grep -E '(psw|password)'
2010-11-11 23:02:21
User: strzel_a
Functions: grep
1

2>&1 permit to combinate stdout and stderr.

grep will catch stderr and stdout instead of stdout only.

ping -i1 www.google.com &> /dev/null & disown
2010-11-09 11:22:57
User: strzel_a
Functions: ping
4

Continue to execute the command in background even though quitting the shell.

cat index.html | sed 's|"index.html%3Ffeed=rss2"|"http://dynamic-blog.hemca.com/?feed=rss2.html"|g'
2010-11-05 20:27:21
User: strzel_a
Functions: cat sed
2

Pipe | avoid escaping occurences problems in using sed and make it easier to use

add-apt-repository [REPOSITORY]
tt(){tree -pFCfa . | grep "$1" | less -RgIKNs -P "H >>> "}
2010-10-12 10:53:33
User: strzel_a
Functions: grep less
1

Usage : tt [OCCURRENCE]

tt will display a tree from your actual path

tt .svn will display only line containing .svn