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

find text in a file
this will find text in the directory you specify and give you line where it appears.

Rename files in batch

Debug redirects between production reloads
Watches the headers of a curl, following any redirects and printing only the HTTP status and the location of the possible redirects.

distribution specific information

List of macros defined by gcc
Lists all macros and their values defined by gcc.

Copy sparse files
This causes cp to detect and omit large blocks of nulls. Sparse files are useful for implying a lot of disk space without actually having to write it all out. http://en.wikipedia.org/wiki/Sparse_file You can use it in a pipe too: $ dd if=/dev/zero bs=1M count=5 |cp --sparse=always /dev/stdin SPARSE_FILE

Simple Video Surveillance by email
This takes a picture (with the web cam) every 5 minutes, and send the picture to your e-mail. Some systems support mail -a "References: " so that all video surveillance emails are grouped in a single email thread. To keep your inbox clean, it is still possible to filter and move to trash video surveillance emails (and restore these emails only if you really get robbed!) For instance with Gmail, emails sent to me+trash@gmail.com can be filtered with "Matches: DeliveredTo:me+trash@gmail.com"

read unixtimestamp with festival
you will hear how many seconds since 1.1.1970 in english words with billions, millions and thousands. this is very useful, if you want to get over to use the unixtimestamp instead of the 24 hour clock in your dayly life

Print all open regular files sorted by the number of file handles open to each.
This command run fine on my Ubuntu machine, but on Red Hat I had to change the awk command to `awk '{print $10}'`.

Make .bashrc function to backup the data you changed last houres
The original overwrites any previous backups, and only saves exactly the last hours worth, but not 1 hour + 1 minute. This version creates or appends files, and backs up everything since the last backup (using the backups timestamp as the reference), plus it uses TMPDIR if set.


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: