An administrator has started a lengthy data analysis script in the foreground of their terminal. They now need to start another task but realize the script will take several more hours to complete. Which of the following commands should the administrator use to move the currently running script into the background so they can continue using the current terminal session?
Use the jobs command to automatically move the script to the background.
Press Ctrl+C to move the running script to the background.
Stop the script with Ctrl+Z and then move it to the background with the bg command.
Press Ctrl+D to send the script to the background and free up the terminal.
The bg command is used for placing a job that was stopped (e.g., with Ctrl+Z) into the background. However, simply using bg won't move a foreground process to the background unless it has been stopped first. Therefore, the correct sequence for moving a currently running foreground process to the background involves stopping the process with Ctrl+Z and then using bg to continue it in the background. The incorrect answers involve commands that either do not affect running jobs (jobs lists the jobs), or are related to stopping (Ctrl+C) or logging out of the shell (Ctrl+D), which will not help to achieve the desired outcome.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the `Ctrl+Z` command do in a Linux terminal?
Open an interactive chat with Bash
What is the purpose of the `bg` command in Linux?
Open an interactive chat with Bash
How can I view all the jobs running in the background or stopped in a terminal?