fbpx Working with Background Processes in Linux | Certificação Linux

Working with Background Processes

📅 04/01/2019 ⏱ 3 min ✍️ Uira Ribeiro
Linuxhow-to
Working with Background Processes
Exam Pass App — mais de 7.000 questões LPI, offline, em 5 idiomas, disponível no Android e na App Store
Available on
Google Play
Available on
App Store

Working with background processes is ideal for tasks that run in batch. Learn how to do this in Linux

Let's learn about the commands that handle scheduling processes in the background:

Command jobs

Usage:

$ jobs [options]

The jobs command lists the processes that are running in the background. If a job number is provided, the command will return information only for that specific job.

The job number is assigned when the process is moved to the background.

The most common options are:

-l Lists the PIDs of background processes.

&index=44&list=PL6IznNGWCdD89jP8kiacplFQcJlmMmjhb

Command bg

Usage:

$ bg [job_number]

The bg command moves a running process to the background. Placing the "&" signal after the command call produces the same effect.

If a command is already running in the foreground, that is, attached to a terminal, we can temporarily pause its execution with the TSTP (18) signal by pressing ctrl-z and then invoking the bg command.

&list=PL6IznNGWCdD89jP8kiacplFQcJlmMmjhb&index=6

Command fg

Usage:

$ fg [job_number]

The fg command does the exact opposite of the bg command, bringing the task to the foreground and attaching it to a terminal.

Command nohup

Usage:

$ nohup [command]

The nohup utility executes the specified command without attaching it to any terminal, making it immune to hangs, connection drops, and intentional disconnections.

Example:

$ nohup find / -name uira* > arquivos_econtrados &

In this example, nohup will execute the find / -name uira* command and send the output to arquivos_econtrados, which will run in the background.

&index=67&list=PL6IznNGWCdD89jP8kiacplFQcJlmMmjhb

See how to work with processes in Linux or even change the process priority.

Want to know if a certification is worth it? Learn why salaries are good, and why companies are looking for Linux professionals.

You will understand that the benefits far outweigh the sacrifice.

And if you have already decided, see our Certification Guide.

And if you want to know where to take the exams, check the city list.

If you want to know the exam language, see this post.

Learn much more about Linux in our online course. You can enroll here with a 7-day free trial. If you already have an account, you can log in here.

Liked it? Share :-)

Uira Ribeiro

Prof. Uirá Ribeiro

Chair do Board do Linux Professional Institute

After years of watching professionals waste hours on simple tasks because they didn't know the right Linux tools, I decided to teach.
Today I'm the author of most of LPI's official Learning Materials and mentor to over 14,000 certified students.

See my full story →

That was just one piece. The course teaches the whole path — from your first command to exam day.

Certificação Linux — a plataforma líder em certificações Linux no Brasil
WhatsApp