Run Background Process in Ubuntu 22.04 (Jammy Jellyfish) Linux system

In reality, when you run a command in the terminal, you have to wait until the command finishes before you can enter another one. This is called running the command in the foreground or foreground process. When a process runs in the foreground, it occupies your shell, and you can interact with it using the input devices.

So While working on your system, there are times you want specific processes to run in the background, i.e., they will continue to work. Still, they will not interpret the working of any other processes running in the foreground.

Here at LinuxAPT, we shall look into different ways of sending the processes to the background in Ubuntu Linux.

Ways of Running a Process in the Background in Ubuntu Linux

1. using the Ampersand Operator to Run a Process in the Background in Linux

Here, you will see what happens to your terminal once you launch a program through it. 

We will launch the Firefox browser with the help of the following terminal command:

$ firefox

Once the Firefox browser launches, you will lose control of the terminal.

Now, if you want to run any other command on the terminal, you will not be able to do that because you no longer have control of the terminal. 

You will be able to execute a terminal command only if you close the Firefox browser or send it to the background. 

For sending any process to the background in Linux, you need to launch that process followed by the ampersand operator, and running the following command:

$ firefox &

Running this command will display a job ID on the terminal.

This time, the Firefox browser will launch on your system. However, you will still have control of the terminal in your hands, which means that you will still be able to execute other commands while the Firefox process will be running in the background.

2. using the "bg" Command to Run a Process in the Background in Linux

Here, we will launch the Firefox browser in the same manner as we did above in the first method. Now, you will see the Firefox browser.

Then, you need to press the Ctrl+ Z key combination to get control of the terminal back while the Firefox process will still be running.

Next, execute the following command to push the Firefox process to the background:

$ bg

How To View the Processes Running in the Background in Ubuntu Linux ?

If you ever want to view the processes running in the background in Linux, then you simply need to run the following command:

$ jobs

This will display the background processes running on the Linux system.

[Need help in fixing Ubuntu Linux system ? We can help you. ]

This article covers the ways of sending a process to the background in Ubuntu Linux system. In fact, a background process is a process/command that is started from a terminal and runs in the background, without interaction from the user.

Commands to find out what processes are running in the background ?

  • ps command - You can use the ps command to list all background process in Linux. Other Linux commands to obtain what processes are running in the background on Linux.
  • top command – Display your Linux server's resource usage and see the processes that are eating up most system resources such as memory, CPU, disk and more.
  • htop command – Just like a top command but with an improved user interface.

Related Posts