先用ps得到进程pid号. 假定为5164
2种方法获取到他的父进程pid
1. 使用/etc/proc文件夹
[root@hadoop-node-15 p_w_picpath]# cat /proc/ 5164/stat
5164 (python) S 1 5118 11378 34822 11448 4202560 1151 0 0 0 111 12 0 0 15 0 1 0 718512653 209346560 4256 18446744073709551615 4194304 5617644 140734672776192 18446744073709551615 223276215590 0 0 16781312 2 2911394094703968255 0 0 17 0 0 0 0
第4列的1即是父进程pid号

2.使用shell命令
编辑脚本get_ppid.sh
function ppid () {
   ps -p ${1:-$$} -o ppid=;
}
pid=$1
if [ -z $pid ]
then
       read -p "PID: " pid
   fi
   ps -p ${pid:-$$} -o ppid=

使用时,传入pid
[root@hadoop-node-15 p_w_picpath]# sh get_ppid.sh 5164
1