Showing posts with label grep. Show all posts
Showing posts with label grep. Show all posts

Friday, December 18, 2009

ps headers and grep

GNU ps(1) has a plethora of options.  One of the more useful features of ps is the header label which is printed at the top of the ps output, such as in the following snippet:


Listing 1.1
char $ ps
  PID TTY       TIME CMD
15705 pts/1 00:00:00 bash
16345 pts/1 00:00:00 ps


As you can see, each column has a label on the top.  In this example (Listing 1.1), the columns are labelled PID, TTY, TIME and CMD.  This is the most basic invocation of the ps command, and the output is minimal.  If you start adding options, such as doing ps aux, (where you will get you a listing of all the processes on the system using BSD style syntax) you will get quite a bit more text to sift through.  But what if you are only after a certain term, such as tty, for example in the ps aux listing?