#6. Process Management for Linux

Source: Internet
Author: User

A process is an entity that a program runs, and a child process (thread) under a process.Process StatisticsTo start the process statistics, you must first prepare the Accton recorded files
  1. touch /var/log/pacct #创建记录所用的文件
  2. accton /var/log/pacct #激活accton
  3. accton #关闭accton
  4. lastcomm -f /var/log/pacct #查看进程统计记录的文件
The background runs a task that takes a long time to run, put it in the background to run it so that you can enter a command to run after using the shortcut key CTRL + Z use jobs to view the background process queue and put the background suspended process back into the foreground executionFG 1
To view the currently running process, you can use PS aux to view the status of the process
  1. [[email protected] ~]$ ps
  2. PID TTY TIME CMD
  3. 2064 pts/200:00:00 bash
  4. 2122 pts/200:00:00 ping
  5. 2123 pts/200:00:00 ps
Process State tree
  1. [[email protected] ~]$ pstree
  2. init─┬─NetworkManager
  3. ├─abrtd
  4. ├─acpid
  5. ├─atd
  6. ├─auditd───{auditd}
  7. ├─automount───4*[{automount}]
  8. ├─certmonger
  9. ├─crond
  10. ├─cupsd
  11. ├─dbus-daemon───{dbus-daemon}
  12. ├─hald─┬─hald-runner─┬─hald-addon-acpi
  13. ││└─hald-addon-inpu
  14. │└─{hald}
  15. ├─master─┬─pickup
  16. │└─qmgr
  17. ├─6*[mingetty]
  18. ├─modem-manager
  19. ├─ntpd
  20. ├─2*[ping]
  21. ├─rhsmcertd
  22. ├─rpc.statd
  23. ├─rpcbind
  24. ├─rsyslogd───3*[{rsyslogd}]
  25. ├─sshd───sshd───sshd───bash─┬─ping
  26. │└─pstree
  27. ├─udevd───2*[udevd]
  28. └─wpa_supplicant
Shows that the difference between PS and top is that top can dynamically show the progress of the processKill Process
  1. kill 进程号
  2. #如终止后台的ping进程
  3. [[email protected] ~]$ ps
  4. PID TTY TIME CMD
  5. 2064 pts/200:00:00 bash
  6. 2122 pts/200:00:00 ping
  7. 2168 pts/200:00:00 ps
  8. [[email protected] ~]$ kill 2122
Kill the foreground process using CTRL + C to find the process
    1. pgrep -l sshd #查询ssh的进程



From for notes (Wiz)



#6. Process Management for 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.