& Amp; background work operator ctrl & amp; 43; z pause ctrl & amp; 43; c stop jobs [-l (list), r (runningjobs ), -s (stopjobs)] observe the background work status fg % jobnumber to get the background work to the foreground to execute bg
& Background work operator
Ctrl + z pause
Ctrl + c stop
Jobs [-l (list), r (running jobs),-s (stop jobs)] observe the background work status
Fg % jobnumber: get the background work to the foreground for execution
Bg % jobnumber changes the work in the background status to running (the work in the background is suspended by ctrl)
========================================================== ========================
Kill-l ==> List the signal that q can use
Common kill signal
-1 re-read the parameter location file (similar to reload)
-2 is the same as ctrl I.
-9 immediately force stop a job (the. filename. swap file will be left in the system)
-15 stop a job normally
Kill signal PID or [% jobnumber] (send a one-day command to the process)
==========================================
All the work in the above evaluation background is that you log on to a derived child process and cannot continue to execute it after you log out.
Offline management
If the job takes a long time, you can use at to process the job instead of stopping it until it is executed. at is to place the job in the background of the system, and it has nothing to do with the terminal.
================================
Program management
Find the most system-consuming program
Find out the problematic program in the memory
Set the program priority
Program observation
Ps obtains the operation status of the process at a certain time point.
Ps does not add the-a or-A parameter to list only process information related to itself.
Aux observes the data of all processes in the system.
-All processes of A are displayed as-e.
-A is not related to all terminal programs
-U process related to valid user
-L list detailed information, including pid
========================================================== ========
[Root @ Sweety/] # ps-l
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
4 S 0 2685 2683 0 80 0-27117 wait pts/1 00:00:00 bash
4 S 0 3232 1 0 80 0-27050 wait pts/1 00:00:00 mysqld_safe
4 R 0 3647 2685 0 80 0-27033-pts/1 00:00:00 ps
F: indicates the flag of the program, indicating the summary permission of the program.
4 represents root
S: represents the state of the program
R (Running)
S (sleep)
T (stop)
Z (Zombie)
C: indicates the CPU usage.
ADDR (address): indicates the part of the program's memory in the kernel function. if it is a running program, it usually displays-
SZ (size): memory used by the program
WCHAN: indicates whether the program is running-indicates that the program is running
TIME +: The accumulated cpu TIME used
CMD: command used to trigger a process
RSS: the size of memory occupied by processes
========================================================== ==========
Top: dynamically observe program changes
-D: time difference of the number dynamic update
-B: top execution in batches (usually used with redirection and-n)
-N: used with-B, meaning that the result of top output needs to be executed several times.
-P process pid: observe the process of the specified pid
Top keys can be used during execution
? : Displays the key commands that can be entered in top
P: Sort by cpu usage (default)
M: Sort by Memory usage
N: Sort by pid
T: sort by the cpu accumulation time occupied by the process
R: rename a nice value for the PID (press r and enter the pid number to be modified)
1: Switch to view the load rate of different CPUs
Q: Leave
========================================================== ==================
Pstree
-U: list the PID of each process simultaneously
-P: list the accounts of each process at the same time.
========================================================== ====================
Priority and nice
The PRI value is a core dynamic adjustment. users cannot directly adjust the PRI value. if you want to adjust the PRI value, you have to use the nice value. In general, the relationship between PRI and NI is as follows:
PRI (new) = PRI (old) + nice (can be-20 ~ Between 19)
However, if the original value of Ele. me PRI is 50, instead of giving nice = 5, we will change PRI to 55, because PRI is determined dynamically by the system, nice values can affect PRI, but the final PRI value is determined only after system analysis)
Generally, you can only adjust the nice value of your process and increase the nice value.
Adjusting the priority of the process is to adjust the nice value of the process.
How to adjust the nice value of a program
1. a specific nice value is given when the program is executed at the beginning: the nice command is used.
Nice-n numeric command (program startup command)
-N is followed by a value (-20 ~ 19)
2. re-adjust the nice of an existing process (or top): renice
Renice value (to be adjusted to ele. nice value) PID (PID of the adjusted process)
========================================================== ============================
We can use top to observe a lot of system resources and statuses, and some other tools can also view system resources.
Free [-m is displayed in MB]
========================================================== ==============================
Uname: view the core information of the system
-A: all
-S: System Core name (Linux)
-R: Core version (2.6.32-358. el6.x86 _ 64)
-P: CPU type (x86_64)
-I: hardware platform (x86_64)
========================================================== ============================
Uptime: observe the system startup time and load (in fact, the first line of the top command is displayed in red)
========================================================== ============================
Netstat: tracks network or slot files
-A: All
-T: lists the data of tcp packets.
-U: list UDP steam package data
-L: list the services currently being monitored.
-P: Display PID
========================================================== ============================
------ Part 1 ---- meaning of related fields ----------
Proto: network packet protocol, mainly for tcp and udp
Recv-Q: Number of bytes copied from a non-remote host to this socket
Send-Q: total number of bytes of acknowledged transmitted by a non-remote host
Local Address: Local IP: port
Foreign Adresses: IP Address: Port of the remote host
State: online status, mainly including ESTABLISHED and LISTEN)
The meaning of/proc /*
Processes are in the memory, and data in the memory is written to the/proc/* Directory. Therefore, we can directly observe the files in the/proc directory.
========================================================== ============================
Fuser: find the program that is using this file
Sometimes we want to know how many files a program has opened during this startup process. we can use fuser to check the files.
Example: fuser-uvm/proc ==> check how many programs are being accessed by the/proc file system.
========================================================== ==============================
Lsof: list file names opened by programs
========================================================== ==============================
Pidof: list the pid of a program being executed
Pidof [-sx] program_name
-S: only one PID is listed, not all
-X: list the PID of The PPID program that may have the program name.