kill
This command can be used to accomplish the task if a process is running in background and for some reasons in which process has to be terminated.
Syntax
kill pid
where pid is the procees id number
The given example displays how to kill a process.
# ls -R / > /tmp/out & [1] 1098
#
#
# ps
PID TTY TIME CMD
1098 pts/2 0:00 ls
1070 pts/2 0:00 sh
1072 pts/2 0:00 jsh
# kill 1098
# ps
PID TTY TIME CMD
1070 pts/2 0:00 sh
1072 pts/2 0:00 jsh
[1] + Terminated ls -R / 1>/tmp/out
Whenever a process is placed in background, its PID number is instantly displayed. To know the PID number of the procedure to be terminated, the ps or jobs -l command could be used.
Note : Only the owner of the process or the super user can kill this process. Killing the shell process will logout the user from the system.