Run a command that survives a hangup or a closed terminal, simple and reliable. 17.04.2026 | reading time: 2 min What happens to a long job when you close your terminal: it dies with SIGHUP by default; nohup changes that behavior so the command ignores the hangup signal and keeps running, making it perfect for remote sessions and long tasks. Quick example you can run Try this in a shell to see nohup at work; the multiline demo shows starting a sleep in background, the usual nohup message, and checking the process; ```$ nohup sleep 300 & [1] 12345 nohup: ignoring input and appending output to "nohup.out" $ ps -p 12345 -o pid,cmd PID CMD 12345 sleep 300 ``` Practical usage pattern Run a script and capture all output to a log so you can inspect it later, for example use `nohup ./backup.sh > backup.log 2>&1 &` then logout; nohup will write to the specified file or to nohup.out if you do not redirect, and it will try the current directory then the home directory if writing fails. Behavior and important details nohup makes the process ignore SIGHUP but does not create a new session; you usually combine it with backgrounding using & and optionally with `disown` or `setsid` if you need full detachment, and remember that job control messages and terminal input are still not available to the detached job. When to prefer other tools For interactive long-running sessions use `screen` or `tmux` to reconnect; for system-managed services choose systemd or systemd-run so the system supervises restarts and logs; nohup is ideal for quick, simple fire-and-forget tasks started from a shell. Next steps Experiment: start a command with nohup, close the terminal, then reconnect to verify the process and the log file; mastering these small patterns improves reliability when working on remote Linux systems and prepares you for larger topics like job control and service management. Join Bits & Bytes Academy First class LINUX exam preparation. processes utilities scripting