How to Manage jobs in Ubuntu Server 20.04 LTS

Louis SanchezAugust 15th 2021, 1:45

Step 1 : Open a file or just start a blank session. With the text editor open, we can background it at any time by pressing Ctrl + Z on our keyboard. You should have seen some output similar to the following:

[3]+  Stopped                 vim file1.txt

Step 2 : we see the job number of our process, its status, and then the name of the process. Even though the process of your text editor shows a status of Stopped, it's still running. You can confirm this by using the following variation of the ps command:

ps au |grep vim

The output shows that I have 3 vim sessions in use

Step 3 : I gave you an example of the ps command to show that the process was still running in the background, but there's actually a dedicated command for that purpose, and that is the jobs command. If you execute the jobs command, you'll see in the output a list of all the processes running in background. Here's some example output:

jobs

Step 4 : We have the job ID on the left, I can bring up a specific background process by using its ID with the fg command:

fg 2