Get id of a process and kill it

Emir Buğra KÖKSALAN tarafından tarihinde yayınlandı

Sometimes you must kill a process from command line. “kill” command needs process id. You can get a process details with “ps aux | grep java” but this command prints lots of details. But “kill” command needs only the process id data.

For getting id of a process you can use “pgrep” command. This prints only process id. For example: pgrep java

After this time you can kill a process without writing its id. The command is that: kill $(pgrep java)

kill -9 is generally a last resort. It’s better to try kill -11 then kill -6 first. If kill -11 doesn’t kill it, kill -6 usually does. Try kill -11 first, wait a few/several seconds, and if the process is still alive, try kill -6. Wait several seconds and if it still isn’t dead, you can then try kill -9

Kategoriler: EnglishLinux

Emir Buğra KÖKSALAN

Java & PHP Developer

0 yorum

Bir yanıt yazın

Avatar placeholder

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Time limit is exhausted. Please reload the CAPTCHA.

Bu site, istenmeyenleri azaltmak için Akismet kullanıyor. Yorum verilerinizin nasıl işlendiği hakkında daha fazla bilgi edinin.