Harnessing `nohup` for Uninterrupted Background Processes
Quick Tip
Harnessing `nohup` for Uninterrupted Background Processes
Challenge: You need to run a long-running command or script in the background, but you’re worried about it being terminated if you close your SSH session or the terminal window itself.
The Solution: Use the `nohup` command to ensure your process continues to run even after you log out.
nohup your_command &
Why it works: `nohup` (no hang up) prevents the command from receiving the hangup signal (SIGHUP) that is typically sent to processes when their controlling terminal is closed. The `&` at the end sends the command to the background.
Pro-Tip: By default, `nohup` redirects stdout and stderr to a file named `nohup.out` in the current directory. You can redirect this output to a different file using shell redirection, for example: nohup your_command > my_output.log 2>&1 &
Linux Tips & Tricks | © ngelinux.com | 6/9/2026
