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 dizzgo from sorted by
Terminal - Commands by dizzgo - 7 results
alias showip="ifconfig eth0 | grep 'inet addr:' | sed 's/.*addr\:\(.*\) Bcast\:.*/\1/'"
2009-03-25 07:50:12
User: dizzgo
Functions: alias
Tags: ifconfig alias IP
0

parses the output of ifconfig to show only the configured ip address (in this case from interface eth0).

the regexp is quick'n'dirty im sure it can be done in a better way.

--> this alias does not show your "internet ip" when you're in a nat-environment

cdrecord -v dev=/dev/cdrom yourimage.iso
2009-03-25 07:31:54
User: dizzgo
Functions: cdrecord
3

cdrecord must be installed.

usefull alias:

alias burniso='cdrecord -v dev=/dev/cdrom'

now iso burning is like.

burniso image.iso
do-release-upgrade
2009-03-25 07:25:33
User: dizzgo
Tags: Ubuntu
-1

release upgrades are major upgrades as from 8.04 to 8.10 or from 8.10 to 9.04

update-manager-core must be installed:

sudo apt-get install update-manager-core

in some cases you must edit '/etc/update-manager/release-upgrades' and set 'Prompt=normal'

xset b off
2009-02-20 07:40:14
User: dizzgo
7

Disable the annoying beep in xterm

<alt> + <print screen/sys rq> + <R> - <S> - <E> - <I> - <U> - <B>
2009-02-20 07:28:56
User: dizzgo
98

If the machine is hanging and the only help would be the power button, this key-combination will help to reboot your machine (more or less) gracefully.

R - gives back control of the keyboard

S - issues a sync

E - sends all processes but init the term singal

I - sends all processes but init the kill signal

U - mounts all filesystem ro to prevent a fsck at reboot

B - reboots the system

Save your file before trying this out, this will reboot your machine without warning!

http://en.wikipedia.org/wiki/Magic_SysRq_key

time { <command1> ; <command2> ; <command...> ; }
2009-02-19 16:23:42
User: dizzgo
Functions: time
5

The last ; is important. example:

time { rm -rf /folder/bar && mkdir -p /folder/bar ; echo "done" ; }

command is a bash builtin

ps -o ppid= <given pid> | xargs ps -p