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

A signal trap that logs when your script was killed and what other processes were running at that time
trap is the bash builtin that allows you to execute commands when the current script receives a particular signal. Uses $0 for the script name, $$ for the script PID, tee to output to STDOUT as well as a log file and ps to log other running processes.

Pulls email password out of Plesk database for given email address.
This simply pulls the password out of the database for the given mail name for ease of use in testing emails that you would not normally have access to.

Remove leading zeros in multiple columns with sed
Leading zeros might help correct sorting and they can be removed by sed after sorting

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"

checking space availabe on all /proc/mounts points (using Nagios check_disk)
More info here: http://nagioswiki.com/wiki/index.php/Checking_/proc/mounts_on_remote_server

List all installed PERL modules by CPAN
This command will give you the detailed information about the installed perl modules i.e. installed path, Link type, version, files etc.

use xxd to create the wake on lan magicpacket and write to pcap file
just set macdst to the mac address of the system you wish to wake up, the macsrc is optional but helps use tcpreplay to broadcast or wireshark to view

check open ports without netstat or lsof

Bash: escape '-' character in filename

Run the last command as root
this command also can run the last command as root what's more, sudo !-2 can run the second last command as root , and so on


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: