Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Linux system performance analysis and top command ps.pstree Comments     - Linux Getting Started tutorial: build your own Vim (Linux)

- LAN Deployment Docker-- from scratch to create your own private warehouse Docker (Linux)

- Ubuntu clean up unnecessary disk space usage (Linux)

- CentOS 6.5 installation Python3.0 (Linux)

- Ubuntu 14.04 LTS 64-bit install GNS3 1.3.7 (Linux)

- Linux shell scripts bubble sort (Programming)

- Xshell key authentication mechanism using a remote login Linux (Linux)

- On the design of Oracle database backup (Database)

- Configuring Android NDK development environment for Mac OS X (Linux)

- NET Developers need to know some Linux commands (Linux)

- How to clean up your Ubuntu 14.10 / 14.04 / 13.10 system (Linux)

- Win7 used Eclipse to connect the virtual machine in Ubuntu Hadoop2.4 (Server)

- How ONLYOFFICE collaborative editing document on Linux (Linux)

- MySQL Tutorial: Building MySQL Cluster under Linux (Database)

- Disable unnecessary services under Linux (Linux)

- iOS persistence of data archiving NSKeyedArchiver (Programming)

- pureftpd basis: Install, configure, implement, anonymous logon (Linux)

- Java 8 stream parsed into SQL (Programming)

- Using C ++ Container Templates in Shared Memory (Programming)

- Upgrade installation manual CentOS6.5 GCC4.8.2 (Linux)

  Linux system performance analysis and top command ps.pstree Comments
  Add Date : 2018-11-21      
  Linux system performance analysis commonly used commands are ps pstree and top, etc. Today, we look in detail using the commands

 ps command is a command usually more common view of the process, ps displays the status of instant process is not dynamic changes; If you want to process run-time monitoring, you need to use top tool.
 ps command is the most basic, but also very powerful process view command. The display of information can determine which process is running, which process is suspended, how long the process has been running, the process is using the resource, the relative priority of the process, and the process flag number (PID). All this information is useful for users, more important for system administrators.
 Common parameters:
 -A List all trips
-w Display widening can display more information
 -au display more detailed information
 -aux display all trips include other users

-e show all processes, environment variables
 -f full format
 -h does not display the title
 -l long format
 -w wide output
 Ground on a display terminal all processes, including processes to other users
 r to display only the running process
 x terminal to display no control process

We used a combination of options is aux or lax, there are parameters f applications.
 More commonly used is ps -ef | grep XXXX ps -aux and the like can be displayed to facilitate the process pid number of suspended animation and kill off the process you want to close.

pstree: Display process status tree, pstree command to list the current process, and their tree structure. The main options are as follows.
-a: Displays the command execution with the complete set of parameters.
-c: Cancel program of the same name, the combined display.
-n: PID size in order.
-p: display PID.
-u: display UID information.
Use the ps command to get accurate data, but the data is huge, which is to grasp the overall system before it is not easy. pstree command just to make up for this deficiency. It can display the current program execution in a tree structure. pstree support command to specify a particular program (PID) or user (USER) as the starting display.
Frequently used commands
pstree -a display all information
pstree -p pid number display process

top command to display the current process status.
top is a dynamic display of process, that can be constantly refreshed by the user key to the current state. If you execute the command in the foreground, it will monopolize the front desk until the user terminates the program so far. more accurate to say, top command provides a real-time system the processor will display the status of the monitoring system CPU the most "sensitive" task list command can use CPU memory usage and execution time on the task sort;.. and many of the features of the order are available through an interactive command or set in the personal customization file.

The first line item represents in the order of
16:00 Current time
updays 15 system startup time
The number of users of the current system login user
load average load average. Three values ​​of 1 minute, 5 minutes, respectively, to the present 15 minutes before the average
The second line shows all started, currently running, hang (Sleeping) and useless (Zombie) process.

