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

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

Install an mpkg from the command line on OSX
Installing most OSX apps is just a matter of dropping it in /Applications, either GUI-wise or with cp -r. However, many packages are distributed in "mpkg" format, and those have to be installed with an installer. If you don't want to go to the trouble of firing up VNC to install an mpkg, you can use the "installer" command. This will install an application from a .mpkg it to /Applications system-wide. To install a program for just one user, replace "-target /" with "-target username".

Clear the terminal screen
works in /bin/bash

Find installed network devices
Find installed network devices.

sleep until X o'clock
pauses exactly long enough to wake at the top of the hour

calculate in commandline with bash
Only works for integer arithmetic.

Gets WAN ip address directly from DGN2200 router.

List the binaries installed by a Debian package
GNU grep's perl-compatible regular expression(PCRE).

Randomize lines in a file
Works in sort (GNU coreutils) 7.4, don't know when it was implemented but sometime the last 6 years.

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


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: