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

Make ls output better visible on dark terminals in bash
Sometimes you have a situation where you cannot properly see the ls output when you are using a terminal w/a dark background. Usually bash has ls aliased to use colors, and you can easily get ls to use the default foreground color via simply unaliasing the command.

for newbies, how to get one line info about all /bin programs
Get simple description on each file from /bin dir, in list form, usefull for newbies.

Calculate your total world compile time. (Gentoo Distros)
From Gentoo Forum, greetings to rudregues & steveL.

Show what PID is listening on port 80 on Linux

Continuously listen on a port and respond with a fixed message with netcat (and respond to kill signals)
`while true`: do forever `nc -l -p 4300 -c 'echo hello'`: this is the but anything can go here really `test $? -gt 0 && break`: this checks the return code for ctrl^c or the like and quite the loop, otherwise in order to kill the loop you'd have to get the parent process id and kill it.

processes per user counter
use Linux ;)

lazy SQL QUERYING
alias for psql command line; works similar for Oracles sqlplus commandline interface. if you do not provide stdin you will end up in the db shell.

Count occurrences per minute in a log file
The cut should match the relevant timestamp part of the logfile, the uniq will count the number of occurrences during this time interval.

Take screenshot through SSH
When connected to a box via ssh you can do a quick screenshot of that box using this command. After that you can rscp it over to your box and look at it.

Run entire shell script as root
Placing sudo in the shebang line of a shell script runs the entire thing as root. Useful for scripts designed to, e.g. automate system upgrades or package manager wrappers — makes prepending everything with sudo no longer necessary


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: