How to use the common command ps in Linux
This article mainly introduces the Linux commonly used command ps how to use, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
Linux commonly used command ps (English spelling: process status) command is used to display the status of the current process, similar to the task manager of windows
Syntax ps [options] [--help] parameters: there are many parameters for ps. Only a few commonly used parameters are listed here and their meanings are briefly introduced.
-A lists all processes
-w display widening can display more information
-au displays more detailed information
-aux displays all itineraries that include other users
Au (x) output format:
USER PID% CPU% MEM VSZ RSS TTY STAT START TIME COMMANDD: uninterruptible sleep state (usually IO processes)
R: in progress
S: static state
T: suspend execution
Z: does not exist but cannot be eliminated for the time being
W: there are not enough memory pages to allocate
N: low priority stroke
L: there is paging allocation and locked in the memory (real-time system or An I beat O)
USER: itinerary owner
PID: pid
% CPU: occupied CPU utilization
% MEM: memory usage occupied
VSZ: size of virtual memory occupied
RSS: the amount of memory occupied
TTY: secondary device number of the terminal (minor device number of tty)
STAT: the status of the trip:
START: travel start time
TIME: time of execution
COMMAND: instructions executed
Instance to find the specified process format:
Ps-ef | grep process keywords such as processes that display php:
# ps-ef | grep php root 794 10 2020? 00:00:52 php-fpm: master process (/ etc/php/7.3/fpm/php-fpm.conf) www-data 951 794 0 2020? 00:24:15 php-fpm: pool www www-data 953 794 0 2020? 00:24:14 php-fpm: pool www www-data 954 794 0 2020? 00:24:29 php-fpm: pool www. Display process information:
# ps-A PID TTY TIME CMD 1? 00:00:02 init 2? 00:00:00 kthreadd 3? 00:00:00 migration/0 4? 00:00:00 ksoftirqd/0 5? 00:00:00 watchdog/0 6? 00:00:00 events/0 7? 00:00:00 cpuset 8? 00 netns 00 khelper 9? 00 netns 10? 00:00:00 async/mgr 11? 00:00:00 pm 12? 00:00:00 sync_supers 13? 00:00:00 bdi-default 14? 00:00:00 kintegrityd/0 15? 00:00:02 kblockd/0 16? 00:00:00 kacpid 17? 00 kacpi_notify 18? 00 pm 12? 00:00:00 sync_supers 13? 00:00:00 bdi-default 14? 00:00:00 kintegrityd/0 15? 00:00:02 kblockd/0 16? 00:00:00 kacpid 17? 00 ata/0. Omit some of the results 30749 pts/0 00:00:15 gedit 30886? 00:01:10 qtcreator.bin 30894? 00:00:00 qtcreator.bin 31160? 00:00:00 dhclient 31211? 00:00:00 aptd 31302? 00:00:00 sshd 31374 pts/2 00:00:00 bash 31396 pts/2 00VO 00 ps displays the specified user information
# ps-u root / / displays root process user information PID TTY TIME CMD 1? 00:00:02 init 2? 00:00:00 kthreadd 3? 00:00:00 migration/0 4? 00:00:00 ksoftirqd/0 5? 00:00:00 watchdog/0 6? 00:00:00 events/0 7? 00:00:00 cpuset 8? 00 cpuset 00 khelper 9? 00:00:00 netns 10? 00:00:00 async/mgr 11? 00:00:00 pm 12? 00:00:00 sync_supers 13? 00:00:00 bdi-default 14? 00:00:00 kintegrityd/0 15? 00:00:02 kblockd/0 16? 00 netns 00 kacpid. Omitted part of the result 30487? 00:00:06 gnome-terminal 30488? 00:00:00 gnome-pty-helpe 30489 pts/0 00:00:00 bash 30670? 00:00:00 debconf-communi 30749 pts/0 00:00:15 gedit 30886? 00:01:10 qtcreator.bin 30894? 00:00:00 qtcreator.bin 31160? 00 dhclient 31211? 00 sshd 31374 pts / 2 00:00:00 bash 31397 pts/2 00:00:00 ps displays all process information Along with the command line
# ps-ef / / Show all commands With command line UID PID PPID C STIME TTY TIME CMD root 100 10:22? 00:00:02 / sbin/init root 2 00 10:22? 00:00:00 [kthreadd] root 3 20 10:22? 00:00:00 [migration/0] root 4 20 10:22? 00:00:00 [ksoftirqd/0] root 5 20 10:22? 00: 00:00 [watchdog/0] root 6 20 10:22? / usr/lib/NetworkManager. Omit some results root 31302 2095 0 17:42-00:00:00 sshd: root@pts/2 root 31374 31302 0 17:42 pts/2 00:00:00-bash root 31400 10 17:46? 00:00:00 / usr/bin/python / usr/sbin/aptd root 31407 31374 0 17:48 pts/2 00:00:00 ps-ef Thank you for reading this article carefully I hope the article "how to use Linux commands ps" shared by the editor is helpful to everyone. At the same time, I also hope that you can support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!