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

add all files not under version control to repository
This should handle whitespaces well and will not get confused if your filenames have "?" in them

exit without saving history
this exits bash without saving the history. unlike explicitly disabling the history in some way, this works anywhere, and it works if you decide *after* issuing the command you don't want logged, that you don't want it logged ... $$ ( or ${$} ) is the pid of the current bash instance this also works perfectly in shells that don't have $$ if you do something like $ kill -9 `readlink /proc/self`

How to sum lines with decimals in awk
Read all lines using decimal marker as point, then add all them up and outputs the result.

Find artist and title of a music cd, UPC code given (first result only)
I like curl better than wget, I just think that curl -s is a lot simpler than wget ... see I forget what you even have to do to get wget to pipe it's output Anyway, all in one sed command as "requested"

Console clock
Shows a simple clock in the console -t param removes the watch header Ctrl-c to exit

Get decimal ascii code from character
printf treats first char after single ' as numeric equivalent

What is my ip?

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"

Countdown Clock
Countdown clock - Counts down from $MIN minutes to zero. I let the date command do the maths. This version doesn't use seq.

Run the last command as root
Useful when you forget to use sudo for a command. "!!" grabs the last run command.


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: