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

Convert all JPEG images to MP4
Source: http://superuser.com/a/624574

Convert a flv video file to avi using mencoder

rsync + find
use find with rsync

Fetch the Gateway Ip Address
This is to fetch the Gateway Ip Address of a machine. Use the below format to put the value in a variable if you wish to find the gateway ip in a script $GATEWAY=$(netstat -nr | awk 'BEGIN {while ($3!="0.0.0.0") getline; print $2}')

Random numbers with Ruby
There's been a few times I've needed to create random numbers. Although I've done so in PERL, I've found Ruby is actually faster. This script generates 20 random "10" digit number NOT A RANDOM NUMBER. Replace 20 (1..20) with the amount of random numbers you need generated

generate random mac-address using md5sum + sed

Change mysql prompt to be more verbose
You can put this into your shell sourced file like .bashrc or .zshrc to have a different mysql prompt. See http://dev.mysql.com/doc/refman/5.1/de/mysql-commands.html for more informations. Beware that currently with mysql 5.5 the seconds are buggy and won't be displayed if you put this into a .cnf file. With the enironment variable this will work.

extract email adresses from some file (or any other pattern)
find all email addresses in a file, printing each match. Addresses do not have to be alone on a line etc. For example you can grab them from HTML-formatted emails or CSV files, etc. Use a combination of $...|sort|uniq$ to filter them.

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

Signals list by NUMBER and NAME
This command seems to achieve the similar/same goal.


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: