Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 3: Linux & Processes Let’s look at some data.

Similar presentations


Presentation on theme: "Chapter 3: Linux & Processes Let’s look at some data."— Presentation transcript:

1 Chapter 3: Linux & Processes Let’s look at some data

2 The Process Status (ps) command On every UNIX-like operating system, the process status command (ps) displays information about active processes. Every operating system's version of ps is slightly different, and the documentation describes several kinds of options:UNIXoperating system And it gets exhausting after a while! Really! Check the man pages.

3 The ps command “cheat sheat” I recommend using only two options: -eSelect all processes. Identical to -A. -f o full-format listing. This option can be combined with many other UNIX-style options to add additional columns. It also causes the command arguments to be printed. When used with -L, the NLWP (number of threads) and LWP (thread ID) columns will be added. See the c option, the format keyword args, and the format keyword comm. threads (even the explanation for –f goes on and on!

4 The ps command “cheat sheat” Use ps –ef to get all of the process data available Then just look for the information you want. But don’t scan the output yourself… Use the pipe ( | ) command character to feed the output of the ps command to a search command …and let the search command do it for you. The search command? grep

5 The grep command grep, naturally, means search: (globally search a regular expression and print)search 1.No need to get into details on regular expressions. 2.However, there are a few options worth remembering grep [OPTIONS] PATTERN [FILE...] grep -i “data" some_file (case insensitive search) grep -r “data" * (recursive search) grep -v “data" some_file (obverse search, i.e. everything without “data”

6 ps and pipe and grep If you’re not on a personal computer (i.e. a timeshare machine) Then there will be multiple users Combine all three commands to look for processes for particular users! ps –ef | grep userid a)Get all processes with a nice format, b)Pipe the results to another command (grep) c)And search for userid amongst the results.


Download ppt "Chapter 3: Linux & Processes Let’s look at some data."

Similar presentations


Ads by Google