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

open a seperate konsole tab and ssh to each of N servers (konsole 4.2+)
creates a new tab for each of N servers in listofservers.txt and ssh's to said servers then, try the "send to all sessions" feature of konsole to do the same work on all servers at the same time. BIG time saver, but be careful!

Your GeoIP location on Google Maps

Convert a videos audio track to ogg vorbis.
Assumes you have ffmpeg and oggenc. Similar to other scripts here, but this time outputting to Ogg Vorbis. I added the variable assignment for a nice output name. This is part of an interactive bash script I have with a few little multimedia tasks in it. http://www.dward.us/software/VSAK.sh

list current ssh clients

Show all available colors on your terminal.
Using perl and tput, show all the colors with numbers that your actual $TERM can handle. If want to remove the numbers at beginning of new line, it should be something like this: $perl -E 'say `tput setb $_`," "x `tput cols`, `tput sgr0` for 0 .. (`tput colors` - 1)'

concatenate compressed and uncompressed logs
I use zgrep because it also parses non gzip files. With ls -tr, we parse logs in time order. Greping the empty string just concatenates all logs, but you can also grep an IP, an URL...

Get AWS temporary credentials ready to export based on a MFA virtual appliance
You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token. This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use: `awk '{ print "export AWS_ACCESS_KEY_ID=\"" $1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" $2 "\"\n" "export AWS_SESSION_TOKEN=\"" $3 "\"" }'` You must adapt the command line to include: * $MFA_IDis ARN of the virtual MFA or serial number of the physical one * TTL for the credentials

tar copy
Just a copy of a big dir when you wan't things like ownership and date etc etc to be untouched. Note: Updated with the ideas from "mpb".

Retry the previous command until it exits successfully
Executes the previously-run command constantly until it returns 0 (success). Put a

Print stack trace of a core file without needing to enter gdb interactively
This does almost the same thing as the original, but it runs the full backtrace for _all_ the threads, which is pretty important when reporting a crash for a multithreaded software, since more often than not, the signal handler is executed in a different thread than the crash happened.


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: