Linux如何查看当前进程的ID
Linux如何查看当前进程的ID
$$表示当前进程的ID, $PPID表示当前进程的父进程的ID.
bash-3.2$ echo $$
13750
bash-3.2$ echo $PPID
13656
bash-3.2$ ps -ef | grep 13750
Oracle 13750 13656 0 06:09 pts/4 00:00:00 bash
oracle 28981 13750 0 06:34 pts/4 00:00:00 ps -ef
oracle 28982 13750 0 06:34 pts/4 00:00:00 grep 13750
上面的结果表示ps(pid=28981)和grep(pid=28982)的父进程是bash(pid=13750)。
顺便看看bash的父进程是谁? - ksh,即在ksh提示符下运行了bash。
bash-3.2$ ps 13656
PID TTY STAT TIME COMMAND
13656 pts/4 S 0:00 -ksh
相关推荐
applecarelte 2020-10-16
farwang 2020-11-25
星愿心愿 2020-11-24
tianhuak 2020-11-24
zhjn0 2020-11-24
昭君出塞 2020-11-23
bluecarrot 2020-11-23
linuxwcj 2020-10-21
以梦为马不负韶华 2020-10-20
彼岸随笔 2020-10-20
yutou0 2020-10-17
ourtimes 2020-10-16
waterhorse 2020-09-19
MRFENGG 2020-11-11
rainandtear 2020-10-30
kyssfanhui 2020-10-20
liuhangtiant 2020-10-20