Basic Linux Tutorial
Computer Tutorial

Process Control Commands



Process Control Commands

The ps Command

Every process that is initiated on the system is assigned a unique identification number, known as a process ID (PID ). The ps command displays information about processes currently running (or sleeping) on your system, including the PID of each process and the PID of each process's parent ( PPID). The ps command will also report who owns each process and which terminal each process is executing through.

Synopsis :

$ ps   [-efl]

Example :

$ ps
PID     TTY   TIME   COMMAND
1324   ttyp2   0:00       sh
1387   ttyp2   0:00       ps
The -e option reports about every process running on the system, not just your own. The -f and -l options report full and long listings, which include additional detail on the processes.

The nohup Command

the nohup command to make commands immune to hanging up and logging off. The nohup command is one of a group of commands which precede another command.

Synopsis :

nohup   command line   &

Example :

nohup   cat *   > bigfile   &

The nice Command

The nice command is another prefix command that allows you to execute a program at a lower priority. It is useful when issuing commands whose completion is not required immediately, such as formatting the entire collection of manual pages.

Synopsis :

$nice   [-N]   command_line
Where N is an integer value between one and nineteen. The default increment is 10. A process with a higher nice value will have a lower relative system priority. The nice value is not an absolute priority modifier.

Example :

$ nice   -10   cc   myprog.c   -o   myprog
$ nice   -5   sort *   >   sort.out   &

The kill Command

The kill command can be used to terminate any command including nohup and background commands. More specifically, kill sends a signal to a process. The default action for a process is to die when most signals are received. The issuer must be the owner of the target commands; kill cannot be used to kill another user's commands unless the superuser issues it.

Synopsis :

kill   [-s signal_name]   PID [PID...]