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

mirrors directory to a ftp server
http://lftp.yar.ru/

Grab the first 3 octets of your ip addresses
For machines that have many ip blocks spanning different Class C's, this will show which ones.

Produce a pseudo random password with given length in base 64
Of course you will have to install Digest::SHA and perl before this will work :) Maximum length is 43 for SHA256. If you need more, use SHA512 or the hexadecimal form: sha256_hex()

Generate Random Passwords
If you want a password length longer than 6, changing the -c6 to read -c8 will give you 8 random characters instead of 6. To end up with a line-feed, use this with echo: # echo `< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c6` Modern systems need higher strenght, so add some special characters: # < /dev/urandom tr -dc '12345!@#$%qwertQWERTasdfgASDFGzxcvbZXCVB' | head -c8

reduce mp3 bitrate (and size, of course)
Useful if you have to put some mp3 files into mobile devices (ie mobile phones with no much memory)

Show available conversions
aliases on each line. i.e. txt2html: $recode ..HTML file.html txt to Base64: $recode ../b64 file.b64 and so on.

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"

Oneliner to run commands on multiple servers
Oneliner to run commands on multiple servers over ssh. - First parameter "$1" is the command you want to execute remotely. ( It can be multiple commands e.g. "hostname;uptime") - Second parameter "${@:2}" represents the remote host/s you want to run the command/s on.

download file1 file2 file3 file4 .... file 100

Right-align text in console using pipe like ( command | right )


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: