How to view all running processes in a Linux system

Source: Internet
Author: User

You can use the PS command. It can display information about the current running process, including the PID of the process. Both Linux and UNIX support the PS command, which displays information about all running processes.

The PS command can provide a snapshot of the current process. If you want the status to refresh automatically, you can use the top command.

PS command

Enter the following PS command to display all running processes:

1 # ps aux | less

 

which

-A: Show All processes

A: Show all processes that include other users in the terminal

X: Show the process without control terminal

Task: View each process in the system.

12 # ps -A# ps -e

tasks: Viewing non-root running processes

1 # ps -U root -u root -N

Task: View the process that the user Vivek runs

1 ps -u vivek

Task: Top command

The top command provides a dynamic, real-time view of the running system. At the command prompt, enter top:

1 # top

  

Output:

Press Q to exit and press H to enter help.

Task: Displays a tree view of the process.

Pstree displays the running process in a tree-like way. The root node of the tree is PID or init. If a user name is specified, the process tree takes the process owned by the user as the root node.

1 $ pstree

Output Example:

Task: Using the PS print process tree

12 # ps -ejH# ps axjf

  

Task: Getting thread information

Enter the following command:

# ps-elf# PS AXMS

Task: Get security information

Enter the following command:

123 # ps -eo euser,ruser,suser,fuser,f,comm,label# ps axZ# ps -eM

  

Task: Save a process snapshot to a file

Enter the following command:

1 # top -b -n1 > /tmp/process.log

You can also send your results to yourself via email:

1 # top -b -n1 | mail -s ‘Process snapshot‘you@example.com

  

123 任务:查找进程使用pgrep命令。pgrep能查找当前正在运行的进程并列出符合条件的进程ID。例如显示firefox的进程ID:

  

1 $ pgrep firefox

The following command displays the process named sshd and owner-root.

1 $ pgrep -u root sshd

  

123 向htop和atop说hellohtop是一个类似top的交互式进程查看工具,但是可以垂直和水平滚动来查看所有进程和他们的命令行。进程的相关操作(killing,renicing)不需要输入PID。要安装htop输入命令:

  

1 # apt-get install htop

Or

# yum Install Htop
At the command prompt, enter Htop:
1 # htop

Output Example:

 

Atop tools

Atop is an interactive monitoring tool for viewing the load on Linux systems. It demonstrates the use of critical hardware resources (from a performance perspective) at the system level, such as CPUs, memory, hard disks, and networks.

It can also show which process is causing a specific load based on the CPU and memory load at the process level, and if a kernel patch is installed, the hard disk and network load for each process can be displayed. Enter the following command to start atop:

1 # atop

Output Example:

Original link: http://hi.baidu.com/imlidapeng/blog/item/4ef37d634b58b957eaf8f83

How to view all running processes in a Linux system

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.