Showing posts with label process. Show all posts
Showing posts with label process. Show all posts

jobs, fg & bg commands in Linux


Jobs Command:

jobs: Jobs command is used to list the jobs that you are running in the background and in the foreground. If the prompt is returned with no information no jobs are present. All shells are not capable of running this command. This command is only available in the csh, bash, tcsh, and ksh shells.

Options:

-p           Display the PID of process group leader

-l             Provides more information about each job listed. This information includes the job                 number,  current job, process group ID, state, and the command that initiated the job.
-n            Display only jobs that have stopped or exited since last notified

-r             Display running jobs

-s            Display stopped jobs

 Each job will be listed with a number; to resume a job, enter %  (percent sign) followed by the number of the job. For example, To restart job number two
$ %2


Linux Processes



Process: 

Process is an instance of a running program. When you start a program or running an application in Linux, you actually execute that program.  Whenever a program is executed, a new process is created. A process also consumes resources like the file system, memory or other CPU resources. This gives rise to the need of process management in Linux.



PID:

A PID (Process Identifier) is a number which is uniquely assigned when the process is created. The PID’s are allocated sequentially as the processes are being created. In Linux init is the first process which PID is 1, other process generally starts from 2. There is max limit of PID which can be known by command

$ cat /proc/sys/kernel/pid_max