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 absolut path to your bash-script

get you public ip address

list block devices
Shows all block devices in a tree with descruptions of what they are.

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"

Find the package that installed a command

Position the cursor under the current directory line
In case you're like me and like your commands to start on clean lines, especially when you're deep into a 10-level directory tree. This can be added to .bashrc.

Listing today’s files only

cat large file to clipboard with speed-o-meter
shortest alternative without the speed-o-meter"xclip large.xml" "xclip -o" to get the clipboard content, alternatively [shift key] + insert or middle button of your mouse.

Empty a file
Immediately make a file empty. This even works if the file is still being written to. Great for cleaning up huge log files!

Create an SSH SOCKS proxy server on localhost:8000 that will re-start itself if something breaks the connection temporarily
This command will log you into somehost via SSH and then go into the background (-f). From there, you can point e.g. firefox at localhost:8000 as a SOCKS proxy. Autossh will use port 20000 and 20001 to send and receive test data on those ports to ensure the SSH tunnel is still running, and will try to re-start the tunnel if it goes down. Make sure you have ssh-agent running, or passwordless ssh keys distributed between the two hosts.


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: