What does the ampersand (&) symbol mean with `nohup`?
Solution 1:
From the bash manpage:
If a command is terminated by the control operator &, the shell executes the command in the background in a subshell. The shell does not wait for the command to finish, and the return status is 0.
So yes, it's a shell thing, and can be used with any command. It essentially returns control to you immediately and allows the command to complete in the background. This is almost always used with nohup
because you typically want to exit the shell after starting the command.
Solution 2:
Using the ampersand (&) will run the command in a child process (child to the current bash session). However, when you exit the session, all child processes will be killed.
using nohup + ampersand (&) will do the same thing, except that when the session ends, the parent of the child process will be changed to "1" which is the "init" process, thus preserving the child from being killed.
Solution 3:
Yes, it's a shell thing--it runs the command in the background so you don't have to wait for the current command to return before issuing more commands.