YouTip LogoYouTip

Linux Comm Ps

[![Image 1: Linux Command Manual](#) Linux Command Manual](#) The Linux `ps` (short for process status) command is used to display the status of current processes, similar to the Task Manager in Windows. ### Syntax ps **Parameters**: * `ps` has many parameters; here we only list a few common ones and briefly explain their meanings. * `-A` List all processes. * `-w` Display wider output to show more information. * `-au` Show more detailed information. * `-aux` Show all processes, including those of other users. * `au(x)` Output format: USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND * USER: The owner of the process. * PID: Process ID. * %CPU: CPU usage percentage. * %MEM: Memory usage percentage. * VSZ: Virtual memory size used. * RSS: Resident memory size used. * TTY: Minor device number of the terminal (tty). * STAT: The state of the process: * D: Uninterruptible sleep state (usually for I/O processes). * R: Running. * S: Sleeping. * T: Stopped. * Z: Zombie process (defunct but not yet removed). * W: Not enough memory pages to allocate. * <: High-priority process. * N: Low-priority process. * L: Has memory pages locked in memory (real-time system or locked I/O). * START: Time when the process started. * TIME: CPU time used. * COMMAND: The command that was executed. ### Examples Find a specific process format: ps -ef | grep For example, to display php processes: # ps -ef | grep php root 794 1 0 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:00: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:00:00 kacpid 17 ? 00:00:00 kacpi_notify 18 ? 00:00:00 kacpi_hotplug 19 ? 00:00:27 ata/0……Some results have been omitted 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 00:00:00 ps Display information for a specified user: # ps -u root //Display 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:00: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:00:00 kacpid ……Some results have been omitted 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:00:00 dhclient 31211 ? 00:00:00 aptd 31302 ? 00:00:00 sshd 31374 pts/2 00:00:00 bash 31397 pts/2 00:00:00 ps Display all process information, including the command line: # ps -ef //Show all commands, along with the command line UID PID PPID C STIME TTY TIME CMD root 1 0 0 10:22 ? 00:00:02 /sbin/init root 2 0 0 10:22 ? 00:00:00 root 3 2 0 10:22 ? 00:00:00 [migration/0] root 4 2 0 10:22 ? 00:00:00 [ksoftirqd/0] root 5 2 0 10:22 ? 00:00:00 [watchdog/0] root 6 2 0 10:22 ? /usr/lib/NetworkManager……Some results have been omitted 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 1 0 17:46 ? 00:00:00 /usr/bin/python /usr/sbin/aptd root 31407 31374 0 17:48 pts/2 00:00:00 ps -ef [![Image 2: Linux Command Manual](#) Linux Command Manual](#)
← Linux Comm NiceLinux Comm Logout β†’