Summary of linux Process Management commands

Source: Internet
Author: User

Summary of linux Process Management commands

# Processes Process Management # ps: view the list of threads executed by the current system for instantaneous state, not continuous state, for continuous status, you need to use the top name to view more common parameters. Use man ps to view ps # Show all processes details ps aux #-u to display a user's process list ps-f- u www-data #-C searches for the process ps-C apache2 # by name or command-sort in descending order based on the process cpu usage, view the first five processes-pcpu indicates that the ps aux -- sort =-pcpu | head-5 #-f displays the process hierarchy in descending order, in the case of parent and child processes, ps-f -- forest-C apache2 # Shows all child processes of a parent process ps-o pid, uname, comm-C apache2ps -- ppid 2359 # display all threads of a process-L parameter ps-p 3150-L # display Process execution time-o parameter ps-e-o pid, comm, etime # watch command can be used to capture ps display process watch-n 1' ps-e-o pid in real time, uname, cmd, pmem, pcpu -- sort =-pmem,-pcpu | head-15' # jobs: view the jobs command execution result of the processes running in the background, + indicates a current job. The minus sign table is a job after the current job. The jobs-l option displays the PID of all tasks, and the jobs status can be running or stopped, terminated, but if the task is Terminated (kill), shell deletes the process ID of the task from the List known in the Current shell environment; that is, the jobs command displays information about the running or suspended tasks in the background in the Current shell environment jobs # view the background operation process number jobs-p # view the terminated or exited tasks job-n # # Use the kill command to terminate a foreground process. You can use the Ctrl + C key to kill the process ID obtained through top or ps. The kill [-s Signal |-p] [-a] process ID... # Send the specified signal to the corresponding process. If no model is specified, SIGTERM (15) is sent to terminate the specified process. Kill 12 # It is equivalent to pressing Ctrl + C to kill-2 123 when running a process with a PID of 123 on the front end # if the program cannot be terminated," -KILL "parameter, the signal sent is SIGKILL (9 ), kill-9 123 # list all signal names # HUP 1 terminal disconnection # INT 2 interruption (same as Ctrl + C) # QUIT 3 Exit (same as Ctrl + \) # TERM 15 terminate # KILL 9 Force terminate # CONT 18 continue (unlike STOP, fg/bg command) # STOP 19 pause (same as Ctrl + Z) kill-l # obtain the value of the specified signal kill-l KILL # kill-u peidalinuxkill-9 $ (ps-ef | grep peidalinux) # Move the command in the background to the foreground to continue running the process 123 to the foreground to execute fg 123 # change a command that is paused in the background to continue running bg 123 # This command can continue to run the corresponding process after you exit the account or close the terminal. Nohup means that the output is redirected to myout. nohup command> myout in file. file 2> & 1 & # at: Schedule a task to execute a task at a specific time. # Format: at HH: MM YYYY-MM-DD // HH (hour): MM (minute) YYYY (year)-MM (month)-DD (day) # HH [am pm] + D (days) days // HH (hours) [am (morning) pm (afternoon)] + days (days) at (time) // execute an operation at 12: 00 with the at command set # at> useradd aaa // Add User aaa in the at command # ctrl + d // exit at command # tail-f/etc/ passwd // check whether a user aaa is added to the last 10 rows of the/etc/passwd file # After the task is scheduled, before executing the task, we can run the atq command to check whether the task is not executed by the system. After you start a scheduled task, you can run the atrm command to delete it if you do not want to start the scheduled task. Atrm 1 // Delete scheduled Task 1 # pstree command: list the current processes and their tree structure format: pstree [Option] [pid | user] pstree # nice command: change the priority level of program execution. The application priority value ranges from-20 ~ 19. The smaller the number, the higher the priority. Generally, the priority value (CPU usage value) of a common application is 0. If a common application has a higher priority level, the startup and running speed will be faster. Note that normal users can only ~ 19 to adjust the priority value of the application, only the super user has the right to adjust a higher priority value (from-20 ~ 19 ). Nice [-n <priority>] [-- help] [-- version] [command] nice-n 5 ls # sleep command: suspend the process for a period of time date; sleep 1 m; date # renice command allows you to modify the priority of a running process. The renice command can be used to adjust its priority when executing the command. # The parameter number has the same meaning as the number of the nice command. (1) users can only use the renice command for all their processes. (2) the root user can use the renice command on any process. (3) only the root user can improve the priority of the Process renice-5-p 5200 # nice Of the process whose PID is 5200 is set to-5 # The pmap command is used to display the memory status of one or more processes. It reports process address space and memory status information # pmap PID pmap 20367 # top to dynamically view process changes. Top ## crontab task scheduling # basic format: ###****** command # hour, day, month, and week commands # column 1st indicates minute 1 ~ 59 every minute, represented by * or */1 # The hour 1 ~ in the 2nd Column ~ 23 (0 indicates 0 points) # 3rd columns indicate date 1 ~ 31 ## column 4th indicates Month 1 ~ 12 ## 5th Column ID day of the week 0 ~ 6 (0 indicates Sunday) # Run the crontab-e command in the 6th column # Run the text editor to set the time table. The preset text editor is VI, if you want to use another text editor, set the VISUAL environment variable to specify the Text Editor (for example, setenv VISUAL joe) crontab-r # Delete the current time table crontab-l # list the current time table crontab file [-u user] #-replace the current crontab with the specified file. # Example 30 21 ****/usr/local/etc/rc. d/lighttpd restart # indicates restarting apache at every night. 45 4, 22 **/usr/local/etc/rc. d/lighttpd restart # restart apache on 4: 45, 10, and 22 every month. 10 1 ** 6, 0/usr/local/etc/rc. d/lighttpd restart # indicates restarting apache every Saturday or Sunday. 0, 30 18-23 ***/usr/local/etc/rc. d/lighttpd restart # indicates that apache is restarted every 30 minutes from to every day. * 23-7/1 ***/usr/local/etc/rc. d/lighttpd restart # restart apache every hour from PM to AM.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.