nohup
Linux · Processes · reference only
What it does
Runs a command that ignores the hangup signal, so it keeps running after you leave the terminal.
Syntax
nohup comando [argumentos...]
Options and parameters
comandoProgram that runs immune to session closing.
&Written at the end to leave the command in the background.
> fichero 2>&1Redirects output and errors to a file instead of nohup.out.
--helpShows help and exits.
--versionShows the version and exits.
Usage examples
nohup sleep 100 &Starts a 100-second wait in the background that survives closing the terminal.
nohup ./copia.sh > copia.log 2>&1 &Runs a long script and saves its output to copia.log.
tail -f nohup.outFollows live the output that nohup saves by default.
nohup python3 servidor.py &Keeps a simple server running even if you close the SSH session.
Notes and common mistakes
- If standard output is a terminal and you did not redirect it, nohup saves it to nohup.out.
- For long-running processes a systemd service, tmux or screen is usually better.