Command Format: ps [options]
See on-line manual for options
With no options given the ps command will give you certain
information about processes associated with the controlling
terminal. The output consists of a short listing containing the
process id, terminal id, cumulative execution time, and the command
name. Otherwise, options will control the display.
Sample session:
$echo $$
8347
$ps
PID TTY TIME COMMAND
8347 rt021a0 0:03 ksh
8376 rt021a0 0:06 ps
$
The PID numbers of the Shell are the same in the sample session
because the shell will substitute its own PID number for $$.
The Shell makes the substitution before it forks a new process to
execute the echo command. Therefore, echo will display the PID
number of the process that called it, not the PID of the process
that is executing it.
The -l option will display more information about the processes.
Sample Session:
$ps -l
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME COMD
f0000 S 115 8347 309 2 30 20 1009000 140 94014 rt021a0 0:03 ksh
f0000 O 115 8386 8347 16 68 20 1308000 72 rt021a0 0:01 ps
$ps -l
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME COMD
f0000 S 115 8347 309 1 30 20 1009000 140 94014 rt021a0 0:03 ksh
f0000 O 115 8387 8347 26 73 20 1146000 72 rt021a0 0:01 ps
$
Command Format: grep [options] limited_regular-expression [file]
Use the man command for a complete list of options
The grep utility searches files for a pattern and displays all
lines that contain the pattern. It uses limited-regular-
expressions (these are expressions that have string values that
use a subset of all the possible alphanumeric and special
characters) like those used with ed to match the patterns.
Be careful using the characters $, *, [, ^, |, (, ), and \ in the
regular expression because they will be evaluated by the shell.
It is good practice to enclose the regular expression in single
quotes. This will prevent the shell from evaluating these special
characters.
The grep utility will assume standard input if no files are given.
Normally, each line found in the file will be displayed to
standard output.
Sample session:
$grep 'disc' memo
This command will search the file "memo" for the string "disc". It
will include words like discover and indiscreet because they
contain the characters "disc". The single quote marks are not
necessary and for this example they wouldn't have made any
difference. They do allow you to include spaces in the search
pattern.