Program and resource management: PS, top, free, SAR, kill, uname
①ps Syntax:
[Root @test/root]# ps-aux
Parameter description:
A: Select all the programs listed
U: All users ' programs are listed
x: All TTY programs are listed
Description: This is used to query the current host environment, in the background to execute the relevant program! I usually use the "Ps-aux" parameter to list all of the information to provide my own inspection program problem! In the above procedure, the following is stated:
- USER: Indicates which person the program belongs to;
- PID: The Code of the program;
- %CPU: How much CPU resources are used on behalf of the program;
- %MEM: Represents the amount of RAM used by the program;
- VSZ, RSS: The size of the ram taken up (bytes);
- TTY: Is the program executed for the login? If the TTY1-TTY6 is the local login, if it is pts/?? The program executed for the remote login
- STAT: The state of the program, (R) is executable, (S) for the program is sleeping, is not executed, (T) is detected or stopped, (Z) zombie program, is zombie dead program! You need to kill it!
- Start: The date the program started;
- Time: How long has the program been running?
- COMMAND: The contents of the program!
②top Syntax:
[Root @test/root]# top
Parameter description:
In the program that executes top, you can enter the following character utilises to sort
A: Sort by the chronological order of age and execution
T: Sort by start time
M: Sort by the size of the memory you occupy
P: Sort by CPU Resources consumed
Description
Using PS is a good management tool, but PS is not dynamic, if you use top, you can use dynamic (update every five seconds) way to detect the progress of the program! And in the program, you can also use P to sort CPU resources, use m to memory size and so on, very good management work!
③free Syntax:
[Root @test/root]# free
Parameter description:
-K: Display memory in Kbytes
-M: Display memory in MBytes
Description
Another view of system resources is to use free to check the current memory usage.
④sar
[Root @test/root]# sar [-u] [-r] number of seconds
Parameter description:
-U: See CPU usage
-r: See Memory use situation
Seconds: A few seconds of observation?
Number of times: a total of several observations
⑤kill
[Root @test/root]# kill-signal PID
Parameter description:
The-signal is the same as the above kill:
-9: Kill the Program
-15: Stop the program!
Example:
[Root @test/root]# kill-9 2380
Description
To kill a program, you naturally need to know the PID of the program line! Also, it is important to note that because many programs have affiliate relationships, such as sendmail may open up quite a few programs at the same time (if the volume of mail is large!). So, if the "subroutine" is cut off, it is impossible to kill the whole program! And to know the code (PID) of the program.
⑥uname
[Root @test/root]# uname [-APNR]
Parameter description:
-A: All system information is listed
-P: List CPU information
-N: List host name
-r: List kernel version information
Example:
[Root @test/root]# uname-a
"Programs and resources" Linux programs and resource management