Context
I have checked several questions about the same topic and I still get confused when they explain what a background process really is. The common answer I interpert is that:
a process that runs in the background allows you to interact with the same terminal... etc.
I have tested this by running the following command:
ping google.com -c 100 &
- P.S: I also ran this same command without the
&
operator and used Ctrl-Z, but all that did was suspend the command
Question
When I ran this command, the output was still in my main terminal, and I could not execute any other commands until the command was finished running, or until I killed the command.
Before I list my questions, my questions is not how to redirect the output of a command to a seperate file / place. I am already aware of how to redirect the output of ping google.com -c 100
command to a different place so I can still interact with the main terminal
My questions are
- In the most simplest terms possible, what does backgrounding a command actually do
- What does putting a
&
at the end of a command do - What is the purpose of doing this / what do I gain out of backgrounding a command
- When would I want to background a command
** Please let me know if you need further clarification about the quesitons or the context
ping
is running in the background, it's just really confusing becauseping
's output gets mixed in with everything else -- the shell prompt, what you type in as a command, what that command outputs, etc. So backgrounding is most useful (/least confusing) for things that don't constantly spit output the wayping
does. – Gordon Davisson Aug 12 '21 at 23:27