7

Click here to load reader

The ps Command

Embed Size (px)

DESCRIPTION

A look at a useful command for looking at the status of your processes in Linux

Citation preview

Page 1: The ps Command

The ps command

Kevin O'BrienWashtenaw Linux Users Group

http://www.lugwash.org

Page 2: The ps Command

2

What is ps?

● ps stands for Process Status● Gives a list of all processes

Page 3: The ps Command

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

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

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

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

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