ps Command in Linux

Learn via video courses
Topics Covered

Build an AI-First Career, Master the Complete Skillset

Choose from our industry-leading programs designed for career success

NSDC Certified

Modern Software and AI Engineering Program

Master full-stack development with AI integration

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Modern Data Science and ML with specialisation in AI

Advanced data science techniques with AI specialization

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Advanced AIML with Specialisation in Agentic AI

Deep dive into AIML with focus on Agentic systems

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

DevOps, Cloud & AI Platform Engineering

Build and manage AI-powered cloud infrastructure

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

AI Engineering Advanced Certification by IIT-Roorkee

Premier AI engineering certification from IIT-Roorkee

3 MonthsDuration
AI-LedCurriculum
Career SupportSupport
Program highlights
Go to Program
NSDC Certified

AI Forward Deployed Engineer Program

Full-stack engineering, production AI and client-facing consulting

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program

Overview

The ps command in Linux is a powerful tool for displaying information about running processes on your system. It allows you to view detailed information about the processes, including their resource usage, process IDs, and much more. In this article, we will explore the ps command in detail and learn how to use it effectively.

Linux ps Command Syntax

The syntax for the ps command is as follows:

Where:

  • Options: The various options available with the ps command

ps Command Options:

  • -a: Show processes for all users
  • -u: Display user-oriented format
  • -x: Include processes that do not have a controlling terminal
  • -e: Show information about all processes
  • -f: Display a full listing of processes with additional information
Sharpen Your Fundamentals with Free Learning

Example Usages

  • Viewing all running processes:

    Output:

    Explanation: This command displays a list of all running processes on the system. The output shows the process ID (PID), the terminal or pseudo terminal associated with the process (TTY), the amount of CPU time consumed by the process (TIME), and the command that started the process (CMD).

  • Viewing processes for all users:

    Output:

    Explanation: The -e option shows information about all processes, while the -f option provides a full listing of processes with additional information. The UID field displays the user ID of the owner of the process, while the PPID field shows the parent process ID. The C field displays the CPU utilization of the process, and the STIME field shows the start time of the process. The CMD field displays the command that started the process.

  • Viewing detailed process information:

    Output:

    Explanation: The aux options together provide a lot of detailed information about running processes, including the percentage of CPU and memory used by each process, the virtual memory size (VSZ) and resident set size (RSS) of each process, and the process state (STAT). The START field shows the start time of the process, and the TIME field shows the CPU time consumed by the process.

How Scaler Transformed Careers in Different Fields

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data
Hiring Partners:
GoogleGoogleAmazonAmazonMicrosoftMicrosoftFlipkartFlipkartAdobeAdobe1200+ more

Tips

  • To sort the output of the ps command by CPU usage, use the ps aux --sort=-%cpu command.

  • To display information about threads associated with each process, use the ps -eLf command.

  • To display processes in a tree-like format, use the ps axjf command.

Advanced Use Cases of ps Command in Linux

  • Displaying only specific processes:

    Output:

    Explanation: This command displays only the process specified by its process ID (PID). Replace <pid> with the actual process ID.

  • Displaying parent process information:

    Output:

    Explanation: This command displays the parent process of a specified process. Replace <pid> with the process ID of the child process, and <ppid> with the parent process ID.

  • Displaying the processes running on a specific terminal:

    Output:

    Explanation: This command displays the processes running on the specified terminal. Replace <tty> with the terminal name.

Turn Learning into Career Growth

1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary
1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary

Conclusion

  • The ps command is a powerful tool for displaying information about running processes on your Linux system.

  • The ps command can display detailed information about the processes, including their resource usage, process IDs, and much more.

  • By using various options with the ps command, you can view specific information about running processes that is relevant to your needs.

  • The ps command can be used to monitor and troubleshoot system performance issues, and it is a valuable tool for system administrators and developers.