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/
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.
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.
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:
Adapted using your usefull comments !
dpigs is in the package debian-goodies (debian/ubuntu)
Use the hold space to preserve lines until data is needed.
List packages and their disk usage in decreasing order. This uses the "Installed-Size" from the package metadata. It may differ from the actual used space, because e.g. data files (think of databases) or log files may take additional space.
Calculates the size on disk for each package installed on the filesystem (or removed but not purged). This is missing the
| sort -rn
which would put the biggest packges on top. That was purposely left out as the command is slightly on the slow side
Also you may need to run this as root as some files can only be checked by du if you can read them ;)
This helped me find a botnet that had made into my system. Of course, this is not a foolproof or guarantied way to find all of them or even most of them. But it helped me find it.
OS: Debian based (or those that use dpkg)
Equivalent to doing a dpkg -S on each file in $PATH, but way faster.
May report files generated though postinstall scripts and such. For example . It will report /usr/bin/vim .. which is not not a file installed directly by dpkg, but a link generated by alternatives hooks
Best to try first with -n flag, to preview
Lets you set all the java alternatives at once to a matching version. Also has options for just changing the jre or the plugin.
extracts the debian-package $debfile to $extractdir, including all packaging-information. to repack the package, just type:
dpkg-deb -b $extractdir
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"
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." ;)
Purge all configuration files of removed packages
Requires the "wajig" package to be installed.
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
'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'.
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
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.
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.
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
On Debian systems, choose which command provides java. Works for all alternatives listed in /etc/alternatives.