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

processes per user counter
awk is evil!

Generate random password on Mac OS X
Feel free to put this in your ~/.profile: $ random(){ cat /dev/urandom | env LC_CTYPE=C tr -dc $1 | head -c $2; echo; } Then use it to generate passwords: $ random [:alnum:] 16 Or DNA sequences: $ random ACGT 256

skip broken piece of a loop but not exit the loop entirely
useful for loops like for i in $(cat list_of_servers); do ssh -q $i hostname; done if there is an unreachable server, you can just press ctrl + \ to skip that server and continue on with the loop

force a rescan on a host of scsi devices (useful for adding partitions to vmware on the fly)

Check SATA link speed.
Check SATA controller type. 6.0 Gbps - SATA III 3.0 Gbps - SATA II 1.5 Gbps - SATA I

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

Format partition with ext4 but without a journal
For slow flash memory (cheap thumb drive), ext4 is the fastest stable file system for all use cases with no relevant exception: http://www.linuxplanet.com/linuxplanet/tutorials/7208/1 Since we can usually dispense with the benefits of a journal for this type of storage, this is a way to achieve the least awful I/O-speed. Disabling the journal for an existing ext4 partition can be achieved using $ tune2fs -O ^has_journal /dev/sdXN Note that it is often recommended to format removable flash media with ext2, due to the lack of a journal. ext4 has many advantages over ext2 even without the journal, with much better speed as one of the consequences. So the only usecase for ext2 would be compatibility with very old software.

a function to find the fastest DNS server
http://public-dns.info gives a list of online dns servers. you need to change the country in url (br in this url) with your country code. this command need some time to ping all IP in list.

Create a single-use TCP proxy with copy to stdout
USAGE: gate listening_port host port Creates listening socket and connects to remote device at host:port. It uses pipes for connection between two sockets. Traffic which goes through pipes is wrote to stdout. I use it for debug network scripts.

Automatically connect to a host with ssh once it is online


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: