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

Capitalize first letter of each word in a string - A ruby alternative
"-n" loops around ; "-e" executes the given quoted string ; "$_" is the current line ; "split" creates an array on white space; each item of the array is "collected" to be then "capitalized" ; the array is "joined" back into a string.

umount --rbind mount with submounts
Original: https://bugzilla.redhat.com/show_bug.cgi?id=194342

Sniffing network to generate a pcap file in CLI mode on a remote host and open it via local Wireshark ( GUI ).
Then hit ^C to stop, get the file by scp, and you can now use wireshark like this : $ wireshark /tmp/sniff.pcap If you have tshark on remote host, you could use that : $ wireshark -k -i

Restore mysql database uncompressing on the fly.
This way you keep the file compressed saving disk space. Other way less optimal using named pipes: mysql -uroot -p'passwd' database <

Find usb device
I often use it to find recently added ou removed device, or using find in /dev, or anything similar. Just run the command, plug the device, and wait to see him and only him

Create subdirectory and move files into it
With this form you dont need to cut out target directory using grep/sed/etc.

Get your external IP address
Request all information about my IP address in json format

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"

Do one ping to a URL, I use this in a MRTG gauge graph to monitor connectivity

Backup a filesystem to a remote machine and use cstream to throttle bandwidth of the backup
This command will nicely dump a filesystem to STDOUT, compress it, encrypt it with the gpg key of your choice, throttle the the data stream to 60kb/s and finally use ssh to copy the contents to an image on a remote machine.


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: