ps
The ps command, short for „process status“, is used to display information about currently running processes on your system. This includes details such as process IDs, user accounts associated with them, CPU usage, memory consumption, and more.
Basic Use Case
You can use the ps command in various forms, depending on your needs. Here are a few basic examples:
ps: This will display information about all running processes for the current user.ps -ef: This option displays detailed information about every process on the system.-emeans to list all processes (-e stands for „all“ in some systems, while others use it as a long format option).-fis used with other options like-e,-u, or-pand causespsto display detailed information about each process.
Advanced Use Cases
For those familiar with filtering processes based on criteria like user names (-u) or specific IDs (-p), the following examples illustrate how versatile ps can be:
ps -fu username: Displays all processes running under a specified user account.ps -fp process_id: Shows detailed information about a process identified by its ID.
Special Hacks
If you’re dealing with a system where there are many processes and want to see them in a more readable format, here’s a trick:
- Use
ps auxorps -eflinstead ofps auxf. The latter provides more information about each process but in a less cluttered way compared to the traditional output ofps aux.
Necessity Level
Understanding and mastering basic uses of the ps command is essential for Linux users at an intermediate level. This includes system administrators, those who manage their own servers, and developers who work on their local machines. For beginners, learning about ps can be a bit challenging without prior knowledge of Linux processes and how they are managed.
Therefore, I would categorize the necessity of this command for different levels of experience as follows:
- Beginner: Not immediately necessary but useful to know.
- Intermediate: Essential to understand basic usage and filtering options.
- Advanced: Familiarity with more advanced options like
-fuor-fpcan be helpful in specific scenarios.
Remember, practice is the best way to become comfortable with any Linux command. Experimenting with ps will give you a good grasp of its capabilities and how it fits into your daily Linux work.