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

Display text as though it is being typed out in real time
Pipe Viewer allows you to monitor the progress of a data transfer or command, or to show the time elapsed, among other things. In this use, it limits the transfer rate of the echo command to 10 bytes per second, making your text appear to be typed out in real time as in Hollywood movies. Fun!

Easily decode unix-time (funtion)

Delete a file/directory walking subdirectories (bash4 or zsh)

Perform a branching conditional
This will perform one of two blocks of code, depending on the condition of the first. Essentially is a bash terniary operator. To tell if a machine is up: $ ping -c1 machine { echo succes;} || { echo failed; } Because of the bash { } block operators, you can have multiple commands $ ping -c1 machine && { echo success;log-timestamp.sh }|| { echo failed; email-admin.sh; } Tips: Remember, the { } operators are treated by bash as a reserved word: as such, they need a space on either side. If you have a command that can fail at the end of the true block, consider ending said block with 'false' to prevent accidental execution

Check if a domain is available and get the answer in just one line
Returns nothing if the domain exists and 'No match for domain.com' otherwise.

Make changes in any profile available immediately/Change to default group
Changes your group to the default group, has the same effect as sourcing your profile/rc file (in any shell) or logging out and back in again.

Get video information with ffmpeg
ffprobe is specially intended to get video information

formatting number with comma
it is not work with Cygwin's bash3.X. Test in Linux. use printf "%'f" number while it is floating point number

Capture video of a linux desktop
This will grab the image from desktop, starting with the upper-left corner at x=100, y=200 with a width and height of 1024?768.

Use a regex as a field separator awk


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: