the uppercase letter for a field to shift the field left on the display, or type the lowercase letter to shift it right. Press Enter to exit this display. |
To end a process, type k (for
4.9.1.4. Displaying process information from the shell prompt
Instead of using
By default,
$ ps
PID TTY TIME CMD
14797 pts/1 00:00:00 bash
22962 pts/1 00:00:00 ps
This shows the process ID, terminal device ( pts/1 means
-A-e
All (or everyone's) processes
-u
Processes owned by
Other options are used to control the output format:
-f
Displays full information, including the UID, PID, PPID, start time (STIME), terminal (TTY), total CPU time used (TIME), and command (CMD).
-F
Displays extra-full information: everything included in -f , plus the processor number of the CPU the program is running on (PSR) and the approximate kilobytes of RAM used (RSS).
Like
To see the full documentation for ps, view the manpage but be prepared to take some time; it's over 16 pages long!
4.9.1.5. Terminating processes from the shell prompt
You can terminate processes by command name or by PID. When you terminate a process by name, you save yourself the hassle of looking up the PID, but if there is more than one process of the same name running, you will kill them all.
To kill by command name:
$ killall
If the process doesn't terminate within a few seconds, add the -KILL argument:
$ killall -KILL
Note that this will kill only processes of that name that are
To kill PID 48292:
$ kill
Again, if that doesn't work within a reasonable period of time, add the -KILL argument:
$ kill -KILL
4.9.2. How Does It Work?
The Linux kernel has only two basic functions for starting processes: fork( ) and exec( ) .
fork( ) makes an exact copy of the current process and starts it running. exec( ) replaces the currently running program with a new program, running in the same process. So to get a new program running, the shell uses fork( ) to create a child process (a copy of the shell) and then uses exec( ) to change the program running in the child process.
When a child process is created, a number of variables are inherited from the parent process, including the real and effective user IDs, the real and effective group IDs, the
Processes are generally permitted to run on a CPU until their
However, processes frequently give up the CPU early because they reach a point when they need a resource to continue; this is called
The difference between your typing speed and your CPU speed is even greater; most people type six characters per second or less, so on a 3 GHz PC, the CPU will average at least 500 million operations between keystrokes.