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 tagged Debian from sorted by
Terminal - Commands tagged Debian - 90 results
2009-08-09 02:43:06
User: stuart
Tags: Debian Ubuntu

Lets you set all the java alternatives at once to a matching version. Also has options for just changing the jre or the plugin.

dpkg-deb -x $debfile $extractdir; dpkg-deb -e $debfile $extractdir/DEBIAN;
2009-08-07 20:33:43
User: flokra

extracts the debian-package $debfile to $extractdir, including all packaging-information. to repack the package, just type:

dpkg-deb -b $extractdir
notify-send ["<title>"] "<body>"
2009-04-29 10:05:20
User: cammarin

The title is optional.


-t: expire time in milliseconds.

-u: urgency (low, normal, critical).

-i: icon path.

On Debian-based systems you may need to install the 'libnotify-bin' package.

Useful to advise when a wget download or a simulation ends. Example:

wget URL ; notify-send "Done"
dpkg-query -l| grep -v "ii " | grep "rc " | awk '{print $2" "}' | tr -d "\n" | xargs aptitude purge -y
2009-04-28 19:25:53
User: thepicard
Functions: awk grep tr xargs

This will, for an application that has already been removed but had its configuration left behind, purge that configuration from the system. To test it out first, you can remove the last -y, and it will show you what it will purge without actually doing it. I mean it never hurts to check first, "just in case." ;)

sudo aptitude purge `dpkg --get-selections | grep deinstall | awk '{print $1}'`
wajig large
2009-04-19 20:26:26
User: udim
Tags: Debian wajig

Requires the "wajig" package to be installed.

dlocate [ package | string ]
2009-04-19 20:19:06
User: udim
Tags: Debian

This is the fastest method to search the Debian package database.

Requires the dlocate package. The dlocate db updates periodically, but you may force an update with

# dlocate-update

dpkg -S /usr/bin/ls
2009-04-18 18:18:23
User: bwoodacre

'dpkg -S' just matches the string you supply it, so just using 'ls' as an argument matches any file from any package that has 'ls' anywhere in the filename. So usually it's a good idea to use an absolute path. You can see in the second example that 12 thousand files that are known to dpkg match the bare string 'ls'.

grep "install " /var/log/dpkg.log | awk '{print $4}' | xargs apt-get -y remove --purge
dpkg --get-selections > LIST_FILE
2009-03-28 17:45:29
User: cammarin

This command is useful when you want to install the same packages on another fresh OS install for example. To do that, use:

sudo dpkg --set-selections < LIST_FILE
function dpan () { PKG=`perl -e '$_=lc($ARGV[0]); s/::/-/g; print "lib$_-perl\n"' $1`; apt-get install $PKG; }
2009-03-12 15:39:38
User: dave0
Functions: install

Running 'cpan Module::Name' will install that module from CPAN. This is a simple way of using a similar command to install a packaged Perl module from a Debian archive using apt-get.

dpkg --compare-versions 1.0-2ubuntu5 lt 1.1-1~raphink3 && echo y || echo n
2009-02-28 18:01:59
User: raphink
Functions: echo
Tags: Debian Ubuntu

Compares two versions with dpkg. It is not always obvious what version dpkg/apt will consider to be more recent. Operators include the following :

* These treat an empty version as earlier than any version: lt le eq ne ge gt.

* These treat an empty version as later than any version: lt-nl le-nl ge-nl gt-nl.

* These are provided only for compatibility with control file syntax: < > >.

This command doesn't output anything. It only returns with status 0 or 1, hence the echo "y" || echo "n" to get an output.

dpkg-reconfigure -phigh xserver-xorg
apt-cache dotty apache2 | dot -T png | display
2009-02-18 14:27:31
User: raphink
Functions: apt dot

Requires: imagemagick and graphviz

On Debian systems, displays a graph of package dependencies. Works also with other image formats, like svg :

apt-cache dotty bash | dot -T svg | display
update-alternatives --config java
2009-02-18 13:43:41
User: raphink
Tags: Debian Ubuntu

On Debian systems, choose which command provides java. Works for all alternatives listed in /etc/alternatives.