left-most column is PID, middle is virtual memory being consumed, right-most is actual process. Show Sample Output
Function that searchs a process by its name and shows in the terminal. * Shows the Header for reference * Hides the process 'grep' from the list * Case sensitive Show Sample Output
Probably posted previously, I use this all the time to find and kill a process for "APP". Simply replace "APP" with the name of the process you're looking to kill.
The description of how the one-liner works is here at my blog: http://jugad2.blogspot.com/2008/09/unix-one-liner-to-kill-hanging-firefox.html Show Sample Output
The '[r]' is to avoid grep from grepping itself. (interchange 'r' by the appropriate letter)
Here is an example that I use a lot (as root or halt will not work):
while (ps -ef | grep [w]get); do sleep 10; done; sleep 60; halt
I add the 'sleep 60' command just in case something went wrong; so that I have time to cancel.
Very useful if you are going to bed while downloading something and do not want your computer running all night.
I know you can use pidof but with this you can know the specific PID with his command arguments (useful if you're running various proccess with same application)
defunct processes (zombies) usually have to be killed by killing their parent processes. this command retrieves such zombies and their immediate parents and kills all of the matching processes.
Function that searchs for process by its name:
* Shows the Header for reference
* Hides the process 'grep' from the list
* Case sensitive
The typical problem with using "ps | grep" is that the grep process shows up the in the output.
The usual solution is to search for "[p]attern" instead of "pattern".
This function turns the parameter into just such a [p]attern.
${1:0:1} is the first character of $1
.
${1:1} is characters 2-end of $1
Show Sample Output
Thanks to pooderbill for the idea :-) 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: