Which character, added to the end of a command, runs that command in the background as a child process of the current shell?
Click on the arrows to vote for the correct answer
A. B. C. D. E.C
The correct answer is C. "&".
When a command is executed in the terminal, the shell waits for the command to finish and return control to the user. However, if the "&" character is added to the end of the command, it runs the command in the background as a child process of the current shell, allowing the user to continue working on the terminal while the command is executing in the background.
For example, if the user wants to run a command "sleep 10" in the background, they would enter:
shell$ sleep 10 &
This would execute the "sleep 10" command in the background and immediately return control to the user. The user can then continue working on the terminal while the "sleep 10" command is running in the background.
It is important to note that some commands may still output messages to the terminal even when run in the background. To prevent this, you can redirect the output to a file or /dev/null. For example:
javascript$ sleep 10 > /dev/null &
This redirects the output of the "sleep 10" command to /dev/null, a special file that discards all input.