PS 命令记录

 

显示内容:

$ ps -ef more
UID PID PPID C STIME TTY TIME CMD
root 0 0 0.0 Sep 02 ?? 9:48.49 [kernel idle]
root 1 0 0.0 Sep 02 ?? 0:03.07 /sbin/

 

UID -- User's Identification, 用户标识号
PID -- Process's Idendification, 进程号
PPID -- Parent PID, 父进程号
STIME -- Start time, 启动时间
TTY -- 在哪个终端运行
CMD -- 对应的命令

 

使用

ps -ef | grep command

ps -auxww | more 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是常用进程命令的使用方法和运行结果: 1. ps命令:用于显示当前进程的状态信息。 ```shell ps -ef ``` 输出结果: ``` UID PID PPID C STIME TTY TIME CMD root 1 0 0 2021 ? 00:00:01 /sbin/init splash root 2 0 0 2021 ? 00:00:00 [kthreadd] root 3 2 0 2021 ? 00:00:00 [rcu_gp] root 4 2 0 2021 ? 00:00:00 [rcu_par_gp] ... ``` 2. pstree命令:以树形结构显示进程信息。 ```shell pstree -p ``` 输出结果: ``` systemd(1)─┬─ModemManager(797)─┬─{gdbus}(853) │ └─{gmain}(850) ├─NetworkManager(772)─┬─{gdbus}(856) │ └─{gmain}(846) ├─accounts-daemon(668)─┬─{gdbus}(874) │ └─{gmain}(875) ├─agetty(864) tty1 ├─agetty(865) tty2 ├─agetty(866) tty3 ├─agetty(867) tty4 ├─agetty(868) tty5 ├─agetty(869) tty6 ├─atd(771)───{atd}(865) ├─cron(758) ├─2*[dbus-daemon(765)] ├─dbus-daemon(766) ├─dbus-daemon(768) ├─dbus-daemon(769) ├─dbus-daemon(770) ├─gnome-keyring-d(870)─┬─{gdbus}(872) │ └─{gmain}(873) ├─gnome-shell(853)─┬─{Clutter}(882) │ ├─{Gdk}(876) │ ├─{Gdk}(877) │ ├─{Gdk}(878) │ ├─{Gdk}(879) │ ├─{Gdk}(880) │ ├─{Gdk}(881) │ ├─{gdbus}(859) │ ├─{gmain}(854) │ └─{ibus}(883) ├─gssproxy(881) ├─irqbalance(780)───{irqbalance}(782) ├─lightdm(779)───lightdm───2*[{lightdm}] ├─polkitd(762)─┬─{gdbus}(780) │ └─{gmain}(759) ├─rsyslogd(764)─┬─{in:imklog}(791) │ └─{rs:main Q:Reg}(792) ├─snapd(886)───{snapd}(889) ├─spice-vdagentd(809)─┬─{gdbus}(840) │ └─{gmain}(839) ├─sshd(798)───sshd───sshd───bash───pstree ├─systemd-journal(648) ├─systemd-logind(781) ├─systemd-resolve(780)───{gmain}(785) ├─systemd-timesyn(774)─┬─{gdbus}(883) │ └─{gmain}(879) ├─thermald(783)─┬─{thermald}(785) │ └─{ucount}(784) ├─udisksd(775)─┬─{cleanup}(826) │ ├─{gdbus}(795) │ ├─{gmain}(794) │ ├─{probing-thread}(797) │ ├─{syslog}(827) │ └─{udisksd-worker}(798) ├─upowerd(791)─┬─{gdbus}(806) │ └─{gmain}(795) ├─whoopsie(775)─┬─{gdbus}(813) │ └─{gmain}(812) └─wpa_supplicant(815) ``` 3. top命令:实时显示进程信息。 ```shell top ``` 输出结果: ``` top - 14:03:24 up 1:20, 1 user, load average: 0.04, 0.06, 0.09 Tasks: 224 total, 1 running, 223 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.6 us, 0.4 sy, 0.0 ni, 99.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 1978888 total, 1430428 free, 340040 used, 208420 buff/cache KiB Swap: 1048572 total, 1048572 free, 0 used. 1478680 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1993 root 20 0 106708 4744 3456 S 1.0 0.2 0:00.29 systemd-journal 798 root 20 0 153932 4236 3584 S 0.7 0.2 0:00.17 sshd 767 root 20 0 326596 12308 9136 S 0.3 0.6 0:01.02 udisksd 775 root 20 0 116560 5088 4256 S 0.3 0.3 0:00.10 upowerd 797 root 20 0 73628 3648 3008 R 0.3 0.2 0:00.10 sshd 1 root 20 0 225776 7680 5568 S 0.0 0.4 0:01.40 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.03 kthreadd 3 root 20 0 0 0 0 S 0.0 0.0 0:00.03 rcu_gp 4 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_par_gp ... ``` 4. at命令:在指定时间执行命令。 ```shell echo "echo 'hello world'" | at now + 1 minute ``` 输出结果: ``` job 1 at Sat Sep 18 14:16:00 2021 ``` 1分钟后,命令会自动执行,输出结果: ``` hello world ``` 5. kill命令:用于终止进程。 ```shell kill -9 1234 ``` 其中1234为要终止的进程PID。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值