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

Losslessly rotate videos from your phone by 90 degrees.
Takes all the .3gp files in the directory, rotates them by 90 degrees, and saves them in the lossless ffv1 encoding. If this rotates in the wrong direction, you may want transponse=1 Re-encoding to ffv1 may result in a significant increase in file size, as it is a lossless format. Other applications may not recognize ffv1 if they don't use ffmpeg code. "huffyuv" might be another option for lossless saving of your transformations. The audio may be re-encoded as well, if the encoding used by your 3gp file doesn't work in a avi container.

Adding Prefix to File name
Good old bracket expansion :-) For large numbers of files, "rename" will spare you the for-loop, or the find/exec...

Bash logger

recursive transform all contents of files to lowercase
In this way it doesn't have problems with filenames with spaces.

Find total Terabytes written to a SSD
You must have smartmontools installed for this to work. This also assumes you 512 byte sector sizes, this is pretty standard.

Copy recursivelly files of specific filetypes
Copying only wmv and mpg files recursively from to

Show bz compressed PF binary log

Function to split a string into an array
It works as a method applicated to a variable, converts the string variable into an array

Archive all files that have not been modified in the last days
Finally, we can make the file "unchangeable" sudo chattr +i

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"


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: