-p Tell me the name of the program and it's PID -l that is listening -u on a UDP port. -n Give me numeric IP addresses (don't resolve them) -t oh, also TCP ports Show Sample Output
Seq allows you to define printf like formating by specified with -f, %03g is actually tells seq I got three digits, fill the blank digits with 0, and the range is from 176 to 240.
strace can be invaluable in trying to figure out what the heck some misbehaving program is doing. There are number of useful flags to limit and control its output, and to attach to already running programs. (See also 'ltrace'.) Show Sample Output
You cannot kill zombies, as they are already dead. But if you have too many zombies then kill parent process or restart service. You can kill zombie process using PID obtained from the above command. For example kill zombie proces having PID 4104: # kill -9 4104 Please note that kill -9 does not guarantee to kill a zombie process.
8~osstat, $2~pid, $11~cmd
This is priceless for discovering otherwise invisible characters in files. Like, for example, that stray Control-M at the end of the initial hash bang line in your script, which causes it to generate a mysterious error even though it looks fine. ('od' is the last word, of course, but for many purposes it's much harder to read.)
Just type 2 characters and enter, you will be back. Show Sample Output
This is a quick and dirty way to generate a (non-floating-point) CPU-bound task to benchmark. Adjust "20" to higher or lower values, as needed. As a benchmark this is probably a little less bogus than bogomips, and it will run anywhere 'bc' does. Show Sample Output
get my GPG-key from pgp.surfnet.nl, key id is 19886493. Show Sample Output
my $.02 Show Sample Output
You need sudo privileges for this command. Replace username with actual username.
Reverts the changes that were made in a particular revision, in the local working copy. You must commit the local copy to the repository to make it permanent. This is very useful for undoing a change. You can revert multiple changes by specifying numbers wider apart; Just remember to put the highest number first. Show Sample Output
Makes a partition in ram which is useful if you need a temporary working space as read/write access is fast. Be aware that anything saved in this partition will be gone after your computer is turned off.
syntax follows regular command line expression. example: let's say you have a directory (with subdirs) that has say 4000 .php files. All of these files were made via script, but uh-oh, there was a typo! if the typo is "let's go jome!" but you meant it to say "let's go home!" find . -name "*.php" | xargs perl -pi -e "s/let\'s\ go\ jome\!/let\'s\ go\ home\!/g" all better :) multiline: find . -name "*.php" | xargs perl -p0777i -e 's/knownline1\nknownline2/replaced/m' indescriminate line replace: find ./ -name '*.php' | xargs perl -pi -e 's/\".*$\"/\new\ line\ content/g' Show Sample Output
k add principle Show Sample Output
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.
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
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: