当我运行ps -f -u $USER
($USER is ubuntu) 时,这是我得到的输出。
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
ubuntu 23517 0.0 0.1 22244 4856 pts/5 Ss+ 04:00 0:00 /bin/bash
ubuntu 21705 0.0 0.1 22364 4988 pts/7 Ss 03:05 0:00 /bin/bash
ubuntu 29771 0.0 0.0 5956 620 pts/7 S+ 04:46 0:00 \_ tail -f /home/ubuntu/logs/cron-20150313.log
ubuntu 21681 0.0 0.0 21288 3764 pts/6 Ss 03:03 0:00 -bash
ubuntu 21703 0.0 0.0 25648 1120 pts/6 S+ 03:05 0:00 \_ screen
ubuntu 21611 0.0 0.0 21264 3728 pts/3 Ss 03:02 0:00 /bin/bash
ubuntu 21690 0.0 0.0 21328 3788 pts/3 S+ 03:03 0:00 \_ bash --login
ubuntu 20944 0.0 0.1 22228 4840 pts/0 Ss+ 00:04 0:00 /bin/bash
ubuntu 20400 0.0 0.1 22320 4944 pts/1 Ss+ Mar12 0:00 /bin/bash
ubuntu 5194 0.0 0.0 22212 3600 pts/2 Ss 2014 0:00 /bin/bash
ubuntu 20841 0.0 0.0 5956 620 pts/2 S+ Mar12 0:00 \_ tail -f job.log
ubuntu 1931 0.0 0.1 34748 7568 pts/2 S Jan13 0:00 /usr/bin/python /usr/local/bin/pynt start_job
ubuntu 1933 0.0 0.0 4444 184 pts/2 S Jan13 0:00 \_ /bin/sh -c python -m job_manager pdf
ubuntu 1935 2.5 0.4 65380 18708 pts/2 S Jan13 2162:55 \_ python -m job_manager pdf
它基本上展示了进程层次的树结构。
但是,如果我在 bash shell 中运行相同的命令行,就会得到这个
UID PID PPID C STIME TTY TIME CMD
ubuntu 1931 1 0 Jan13 pts/2 00:00:00 /usr/bin/python /usr/local/bin/pynt start_job
ubuntu 1933 1931 0 Jan13 pts/2 00:00:00 /bin/sh -c python -m job_manager pdf
ubuntu 1935 1933 2 Jan13 pts/2 1-12:02:56 python -m job_manager pdf
ubuntu 5193 1 0 2014 ? 00:00:01 SCREEN
ubuntu 5194 5193 0 2014 pts/2 00:00:00 /bin/bash
ubuntu 20400 5193 0 Mar12 pts/1 00:00:00 /bin/bash
ubuntu 20841 5194 0 Mar12 pts/2 00:00:00 tail -f job.log
ubuntu 20944 5193 0 00:01 pts/0 00:00:00 /bin/bash
ubuntu 21611 5193 0 02:59 pts/3 00:00:00 /bin/bash
ubuntu 21680 21627 0 03:00 ? 00:00:01 sshd: ubuntu@pts/6
ubuntu 21681 21680 0 03:00 pts/6 00:00:00 -bash
ubuntu 21690 21611 0 03:00 pts/3 00:00:00 bash --login
ubuntu 21703 21681 0 03:02 pts/6 00:00:00 screen
ubuntu 21704 21703 0 03:02 ? 00:00:01 SCREEN
ubuntu 21705 21704 0 03:02 pts/7 00:00:01 /bin/bash
ubuntu 23517 21704 0 03:57 pts/5 00:00:00 /bin/bash
ubuntu 31407 21705 0 04:58 pts/7 00:00:00 ps -f -u ubuntu
我仔细检查了一下,没有找到 的任何别名ps
。在这两种情况下,它们都在运行/bin/ps
为什么输出会有差异?