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

Compare a remote dir with a local dir
You can compare directories on two different remote hosts as well: $ diff -y

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"

remove oprhan package on debian based system

List all execs in $PATH, usefull for grepping the resulting list
While it seems (to me at least) a little counter-intuitive to filter on name first, this requires less work for find, as it allows it to immediately discount any files that do not match the name directly from the directory listing on disk. Querying against file attributes requires reading the file attributes, which is performed for all files matching any name based predicates.

Get your external IP address

pid of manually selecting window

Split a tarball into multiple parts
Create a tar file in multiple parts if it's to large for a single disk, your filesystem, etc. Rejoin later with `cat .tar.*|tar xf -`

Browse shared folder when you're the only Linux user
Under Ubuntu smbclient is part of the samba package. With the version I use (3.0.28a) cd-ing into folders with spaces in the name is a drag. You have to put the folder name in quotes: smb: \Shared\> cd "Marketing and PR"

vi keybindings with info
Info has some of the worst keybindings I've ever seen. Being a vim user, I attribute that to emacs influence. Use the --vi-keys option to use some of the vi keybindings, although this won't change all the keybindings. Use the "infokey" program to have more control over info keybindings.

Clear the terminal screen


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: