The jobs command in Linux

The Linux terminal is a world of its own. It is full of many commands that allow us to do many things. Today, you will learn how to use the jobs command in Linux. So let’s go.

The Jobs command in Linux

The jobs command allows us to quickly identify and display the jobs that are running on the system.

Now, what is a job in Linux? A job is a command or process that has been executed from the terminal. That is to say that its operation depends directly on the terminal.

In some situations of working with servers, it can be quite useful and important, but it is basic to use.

According to man, When jobs report the termination status of a job, the shell shall remove its process ID. So, this simple to use command allows us to know these jobs immediately.

So let’s go for it.

Using the jobs command

Since this is a special command for the Unix family of operating systems, we can use the jobs command on all Linux distributions out there.

Therefore, there is no need to install anything or enable any extra configuration to use it. So, let’s get to work.

The most basic way to run the jobs command is to run it without any arguments.

jobs

It will show the jobs in the system in chronological order where the last job is marked with a plus + and the second to last with a minus - and the rest are not marked.

The jobs command has options that modify the behavior of the command.

On the one hand, we have the -l option that gives more information about the jobs that are shown on the screen.

Using it is basic, just run

jobs -l

This information shall include the job number, current job, process group ID, state, and the command that formed the job.

There is also the -p option. Thanks to it, you can show only the process IDs for the process group leaders of the selected jobs.

And to use it you have to run the command

jobs -p

Or the -s option that shows only stopped jobs.

jobs -s

Also, you can show only running jobs with the -r option.

jobs -r

This is how we can use the jobs command effortlessly on the system.

More info

More commands

Conclusion

There are Linux commands that although they may seem easy to us, the truth is that they provide us with important information in some aspects. In this case, jobs shows us the number of jobs that are currently running.

So, thanks for reading this short but useful post and help us to grow by sharing it.

Share This:

Leave a Comment

Your email address will not be published. Required fields are marked *