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 rdc

Commands by rdc from sorted by
Terminal - Commands by rdc - 6 results
export HISTFILE="$HOME/.bash_history-$(hostname -s)"
2012-05-01 13:23:15
User: rdc
Functions: export
2

On systems where your home directory is shared across different machines, your bash history will be global, rather than being a separate history per machine. This setting in your .bashrc file will ensure that each machine has its own history file.

time dd if=/dev/zero of=dummy_file bs=512k count=200
2012-04-20 13:47:27
User: rdc
Functions: dd time
1

Write 200 blocks of 512k to a dummy file with dd, timing the result. The is useful as a quick test to compare the performance of different file systems.

ln -nsf <TARGET> <LINK>
2011-07-14 14:07:06
User: rdc
Functions: ln
Tags: Linux symlinks
17

Instead of deleting an existing symlink and then re-creating it pointing at the new location, it is possible to perform the same action with this one command.

Interesting discussion on whether this is possible to do atomically here: http://answers.google.com/answers/threadview?id=526119

http_proxy=<proxy.server:port> wget <url>
2011-03-30 13:06:19
User: rdc
Functions: wget
1

On a machine behind a firewall, it's possible to pass the proxy server address in as a prefix to wget to avoid having to set it as an environment variable first.

wget -e robots=off -E -H -k -K -p http://<page>
tar -zxvf file.tar.gz
2010-11-17 14:26:14
User: rdc
Functions: tar
Tags: Linux tar unzip
0

A *.tar.gz file needs to be unzipped & then untarred. Previously I might have unzipped first with

gunzip -d file.tar.gz

and then untarred the result with

tar -xvf file.tar

(Options are extract, verbose, file)

Using the -z (decompress) option on tar avoids the use of gzip (or gunzip) first.