Page 258 - DCAP403_Operating System
P. 258
Unit 13: Case Study: Linux
The /proc directory is a virtual directory that contains information used to construct the users Notes
interactive environment and is thus different for each user. In this case you can see that it provides
a layer of abstraction and acts as a link between the stdout file, and the file representing the users
console device.
Redirection involves using special characters to tell the shell to send input, output, and errors to
files other than the defaults. The following table lists these symbols.
Symbol, Meaning
> Redirect stdout
>> Redirect and append stdout
2> Redirect stderr
2>> Redirect and append stderr
< Use in place of stdin
In order for a background process to truly run 100% in the background, you must suppress
display of all errors. The following example uses redirection to produce a file listing of the entire
file system as a background process.
Managing Running Processes
The [ps] command is the command used to manage running processes and can be used for many
things including viewing the status of your computer and getting a quick idea of how well the
computer is performing.
Here are some common ps commands.
Command, Usefulness
ps View current interactive processes on this terminal.
ps -a All current processes on this terminal, by all users.
ps -x All processes not assigned to a terminal (daemons).
ps -aux Output all process running and include resource utilization information.
The man page for ps contains extensive documentation on how to modify and interpret the
output of ps.
Top is a utility that can be used to display a live dataset of the currently running processes.
Activate it by typing [top].
Killing Stalled Processes
Processes that have stalled or frozen can sometimes cause problems. One of the jobs of a Linux
administrator is to identify and resolve stalled processes. The clues that a process has stalled can
range from an unresponsive GUI to a noted decrease in system performance. Either way, once
you have identified that a processes has stalled you can terminate that process using the [kill]
command. The syntax is fairly simple. You kill process by referencing its process ID or PID. This
information can be seen in the output of just about any iteration of the ps command. To kill a
process you pass a signal to that process. The default signal tells the process to perform a clean
shutdown. Here are a few examples.
To kill a single process:
ps
PID TT STAT TIME COMMAND
9408 p9 S 0:00 ue temp2.xdh
LOVELY PROFESSIONAL UNIVERSITY 251