• Contact
  • About Me
  • Privacy Policy
DefenceDev
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
No Result
View All Result
DefenceDev
No Result
View All Result
ADVERTISEMENT
Home Linux Tutorials Commands

Linux Process, List all Running Services with ps Command

neo by neo
May 27, 2025
in Commands
0
Linux Process, List all Running Services with ps Command

Linux Process, List all Running Services with ps Command

0
SHARES
6
VIEWS
Share on FacebookShare on Twitter
ADVERTISEMENT

List Running Services with ps Command

In this article, we will see how to use the ps command to list all running services on Linux. In Linux, a process is an instance of a running program. Each process has a unique Process ID (PID) and can be in various states such as running, sleeping, or stopped. Services, on the other hand, are background processes that perform specific tasks, often started at boot time and managed by the system’s init system (like systemd or init).

You can check more details about ps command on the following link.

The ps Command

The ps (process status) command is used to display information about active processes. It provides a snapshot of the current processes, including details like PID, user, CPU usage, memory usage, and more.

ADVERTISEMENT

Listing All Running Services

To list all running services using the ps command, you can use various options and filters. Here are some common usages:

Basic Usage

ps -e 
  • e: Shows all processes.

This command lists all processes running on the system.

Detailed Information

ps -ef 
  • e: Shows all processes.
  • f: Displays full-format listing.

The -f option provides a full-format listing, including additional details like the parent process ID (PPID) and the command that started the process.

Filtering by Service Name

ps -ef | grep <service_name> 

Replace <service_name> with the name of the service you want to filter. This command helps you find specific services.

Using ps with aux

ps aux 
  • a: Shows processes for all users.
  • u: Displays the user-oriented format.
  • x: Shows processes not attached to a terminal.

The aux options provide a detailed listing of all processes, including those not started by the current user.

Detailed Options

  • ps -A or ps -e: Show all processes.
  • ps -a: Show all processes except session leaders and processes not associated with a terminal.
  • ps -u [username]: Show processes for a specific user.
  • ps -p [pid]: Show information for a specific process ID.
  • ps --sort=[key]: Sort the output based on the specified key (e.g., %cpu, %mem, pid).
  • ps -o [format]: Customize the output format. For example, ps -o pid,cmd shows only the PID and command of each process.

Understanding the Output

When you run ps aux, you typically see columns like:

  • USER: The user who owns the process.
  • PID: The process ID.
  • %CPU: The percentage of CPU usage.
  • %MEM: The percentage of memory usage.
  • VSZ: Virtual memory size.
  • RSS: Resident Set Size (the non-swapped physical memory that a task has used).
  • TTY: The terminal associated with the process.
  • STAT: The process state (e.g., S for sleeping, R for running).
  • START: The start time of the process.
  • TIME: The cumulative CPU time.
  • COMMAND: The command that started the process.

Useful Examples

Listing All systemd Services

systemd is a popular init system used in many Linux distributions. To list all systemd services, you can use:

ADVERTISEMENT
ADVERTISEMENT
ps -ef | grep systemd
ps -ef | grep systemd output on Ubuntu
ps -ef | grep systemd output on Ubuntu

This command will display all processes related to systemd, helping you identify active services.

List all Processes Sorted by Memory Usage

The command lists all running processes on a Linux system and sorts them in descending order by memory usage. Let’s break it down:

ps aux --sort=-%mem
  • ps: The process status command to view running processes.
  • aux:
    • a: Show processes for all users (not limited to the current session).
    • u: Display output in a user-oriented format, including user, CPU usage, memory usage, etc.
    • x: Show processes without a controlling terminal (e.g., daemon processes).
  • --sort=-%mem:
    • --sort: A flag to sort the output.
    • -%mem: Specifies the sorting column, which is %mem (percentage of memory usage).
    • The - (negative) sign ensures the output is sorted in descending order. Without the -, the processes would be listed in ascending order.

Display Specific Columns (PID, User, Command)

ps -eo pid,user,cmd
  • -e: Select all processes.
  • -o: Format the output. You can specify the columns you want to display.

Show Processes of a Specific User

ps -u username

Output of this command:

 PID TTY          TIME CMD
   2960 ?        00:00:00 systemd
   2962 ?        00:00:00 (sd-pam)
   3065 ?        00:00:00 sshd
   3066 pts/0    00:00:00 bash
   3159 pts/0    00:00:00 ps

Monitor the Memory Usage at Regular Intervals

watch -n 1 'ps aux --sort=-%mem | head -n 10'
Monitor the memory usage at regular intervals
Monitor the memory usage at regular intervals

Conclusion

The ps command is a powerful tool for monitoring processes and services in a Linux system. Whether you’re diagnosing system performance issues, troubleshooting services, or managing running applications, ps provides flexibility and control.

Key Features

  • Display running processes with extensive details (PID, USER, CPU, MEMORY usage, COMMAND, and more).
  • Format output with custom columns using the -o option.
  • Sort processes based on specific criteria like CPU or memory usage (--sort flag).

You can also check this possibility of Process Management

About The Author

neo

See author's posts

ADVERTISEMENT
Previous Post

Lesson 11: Practical Linux Bash Examples and Projects

Next Post

Nextcloud: How to Upgrade Nextcloud via the Web Interface

neo

neo

Next Post
NextCloud dashboard screenshot

Nextcloud: How to Upgrade Nextcloud via the Web Interface

Follow Us

  • Trending
  • Comments
  • Latest
MikroTik: Export Configuration in Text File

MikroTik: Export Configuration in Text File

Fortinet FortiGate: Static Route Configuration via GUI and CLI

Fortinet FortiGate: Static Route Configuration via GUI and CLI

Immich: Installation on Ubuntu 22.04

Immich: Installation on Ubuntu 22.04

Fortinet FortiGate Upgrade Path Tool

Fortinet FortiGate Upgrade Path Tool

NextCloud: Port Forwarding - Essential Ports for Smooth Functionality

NextCloud: Port Forwarding – Essential Ports for Smooth Functionality and Remote Access

Organizing and Managing Photos with Immich: Features I Use

Organizing and Managing Photos with Immich: Features I Use

Install Ubuntu 22.04 on Oracle VM Virtual Box

Install Ubuntu 22.04 on Oracle VM Virtual Box

Linux Directories: cd (Change Directory), pwd (Print Working Directory), mkdir (Make Directory)

Linux Directories: cd (Change Directory), pwd (Print Working Directory), mkdir (Make Directory)

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

Recent News

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nginx Proxy Manager on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

Install Docker on Raspberry Pi 4 with Ubuntu 22.04

MikroTik: Check Your Wireless Password

MikroTik: Check Your Wireless Password

ADVERTISEMENT

DefenceDev Tutorials

defencedev Logo

Whether you’re just starting or looking to expand your skills, I hope you find useful information and engaging discussions here. Let me take you through my journey and the goals behind this space!

Follow Us

Browse by Category

  • Blog
  • Cloud
    • Private
  • Linux Tutorials
    • Bash Scripting Tutorials
    • Commands
    • Networking
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Solutions
    • Docker
  • Video Tutorials
    • MikroTik Videos

Recent News

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install WordPress on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

Install Nextcloud on Raspberry Pi 4 with Docker (Ubuntu 22.04)

  • Site Map
  • Privacy Policy
  • Facebook Page
  • Disclaimer
  • Contact
  • About Me

© 2025 defencedev.com - All rights reserved.

No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos

© 2025 defencedev.com - All rights reserved.