nerdexam
CompTIA

XK0-004 · Question #378

A Linux administrator needs to run a command in the background of a terminal, Which of the following commands will BEST accomplish this task?

The correct answer is A. ./run_application $$ bg. In Linux bash, appending the '&' operator to a command immediately runs it as a background job, freeing the terminal for further use.

Scripting, Containers and Automation

Question

A Linux administrator needs to run a command in the background of a terminal, Which of the following commands will BEST accomplish this task?

Options

  • A./run_application $$ bg
  • B./run_application +$
  • C./run_application
  • D./run_application $

How the community answered

(25 responses)
  • A
    96% (24)
  • D
    4% (1)

Why each option

In Linux bash, appending the '&' operator to a command immediately runs it as a background job, freeing the terminal for further use.

A./run_application $$ bgCorrect

The '&' operator in bash sends a process to the background upon launch - the correct form is './run_application &' - which allows the terminal to remain interactive while the application continues executing. This is the standard POSIX shell mechanism for background job control and is the intended answer despite the formatting anomaly in how '&' appears in the printed choices.

B./run_application +$

'+$' is not a valid bash syntax construct for job control or background execution and has no defined shell meaning.

C./run_application

'./run_application' with no trailing operator runs the process in the foreground, blocking the terminal until the process terminates.

D./run_application $

'$' alone in bash is used as a variable or PID reference in certain contexts but is not the operator that backgrounds a running process.

Concept tested: Linux bash background process execution operator

Source: https://www.gnu.org/software/bash/manual/bash.html#Job-Control-Basics

Topics

#background processes#job control#bash shell#process management

Community Discussion

No community discussion yet for this question.

Full XK0-004 Practice