the ps command
DESCRIPTION
A look at a useful command for looking at the status of your processes in LinuxTRANSCRIPT
![Page 1: The ps Command](https://reader038.vdocument.in/reader038/viewer/2022100602/55895766d8b42acb638b45bb/html5/thumbnails/1.jpg)
The ps command
Kevin O'BrienWashtenaw Linux Users Group
http://www.lugwash.org
![Page 2: The ps Command](https://reader038.vdocument.in/reader038/viewer/2022100602/55895766d8b42acb638b45bb/html5/thumbnails/2.jpg)
2
What is ps?
● ps stands for Process Status● Gives a list of all processes
![Page 3: The ps Command](https://reader038.vdocument.in/reader038/viewer/2022100602/55895766d8b42acb638b45bb/html5/thumbnails/3.jpg)
3
Usage
● Type “ps” at the prompt, and you get very little
● Switches are key, as always● To get a complete list, for instance, type “ps
-A” (Note: Linux is case-sensitive)● Also, “ps -e” will give a complete list
![Page 4: The ps Command](https://reader038.vdocument.in/reader038/viewer/2022100602/55895766d8b42acb638b45bb/html5/thumbnails/4.jpg)
4
Other switches you might want
● -f give a full listing, i.e. more information about each process listed
● -u username will list all processes running by a specific user
● -l gives a long listing. This is even more data than in a full listing
![Page 5: The ps Command](https://reader038.vdocument.in/reader038/viewer/2022100602/55895766d8b42acb638b45bb/html5/thumbnails/5.jpg)
5
Combining switches
● You can use more than one switch at a time● Example: “ps -el” would give you a long
listing of all of your processes● Example: “ps -el -u username” would give
you a long listing of all processes owned by a certain username
![Page 6: The ps Command](https://reader038.vdocument.in/reader038/viewer/2022100602/55895766d8b42acb638b45bb/html5/thumbnails/6.jpg)
6
Common use
● The most common reason to use ps is the get the process ID for a process that is out of control
● With the process ID you can use the kill command (e.g. “kill 6985” would kill whichever process had that process ID)
![Page 7: The ps Command](https://reader038.vdocument.in/reader038/viewer/2022100602/55895766d8b42acb638b45bb/html5/thumbnails/7.jpg)
7
Piping
● Sometimes, the list of processes can be long● If you only need to get a process ID, try
piping to grep● Example: Firefox is frozen and I need to kill it● “ps -e | grep firefox” would return one line
with the process for Firefox● I can then easily enter the kill command