Brief Introduction to Linux Process Operation commands

Source: Internet
Author: User

Linux Process Management is a very important task and can help us better control the system. A process is an execution activity of a program on a computer. When you run a program, you start a process. Common process operation commands are described here.

Linux Process Operation Command 1: Ps Process status query command.

Command Format # ps [[Option]

Common options:
●-A: displays all user processes.
●-E: displays the process environment variables.
●-L, which provides a long list.
●-R: only running processes are displayed.
●-S, increase the CPU time and page error.
●-W: display the output in width format. By default, if the output result cannot be displayed in one row, the result output is shortened. This option can be used to avoid this problem.
●-Txx: Only processes controlled by tty. xx are displayed.
●-U: print the user format and display the user name and process start time.
●-X: displays processes without control terminals.

Command instructions:

Example:

Example A: all processes are displayed on the page, and the user name and start time of the process are displayed. The command is as follows:

 
 
  1. #ps -axu | more  
  2. USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND  
  3. root 1 0.2 0.1 1388 492 ? S 22:06 0:04 init  
  4. root 2 0.0 0.0 0 0 ? SW 22:06 0:00 [keventd]  
  5. root 3 0.0 0.0 0 0 ? SWN 22:06 0:00 [ksoftirqd/0]  
  6. root 4 0.0 0.0 0 0 ? SW 22:06 0:00 [kswapd]  
  7. root 5 0.0 0.0 0 0 ? SW 22:06 0:00 [bdflush]  
  8. root 6 0.0 0.0 0 0 ? SW 22:06 0:00 [kupdated]  
  9. root 8 0.0 0.0 0 0 ? SW 22:06 0:00 [kjournald]  
  10. root 1077 0.0 0.1 1360 400 tty4 S 22:09 0:00  
  11. /sbin/mingetty tty4  
  12. root 1078 0.0 0.1 1360 400 tty5 S 22:09 0:00  
  13. /sbin/mingetty tty5  
  14. root 1079 0.0 0.1 1360 400 tty6 S 22:09 0:00  
  15. /sbin/mingetty tty6  
  16. ........  

Description of the ps command output field:
● USER: the USER name of the process owner.
● PID and process ID, which can uniquely identify the process.
● % CPU, percentage of CPU time and total time occupied by the process since the last refresh.
● % MEM, percentage of memory used by processes.
● VSZ: the virtual memory used by the process, in the unit of K.
● RSS: the total number of physical memory occupied by processes, in K.
● TTY: the terminal name related to the process.
● STAT, Process status, used (R -- run or prepare to run; S -- sleep status; I -- idle; Z -- frozen; D -- uninterrupted sleep; w-the process does not reside on the page; T stops or tracks .) These letters.
● START: the process START time.
● TIME: the total cpu time used by the process.
● COMMAND: the COMMAND line to be executed.

Linux Process Operation Command 2: Kill the process command.

Command Format: # kill [[Option] [[Signal] <process number>

Common options:
●-S: Specifies the signal to be sent. It can be either a signal name or a number.
●-P: specify that the kill command only displays the PID of the process and does not actually send the end signal.
●-L: print the signal table that can be sent by kill, which can be found in the/usr/include/linux/signal. h file.

[[Signal]

Sends an optional signal. The default value is SIGTERM. The other two commonly used values are SIGHUP (the device that the modem suspends by phone) and SIGKILL (which cannot be ignored by the process ).

Command instructions:

Use this command to end the running program, which can achieve the "Task Manager" function in windows. Especially when a process is always running with no results like a dead machine, this command may kill the process and restore the system to normal.

Example:

Example A: Kill the cupsd process in Example. The command is as follows:

# Killed 945

Example B: display all kill signals.

 
 
  1. #kill -l  
  2. 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL  
  3. 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE  
  4. 9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2  
  5. 13) SIGPIPE 14) SIGALRM 15) SIGTERM 17) SIGCHLD  
  6. 18) SIGCONT 19) SIGSTOP 20) SIGTSTP 21) SIGTTIN  
  7. 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ  
  8. 26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO  
  9. 30) SIGPWR 31) SIGSYS 35) SIGRTMIN 36) SIGRTMIN+1  
  10. 37) SIGRTMIN+2 38) SIGRTMIN+3 39) SIGRTMIN+4 40) SIGRTMIN+5  
  11. 41) SIGRTMIN+6 42) SIGRTMIN+7 43) SIGRTMIN+8 44) SIGRTMIN+9  
  12. 45) SIGRTMIN+10 46) SIGRTMIN+11 47) SIGRTMIN+12 48) SIGRTMIN+13  
  13. 49) SIGRTMIN+14 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12  
  14. 53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8  
  15. 57) SIGRTMAX-7 58) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4  
  16. 61) SIGRTMAX-3 62) SIGRTMAX-2 63) SIGRTMAX-1  
  1. Linux inotify install and create a device
  2. Detailed discussion on Linux User Creation commands
  3. Fedora make uses tar-xzvf to unbind the package
  4. In-depth discussion on Linux partition Solutions
  5. Six advantages of Linux

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.