All commands (14,187)

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. 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.

Share Your Commands


Check These Out

list all opened ports on host

A DESTRUCTIVE command to render a drive unbootable
Overwrites the boot sector. Since this doesn't overwrite any data, you can usually recover by re-creating the partition table exactly the same as before you zeroed it. This can also help sometimes if you install a new drive in a Windows machine which can't read it.

Default value or argument
I used it for this function, which prints hashes: function liner { num_lines=${1:-42} echo printf %${num_lines}s|tr " " "#" echo } Note the colon-dash, instead of the usual colon-equals.

Password generator
https://xkcd.com/936/ introduced us to what actually is a good password. Here's such an implementation. Credit: quinq on #suckless

Diff on two variables
You got some results in two variables within your shell script and would like to find the differences? Changes in process lists, reworked file contents, ... . No need to write to temporary files. You can use all the diff parameters you'll need. Maybe anything like $ grep "^>" is helpful afterwards.

Factorial With Case
Computes factorials.

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

List every docker's name, IP and port mapping

Quick HTML image gallery from folder contents with Perl
This includes a title attribute so you can see the file name by hovering over an image. Also will hoover up any image format - jpg, gif and png.

Start another instance of X via SSH


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: