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

Multiple variable assignments from command output in BASH
It's quite easy to capture the output of a command and assign it in a shell's variable: $ day=$(date +%d) $ month=$(date +%m) But, what if we want to perform the same task with just one program invocation? Here comes the power of eval! date(1) outputs a string like "day=29; month=07; year=11" (notice the semicolons I added on purpose at date's custom output) which is a legal shell line. This like is then parsed and executed by the shell once again with the help of eval. Just setting 3 variables! Inspired by LinuxJournal's column "Dave Taylor's Work the Shell".

kill a process(e.g. conky) by its name, useful when debugging conky:)

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"

Show which programs are listening on TCP ports
Alternative: $ ss -tlpn

grep for minus (-) sign
Use flag "--" to stop switch parsing

Get your external IP address ( 10 characters long )
Shortest url to a external IP-service, 10 characters.

easily find megabyte eating files or directories

send file to remote machine and unzip using ssh
This version transfers gzipped data which is unzipped as it arrives at the remote host.

Get just the IP for a hostname
has the benefit of being a bit more cross-platform.

change dinosaur poop into gold
if firefox is running the database is locked, so you need to copy the places.sqlite file temporarily somewhere to be able to query it...


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: