How to view all running processes (PS) in Linux

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:

# 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.

# ps-a# PS-E

tasks: Viewing non-root running processes

# ps-u Root-u root-n

Task: View the process that the user Vivek runs

# 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:

# Top

Output:

Figure 1:top Command: displaying Linux tasks

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.

$ pstree

Output Example:

Figure 2:pstree-Show the tree of the process

Task: Using the PS print process tree

# ps-ejh# PS AXJF

Task: Getting thread information

Enter the following command:

# ps-elf# PS AXMS

Task: Get security information

Enter the following command:

# 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:

# top-b-N1 >/tmp/process.log

You can also send your results to yourself via email:

# Top-b-n1 | Mail-s ' Process snapshot ' [email protected]

tasks: Finding processes

Use the Pgrep command. Pgrep can find the currently running process and lists the process IDs that match the criteria. For example, show the process ID of Firefox:

$ pgrep Firefox

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

$ pgrep-u Root sshd

Say hello to htop and atop.

Htop is a top-like interactive process viewing tool, but you can scroll vertically and horizontally to see all the processes and their command line. The associated operation of the process (killing,renicing) does not require a PID input. To install the Htop Input command:

# Apt-get Install Htop

Or

# yum Install Htop

At the command prompt, enter Htop:

# Htop

Output Example:

Figure 3:htop-interactive Linux/unix Process Viewer

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:

# atop

Output Example:

Figure 4:at Computing ' s System & Process Monito

How to view all running processes (PS) in 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.