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

Get a list of all your VirtualBox virtual machines by name and UUID from the shell
A similar command that lists only the currently running VMs is thus: $ VBoxManage list runningvms ...the above showing a list of VMs by name and UUID in the same format as the "$ VBoxManage list vms" command

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Do some learning...
I like it sorted... 2> /dev/null was also needless, since our pipes already select stdin, only.

Printing multiple years with Unix cal command
print multiple increasing years using cal - calendar -. You can also try $seq Start Increment End

launch bash without using any letters
ry4an@four:~$ echo $SHLVL 1 ry4an@four:~$ ${0/-/} ry4an@four:~$ echo $SHLVL 2

Use socat to emulate an SMTP mail SERVER
Lots of scripts show you how to use socat to send an email to an SMTP server; this command actually emulates an SMTP server! It assumes the client is only sending to one recipient, and it's not at all smart, but it'll capture the email into a log file and the client will stop retrying. I used this to diagnose what emails were being sent by cron and subsequently discarded, but you can use it for all sorts of things.

Change/Modify timestamp interactively

generate 30 x 30 matrix
Replaces hexdump with the more succint xxd, and the sed was unnecessarily complex.

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"


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: