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

Display time of accounts connection on a system
Works on CentOS ad OpenBSD too, display time of accounts connection on a system, -p option print individual user's statistics.

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"

Sort a character string
Sorts a character string, using common shell commands.

Less a grep result, going directly to the first match in the first file
Really useful way to combine less and grep while browsing log files. I can't figure out how to make it into a true oneliner so paste it into a script file called lgrep: Usage: lgrep searchfor file1 [file2 file3] Advanced example (grep for an Exception in logfiles that starts with qc): lgrep Exception $(find . -name "qc*.log")

Generate random passwords (from which you may select "memorable" ones)
See: "man pwgen" for full details. Some Linux distros may not have pwgen included in the base distribution so you maye have to install it (eg in Mandriva Linux: "urpmi pwgen").

AWS Route53 hosted zone export
Frustrated with the manual domain migration process AWS has, I unsuccessfully tried to install cli53, route53-transfer. I instead wrote this oneliner to ease the export (which is not supported via the AWS console ATM). The output can be easily pasted into the "Import Hosted Zone" dialog in Route53. SOA/NS records are excluded since they cannot be automatically imported.

Hear the mice moving
Beeps on mouse's every move. Bear in mind that, at least on Ubuntu, /dev/input/mice can be read only by root.

Quick notepad
Quick write some notes to a file with cat. Ctrl+C when you have finish.

Get absolut path to your bash-script
Another way of doing it that's a bit clearer. I'm a fan of readable code.

Multi line grep using sed and specifying open/close tags
This line does not include your closing tag in the output.


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: