PS: View Permissions
Purpose: The ps command is used to view the status of processes in the system.
Usage: PS [Option]
The main options are as follows.
--A: displays information about all processes in the system.
--E: displays information about all processes.
--F: displays all information about a process.
--L: process information is displayed in long usage.
--R: only running processes are displayed.
--U: displays user-oriented usage (including user name, CPU, memory usage, and other information ).
--X: displays process information on all non-control terminals.
--P: displays the information of the process specified by the process ID.
--T: displays the process information on the specified terminal.
Note: to monitor and control the process, you must first understand the current process, that is, you need to view the current process. Ps command is the most basic and powerful process view command. Based on the displayed information, you can determine which process is running, which process is suspended, how long the process has been running, the resources used by the process, and the relative priority of the process, and the PID of the process ). All this information is useful to users and more important to system administrators. You can use the "PS aux" command to obtain all the information about the processes of all users on the terminal. The following describes the basic information about the processes in combination with Figure 4-3.
Figure 4-3 Ps aux command details
In the second line of code in Figure 4-3, user indicates the user who starts the process. PID indicates the process flag number. % CPU indicates the ratio of the CPU usage time of the process to the total running time of the process. % Mem indicates the percentage of memory occupied by the process and total memory. Vsz indicates the virtual memory occupied, in KB. RSS is the physical memory occupied by the process, in KB. Tty indicates the terminal corresponding to the process when it is created. Indicates that the process does not occupy terminals. Stat indicates the running status of the process, including the following code: D, uninterrupted sleep; R, ready (in the runable Queue); s, sleep; t, tracked or stopped; Z: terminated (zombie) process; Z: nonexistent, but cannot be eliminated; W: insufficient memory Paging for allocation; <, high-priority processes; N, low-priority processes; L, with memory paging allocated and locked in the memory (real-time system or I/O ). Start indicates the process start time. Time indicates the execution time. Command is the corresponding command name.
The application example is as follows.
(1) Sort processes by memory usage
# Ps auxw -- Sort = RSS
(2) During system maintenance, if the CPU load suddenly increases and you do not know which process is causing it
# Ps auxw -- Sort = % CPU
Title: Fast query of Linux core application commands
Author: Cao jianghua,Edited by Fang Jianguo
ISBN: 978-7-121-11149-5
Publication date: 2010Year7Month
Pricing:59.00RMB
Start: 16Open
Page number: 528Page
Internal Capacity Simplified Introduction
After more than a decade of development, the Linux operating system has been continuously improved and more applications have been made. Now, Linux Desktop is relatively mature, but the command line technology is still the core technology of Linux.
This book introduces the functions, syntaxes, options, typical application instances, and precautions of core management commands (including the latest virtualization management commands and SELinux management commands) under Linux Command lines, every command is described in detail and a large number of instances are described. This gives readers a quick and in-depth understanding of commands in Linux. The book is classified according to the functions of Linux commands for readers to query. Before reading this book, you do not need to have too much background knowledge, whether you are a Unix user, a new linux user, or even a Windows user who has never been in touch with Linux, you can easily understand and master the content, and quickly understand and use the Linux system of each release. This book uses the commands involved in RHEL 5.5 and also applies to other Linux distributions. It is a required reference for all Linux users.
Book Purchase address: Dangdang China Interactive publishing network
Related serialization:
Linux core application command quick query: crontab: set a timer
Linux core application command quick query serialized eight: Kill: Killing Processes
Linux core application command quick query serialized eight: BG: Running commands in the background
Linux core application command quick query serialization 6: Batch: execute commands when the system load level permits
Linux core application command quick query: ATQ: displays the command queues to be executed after the AT command is used.
Linux core application command quick query: at: scheduled Run Command
Linux core application command quick query: SA: Reports, cleans up, and maintains process statistical files
Linux core application command quick query serialization 2: lastcomm: displays information about previously used commands
Linux core command speed query: accton: Process statistics on enabling or disabling