Linux – When should I use “nohup”, and when should I use “&”

linuxunix

I never know when's the best time to use nohup and the & at the end of the command.

Best Answer

Nohup makes a program ignore the HUP signal, allowing it to run after current terminal is closed / user logged out. Nohup does not send program to background.
& at the end of command is related to shell job control, allowing user to continue work in current shell session.
Usually nohup and & are combined to launch program which runs after logout of user and allows to continue work at current shell session.