• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

30 Useful ‘ps Command’ Examples for Linux Process Monitoring

How VPS by How VPS
November 2, 2018
in Linux, Operating System
0
0
SHARES
56
VIEWS
Share on FacebookShare on Twitter

Contents

  1. List All Processes in Current Shell
  2. Print All Processes in Different Formats
  3. Display User Running Processes
  4. Print All Processes Running as Root (Real and Effecitve ID)
  5. Display Group Processes
  6. Display Processes by PID and PPID
  7. Display Processes by TTY
  8. Print Process Tree
  9. Print Process Threads
  10. Specify Custom Output Format
  11. Display Parent and Child Processes
  12. Troubleshoot Linux System Performance
  13. Print Security Information
  14. Perform Real-time Process Monitoring Using Watch Utility

ps (processes status) is a native Unix/Linux utility for viewing information concerning a selection of running processes on a system: it reads this information from the virtual files in /proc filesystem. It is one of the important utilities for system administration specifically under process monitoring, to help you understand whats is going on a Linux system.

It has numerous options for manipulating its output, however you’ll find a small number of them practically useful for daily usage.

Read Also: All You Need To Know About Processes in Linux [Comprehensive Guide]

In this article, we’ll look at 30 useful examples of ps commands for monitoring active running processes on a Linux system.

Note that ps produces output with a heading line, which represents the meaning of each column of information, you can find the meaning of all the labels in the ps man page.

List All Processes in Current Shell

1. If you run ps command without any arguments, it displays processes for the current shell.

$ ps 
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

List Current Running Processes

Print All Processes in Different Formats

2. Display every active process on a Linux system in generic (Unix/Linux) format.

$ ps -A
OR
$ ps -e
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

List Processes in Standard Format

3. Display all processes in BSD format.

$ ps au
OR
$ ps axu
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

List Processes in BSD Format

4. To perform a full-format listing, add the -f or -F flag.

$ ps -ef
OR
$ ps -eF
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

List Processes in Long List Format

Display User Running Processes

5. You can select all processes owned by you (runner of the ps command, root in this case), type:

$ ps -x 

6. To display a user’s processes by real user ID (RUID) or name, use the -U flag.

$ ps -fU tecmint
OR
$ ps -fu 1000
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

List User Processes by ID

7. To select a user’s processes by effective user ID (EUID) or name, use the -u option.

$ ps -fu tecmint
OR
$ ps -fu 1000

Print All Processes Running as Root (Real and Effecitve ID)

8. The command below enables you to view every process running with root user privileges (real & effective ID) in user format.

$ ps -U root -u root 
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

Display Root User Running Processes

Display Group Processes

9. If you want to list all processes owned by a certain group (real group ID (RGID) or name), type.

$ ps -fG apache
OR
$ ps -fG 48
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

Display Group Processes

10. To list all processes owned by effective group name (or session), type.

$ ps -fg apache

Display Processes by PID and PPID

11. You can list processes by PID as follows.

$ ps -fp 1178
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

List Processes by PID

12. To select process by PPID, type.

$ ps -f --ppid 1154
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

List Process by PPID

13. Make selection using PID list.

$ ps -fp 2226,1154,1146
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

List Processes by PIDs

Display Processes by TTY

14. To select processes by tty, use the -t flag as follows.

$ ps -t pst/0
$ ps -t pst/1
$ ps -ft tty1
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

List Processes by TTY

Print Process Tree

15. A process tree shows how processes on the system are linked to each other; processes whose parents have been killed are adopted by the init (or systemd).

$ ps -e --forest 
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

List Process Tree

16. You can also print a process tree for a given process like this.

$ ps -f --forest -C sshd
OR
$ ps -ef --forest | grep -v grep | grep sshd 
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

List Tree View of Process

Print Process Threads

17. To print all threads of a process, use the -H flag, this will show the LWP (light weight process) as well as NLWP (number of light weight process) columns.

$ ps -fL -C httpd
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

List Process Threads

Specify Custom Output Format

Using the -o or –format options, ps allows you to build user-defined output formats as shown below.

18. To list all format specifiers, include the L flag.

$ ps L

19. The command below allows you to view the PID, PPID, user name and command of a process.

$ ps -eo pid,ppid,user,cmd
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

List Processes with Names

20. Below is another example of a custom output format showing file system group, nice value, start time and elapsed time of a process.

$ ps -p 1154 -o pid,ppid,fgroup,ni,lstart,etime
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

List Process ID Information

21. To find a process name using its PID.

$ ps -p 1154 -o comm=
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

Find Process using PID

Display Parent and Child Processes

22. To select a specific process by its name, use the -C flag, this will also display all its child processes.

$ ps -C sshd
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

Find Parent Child Process

23. Find all PIDs of all instances of a process, useful when writing scripts that need to read PIDs from a std output or file.

$ ps -C httpd -o pid=
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

Find All Process PIDs

24. Check execution time of a process.

$ ps -eo comm,etime,user | grep httpd

The output below shows the HTTPD service has been running for 1 hours, 48 minutes and 17 seconds.

30 Useful ‘ps Command’ Examples for Linux Process Monitoring

Find Process Uptime

Troubleshoot Linux System Performance

If your system isn’t working as it should be, for instance if it’s unusually slow, you can perform some system troubleshooting as follows.

26. Find top running processes by highest memory and CPU usage in Linux.

$ ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head
OR
$ ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

Find Top Running Processes

27. To kill an Linux processes/unresponsive applications or any process that is consuming high CPU time.

First, find the PID of the unresponsive process or application.

$ ps -A | grep -i stress

Then use the kill command to terminate it immediately.

$ kill -9 2583 2584
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

Find and Kill a Process

Print Security Information

28. Show security context (specifically for SELinux) like this.

$ ps -eM
OR
$ ps --context
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

Find SELinux Context

29. You can also display security information in user-defined format with this command.

$ ps -eo  euser,ruser,suser,fuser,f,comm,label
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

List SELinux Context by Users

Perform Real-time Process Monitoring Using Watch Utility

30. Finally, since ps displays static information, you can employ the watch utility to perform real-time process monitoring with repetitive output, displayed after every second as in the command below (specify a custom ps command to achieve your objective).

$ watch -n 1 'ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head'
30 Useful ‘ps Command’ Examples for Linux Process Monitoring

Real Time Process Monitoring

Important: ps only shows static information, to view frequently updated output you can use tools such as htop; top and glances: the last two are in fact Linux system performance monitoring tool.

You might also like to read these following related articles.

  1. How to Find a Process Name Using PID Number in Linux
  2. Find Top Running Processes by Highest Memory and CPU Usage in Linux
  3. A Guide to Kill, Pkill and Killall Commands to Terminate a Process in Linux
  4. How to Find and Kill Running Processes in Linux
  5. How to Start Linux Command in Background and Detach Process in Terminal

That’s all for now. If you have any useful ps command example(s) to share (not forgetting to explain what it does), use the comment form below.

Source: tecmint.com

Tags: Linux Commandslinux guidelinux vps setup guide
Previous Post

12 Useful Commands For Filtering Text for Effective File Operations in Linux

Next Post

How to Stop and Disable Unwanted Services from Linux System

Next Post

How to Stop and Disable Unwanted Services from Linux System

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet