简体   繁体   中英

How to get to know whether the Linux process is running

Given a pid, for example 29264, how to get to know whether the process is running ?

Is there any easy way to do that ?

thx

Process status ( ps ) provides the information you're looking for:

ps -p 29264

Output in case the process is running (quick example on my Mac, works the same on Linux):

PID     TIME       CMD
127     4:54.03    /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder

Otherwhise:

PID     TIME       CMD

kill -0 29264 ,and inspect the error (if any)

link to online linux (man 2) manual

link to online linux (man 1) manual

获取过程状态:

ps -p 29264 > /dev/null; echo $?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM