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

Pretty Print a simple csv in the command line
Splits the input based on commas and prints it in a nice column format. This would not work for CSV rows that have "," between quotes or with newline characters. Use only simple simple csv files.

Resolve the "all display buffers are busy, please try later" error on a Foundry

vi a remote file with port
If you are running sshd on different port use above this command to edit/view remote file with vi/vim. In above example I am using port 12345.

Show all configured ipv4
Short list of all ip. Shows even the newly supported multiple ip address on the same interface (see eth1). For ipv6 use -6

FizzBuzz in one line of Bash
The (in)famous "FizzBuzz" programming challenge, answered in a single line of Bash code. The "|column" part at the end merely formats the output a bit, so if "column" is not installed on your machine you can simply omit that part. Without "|column", the solution only uses 75 characters. The version below is expanded to multiple lines, with comments added. for i in {1..100} # Use i to loop from "1" to "100", inclusive. do ((i % 3)) && # If i is not divisible by 3... x= || # ...blank out x (yes, "x= " does that). Otherwise,... x=Fizz # ...set x to the string "Fizz". ((i % 5)) || # If i is not divisible by 5, skip (there's no "&&")... x+=Buzz # ...Otherwise, append (not set) the string "Buzz" to x. echo ${x:-$i} # Print x unless it is blanked out. Otherwise, print i. done | column # Wrap output into columns (not part of the test).

Text to image with transparent background
Create transparent image to use as icon, watermark for other images, etc.

Migrate existing Ext3 filesystems to Ext4
Before doing this, back-up all data on any ext3 partitions that are to be converted to ext4. After running previous command you MUST run fsck, is needed to return the filesystem to a consistent state. $ fsck -pDf /dev/yourpartition Edit /etc/fstab and change the 'type' from ext3 to ext4 for any partitions that are converted to ext4.

makes screen your default shell without breaking SCP or SFTP
I changed my shell to screen by editing .bashrc, this stopped scp from connecting. Adding two tests before screen fixed them problem.

Turning off display
To turn off monitor: xset dpms force off To turn on, simply press a key, or move mouse/mousepad.

Compute the average number of KB per file for each dir
Shorter version using --tag


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: