View process Commands
PS ps-elf|grep init|grep-v grep view init process ID number; PS aux |grep init |grep-v grep; PS aux will list all the processes in the system.
Top dynamic Display system commands. Press T to see only memory and swap partitions, as well as recovery. See only m tasks and CPUs. Displaying multiple CPU conditions 1
Htop Installing yum-y install Htop. If not, install the software repository first: RPM-IVH http://repository.it4i.cz/mirrors/repoforge/redhat/el6/en/i386/rpmforge/RPMS/ rpmforge-release-0.5.3-1.el6.rf.i686.rpm
Pgrep: Queries a specific ID number based on a specific condition. Pgrep "Init"; Pgrep-l "Init"; Pgrep-l-U root-t pts/0 View the commands executed by a user at a terminal.
Pstree: Displays the process tree information. You can display information about which processes have sub-processes. PSTREE-AUP Displays the process name ID number.
Adjusts the priority of the process. Only the root user can adjust the priority level of-20-20. A normal user can only adjust the priority level of 0-20.
Nice adjusts the priority of the non-running process. Nice-n-5 Htop, and then Htop can see that the htop of the NI column has a priority of-5.
Renice adjusts the priority of the running process. RENICE-5-P 2235 Sets the priority of process 2235 to-5. Ps-p 2235-o Ni,args See if the priority has changed.
How the process starts:
Manual start
1, front-start: User input command, directly execute the program.
2. Background start: Add "&" symbol to command line bit
Scheduled start
1. Use the AT command to set up a one-time scheduled task
2. Use the crontab command, set as a recurring scheduled task. 、
Pre-and post-process scheduling:
Front and rear switch: Top & System Returns a number, which can also be viewed with the jobs command, then the FG number is switched to the foreground. CTRL + C terminates execution.
CTRL + Z key combination: Suspends the current process, which is in the background and stops execution
Jobs command: View a list of tasks in the background
FG command: To restore a process in the background to the foreground to run, you need to led the task sequence number
Sleep command: Sleep can be used to delay the current move for a period of time. Length of time, can be followed by S, M, H or D where s is seconds, M is minutes, h is hour, D is day
Number
To terminate the running of a process
Kill:kill-9 2288
Killall:killall-9 sleep kills all sleep processes.
Pkill: Terminates a user's process based on a specific condition. W|grep-v "root" to view non-root users; pkill-9-T PTS/4 kicks the user out of TPS/4 terminal
Scheduled Task management at
One-time Scheduled tasks
Service Script Name:/ETC/INIT.D/ATD
Formatting: at [hh:mm] [YYYY-MM-DD]
At 23:00 Enter at
Shutdown-h now input command
Press Ctrl+d to exit
ATQ Viewing tasks
ATRM number, deleting scheduled tasks
ATQ View Task Confirmation Delete
Restrict users to use at
/etc/at.allow Allow List
/etc/at.deny deny List
Scheduled Task management
The crontab command can set the task periodically
Service Script Name:/etc/inid.d/crond
Crontab-e into crontab
CRONTAB-E-u user name Enter a task for a user
After exiting edit mode: Wq Save exit
Minute hour date Month Week Run_command command
A special method of representing time values
? * Indicates any time within the range
? That represents multiple discontinuous points of time in the interval
? -Represents a continuous range of time
? /LED time frequency of a fixed interval
? Application examples
? 0 17 * * 1-5 weeks to Friday daily 17:00
? 30 8 * * 1,3,5 per week, three or five 8:30
? 0 8-18/2 * * * 8 to 18 points every 2 hours
? 0 * */3 * * every 3 days
*/1 * * * */SBIN/SHUTDOWN-R Now restarts the computer every minute
Crontab-r Deleting a task
Crontab-r-u admin Deletes a user's task
The relationship between Linux programs and processes