Tasks: The total number of 504 total process
1 running process running number
Process 503sleeping Sleep Number
0 stopped to stop the number of processes
0 zombie zombie number of processes
The third line shows the current CPU usage, including the proportion occupied by the system, the proportion of users, idle (Idle) ratio.
Cpu (s): 0.3% us user space occupied by the percentage of CPU
1.0% sy CPU kernel space occupancy percentage
Within 0.0% ni user process space, changed the process priority of CPU-percentage
100% id CPU idle percentage
Percentage of 0.0% wa waiting for input and output of CPU time
0.0% hi
0.0% si

The fourth line shows the physical memory usage, including total usable memory, used memory, free memory, the memory buffer
Mem: 16280612k total amount of physical memory
The total amount of physical memory used 879588k used
15401024k free amount of free memory
The amount of memory used for the kernel cache 110296k buffers

The fifth line shows swap usage by partitions, including the total, used and free for caching swap.
Swap: 8191992k total amount of total swap
Total 0 k used swap use
The total amount of swap free 8191992k free
491708k cached buffer swap of the total area.
The contents of memory to be swapped out to the swap area, and later was changed into memory, but the used swap has not been covered, the value is the size of the content already exists in memory swap area. Corresponding memory again can no longer be written to swap when swapped out.
Process information area below the area of ​​statistical information shows the details of each process
PID process id
PPID parent process id
RUSER Real user name
User id UID process owner
Username USER process owner
The process owner group name GROUP
TTY terminal name starts the process. The process was not started from the terminal is displayed as?
PR Priority
NI nice value. A negative value indicates a high priority, a positive value indicates a low priority
CPU P last used, only makes sense in a multi-CPU environment
% CPU last update to the current occupancy percentage of CPU time
TIME + CPU time used by the process of total unit 1/100 sec
% MEM Percentage of physical memory used by the process
VIRT total virtual memory used by the process, the unit kb. VIRT = SWAP + RES
SWAP process virtual memory in use, to be swapped out the size in kb.
RES process uses, not swapped out of physical memory size, unit kb. RES = CODE + DATA
CODE executable code amount of physical memory size, unit kb
DATA executable code other than the part (data segment + stack) the amount of physical memory size, unit kb
SHR shared memory size, unit kb
nFLT number of page faults
nDRT last write to the present, the number of pages have been modified.
S process status.
D = uninterruptible sleep state
R = Run
S = sleep
T = trace / Stop
Z = zombie process
COMMAND command name / command line
WCHAN if the process is sleeping, it shows the system sleep function name
Flags Task Flags, reference sched.h

To commonly used parameters
d each specified time interval between two screen refreshes information. Of course, users can use the s interactive command to change it.
p to only monitor the status of a monitoring process by specifying the process ID.
q This option will allow top to refresh without any delay. If the caller has superuser privileges, then the top priority will be run as high as possible.
S Specifies cumulative mode
s so top command to run in safe mode. This will remove the potential dangers posed by interactive commands.
i so top does not show any idle or zombie processes.
c show the entire command line rather than just display the command name
- Shutdown - an advanced shutdown artifact (Linux)
- Java keyword final, static (Programming)
- Oracle 12c PDB Analysis (Database)
- Reset CentOS / RHEL root account password 7 (Linux)
- Linux memory management -free learning experience (Linux)
- To generate a certificate using OpenSSL under Linux (Server)
- To get Java class / jar package path (Programming)
- Linux Shell debugging (Programming)
- VPS xen openvz kvm (Server)
- CentOS 6.4 RPM install MySQL-5.6.22-1 (Database)
- Java interface and inheritance (Programming)
- Use Android Studio and Gradle packaged multi-version APK (Programming)
- With screenfetch linux logo and basic hardware information display with cool Linux logo (Linux)
- Let 32 Linux / CentOS system to support more than 4G memory (Linux)
- Use window.name + iframe cross-domain access to data Detailed (Programming)
- CentOS install pip (Linux)
- Install Xshell on Mac OS X (Linux)
- How to use awk command in Linux (Linux)
- Ubuntu 15.04 and Ubuntu 14.04 installed Cinnamon 2.6 (Linux)
- MySQL Tutorial: Building MySQL Cluster under Linux (Database)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.