Use nohup when a noninteractive Linux command must survive your logout or a dropped SSH connection. It makes the command ignore the hangup signal (SIGHUP); add & if you also want your shell prompt back immediately. For predictable unattended work, redirect input, output, and errors explicitly:
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
nohup /path/to/command --option value </dev/null >run.log 2>&1 &
This protects the process from the terminal hangup, records its output, and runs it asynchronously. It is a lightweight logout-resilience wrapper, not a supervisor: it will not restart a failed process, start it at boot, perform health checks, enforce resource limits, or rotate logs.
As an Amazon Associate I earn from qualifying purchases.
What nohup does
The name means “no hangup.” GNU Coreutils defines nohup as a utility that runs a command with hangup signals ignored so the command can continue after you log out. POSIX requires the utility to set SIGHUP to ignored when it is invoked.
A terminal or SSH session commonly causes a shell and its jobs to receive SIGHUP when the session disappears. A command started through nohup inherits the ignored disposition, so that signal does not terminate it. The command still runs with the permissions, environment, current directory, open files, and resource limits of the launching shell unless you change them separately.
#1 Best Overall
- [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
- [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
- [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
- [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
- [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
nohup does not create a service, fork a daemon, detach every file descriptor, or monitor the program. It only changes hangup handling and, when necessary, arranges output handling. Those distinctions determine whether it is appropriate for your job.
Basic syntax
nohup COMMAND [ARG]...
Replace COMMAND with an executable path or command name and place its arguments after it. Shell redirections are written outside the command’s argument list:
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsnohup /usr/local/bin/report --date yesterday >report.log 2>&1 &
The shell parses the redirections and the final ampersand; nohup receives the command and its arguments. Quote paths or values containing spaces:
nohup "/opt/tools/nightly report" --config "/etc/nightly report.conf" >"$HOME/logs/nightly.log" 2>&1 &
Use an absolute executable path when a login shell’s PATH may differ from the interactive environment. The command’s own working directory remains the directory from which you launch it unless the command changes it.
Keep a process running after logout: the reliable procedure
1. Prepare a writable log directory
Choose a location that will remain available after the session ends. In your home directory:
mkdir -p "$HOME/logs"
For a shared temporary location, use a directory whose permissions and cleanup policy you understand, such as /var/tmp. The launching user must be able to create or append to the log file. If the directory is missing or unwritable, the command may fail before the workload starts.
Recommended Free Tools
2. Decide what the command should read
An unattended process should not wait for keyboard input. Redirect standard input from /dev/null when no input is expected:
</dev/null
If the program needs a file, provide that file deliberately instead:
<input.txt
POSIX permits implementations to choose details of terminal standard-input handling. An explicit redirection removes that ambiguity and prevents a background job from unexpectedly waiting on the session.
3. Redirect standard output and standard error
Send normal output to a named file and merge diagnostics into the same file:
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #2
- 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
- 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
- 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
- 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
- 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
>"$HOME/logs/report.log" 2>&1
Use > to truncate or create the file when the shell opens it. Use >> to append instead:
>>"$HOME/logs/report.log" 2>&1
The order matters. 2>&1 makes standard error refer to the same open file description currently used by standard output. Put it after the output redirection to merge both streams into that file. If you want separate files, specify both:
>"$HOME/logs/report.out" 2>"$HOME/logs/report.err"
4. Add the ampersand for asynchronous execution
Append & after all redirections:
nohup /path/to/command --option value </dev/null >"$HOME/logs/run.log" 2>&1 &
The shell starts the protected command as a background job and returns your prompt. Without &, the command is protected from SIGHUP but remains a foreground job, so the shell waits for it to finish. Closing the session may still be safe, but you do not regain the prompt while it runs.
5. Capture the process identifier immediately
In a POSIX-compatible shell, $! expands to the process ID of the most recently started background pipeline or command. Save it while the launching shell is still available:
nohup /path/to/command </dev/null >"$HOME/logs/run.log" 2>&1 &
pid=$!
printf 'Started PID %s
' "$pid"
A shell job number such as [1] is not the same as a durable process-management record. Keep the PID, command line, and log path somewhere useful if another operator must inspect the job later.
Where nohup saves output by default
GNU nohup changes output only when the relevant stream is still connected to a terminal. If standard output is a terminal, it appends output to nohup.out in the current directory. If that file cannot be opened, it tries $HOME/nohup.out. If neither location can be opened, the command is not run.
When standard error is a terminal, GNU nohup normally redirects it to the same output descriptor. This can make diagnostics appear in the same nohup.out file as normal output. The exact behavior is implementation-specific outside the GNU and POSIX guarantees, so explicit redirection is preferable for scripts and production jobs.
| Standard-output condition | Result | Operational implication |
|---|---|---|
| Output already redirected by the shell | nohup leaves that destination in place |
You control the path, append/truncate mode, and permissions |
| Output is a terminal and current directory is writable | GNU nohup appends to ./nohup.out |
The file may be easy to overlook or grow without rotation |
./nohup.out cannot be opened |
GNU nohup tries $HOME/nohup.out |
The home filesystem must be writable and have free space |
| Neither fallback file can be opened | The command is not run | Fix permissions, paths, or storage before retrying |
Explicit paths also avoid surprises when you launch from a read-only directory, a transient deployment directory, or an SSH session whose working directory is not what you expected. For example:
mkdir -p "$HOME/logs"
nohup /opt/jobs/export --full </dev/null >"$HOME/logs/export.log" 2>&1 &
Do you need an ampersand with nohup?
No, not to ignore SIGHUP. Yes, if you want the shell to continue without waiting.
| Command form | Signal protection | Shell behavior | Typical use |
|---|---|---|---|
nohup command |
Yes | Foreground; the shell waits | A command you want to protect but observe interactively until it exits |
nohup command & |
Yes | Background; prompt returns | A one-off unattended job over SSH or a terminal |
The ampersand is shell syntax, not an option passed to nohup. Place it after every redirection. If you write it inside quotes or before a redirection, the shell will parse a different command than intended.
Rank #3
- [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
- [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
- [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
- [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
- [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
Backgrounding does not guarantee that output is detached. If you leave output connected to a terminal, GNU nohup may place it in nohup.out; another implementation may differ. Redirect all three standard streams when the job must be independent of the session.
Standard input, output, and error: a practical model
Standard input (file descriptor 0)
Interactive programs can block while reading descriptor 0. Use </dev/null for a job that should never prompt, or redirect a known input file. Do not assume a detached process can answer a question that appears on your SSH terminal.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallStandard output (file descriptor 1)
Use >file for a fresh run or >>file to preserve existing content. Confirm that the filesystem has enough space; a long-running process can fill a partition even when the command itself is healthy.
Standard error (file descriptor 2)
Merge it with output using 2>&1, or keep a separate diagnostic file with 2>error.log. If you redirect only standard output, warnings and failures may still be written somewhere else, including the default nohup.out path when stderr is attached to a terminal.
A complete unattended pattern
nohup /path/to/command --option value
</dev/null
>"$HOME/logs/job.log" 2>&1 &
The backslashes continue one shell command across lines. They are optional; use a single line in scripts when that is clearer.
Verify that the job started and is still running
A prompt returning, a job-control message, or a printed PID proves only that the shell launched something. It does not prove that the workload completed successfully. Check the process and its output separately.
Inspect the process table
ps -p "$pid" -o pid=,ppid=,stat=,etime=,cmd=
If you did not save the PID, search by a distinctive command fragment:
pgrep -af '/path/to/command'
Process searches can match a wrapper, a similarly named command, or no process after a fast exit. Confirm the full command line and elapsed time before taking action.
Follow the log
tail -f "$HOME/logs/job.log"
Use tail -n 100 first when you want recent context without following indefinitely:
tail -n 100 "$HOME/logs/job.log"
An empty log is not automatically an error: the program may be quiet, buffering output, or have terminated before writing anything. Check the process state and the file’s modification time together.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #4
- Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
- Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
- All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
- Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
- Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
Check exit status when possible
For a foreground invocation, the shell’s $? is the exit status returned by nohup. GNU defines special statuses for its own invocation failures and otherwise returns the wrapped command’s status:
| Status | Meaning under GNU nohup | What to check |
|---|---|---|
| 125 | nohup itself failed |
Its diagnostics, redirection targets, permissions, and environment |
| 126 | The command was found but could not be invoked | Execute permission, file format, interpreter, and access permissions |
| 127 | The command could not be found | Executable path and the shell’s PATH |
| Any other status | The wrapped command’s status was returned | Consult that program’s documentation and log |
With &, the launching shell immediately reports that it created a background job; it cannot know the eventual workload status at that instant. You need to monitor the process and log, or arrange a separate mechanism to record completion.
Common mistakes and fixes
Omitting & and assuming nohup is asynchronous
Symptom: Your SSH terminal remains occupied even though the command will survive logout.
Fix: Stop and relaunch with a final &, or leave the foreground command running if that is intentional. Do not add the ampersand inside the command’s quoted arguments.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Leaving output attached to the terminal
Symptom: You cannot find the log, output accumulates in an unexpected location, or a filesystem eventually fills.
Fix: Redirect stdout and stderr to a known path, create the directory first, and establish a retention or rotation policy appropriate to the workload. nohup does not rotate logs.
Allowing the job to expect keyboard input
Symptom: The process appears stuck after logout.
Fix: Supply an input file or use </dev/null. Review the program’s noninteractive options so it does not prompt for a password, confirmation, or terminal-only setting.
Writing to an unwritable log path
Symptom: No process remains and the shell reports a redirection or open-file error.
Fix: Test the directory with the same user that will launch the job, verify free space, and use a path such as $HOME/logs/job.log that the user owns. Redirections are opened by the shell before the command executes.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Assuming a command name is available after logout
Symptom: The background job exits immediately with status 127 or a “command not found” message.
Fix: Use an absolute executable path or set the required environment explicitly. A noninteractive shell may have a different PATH from your interactive login.
Best Value
Using a shell special builtin as the command
GNU documentation says the command operand must not be a shell special built-in utility. Commands such as shell control constructs are handled by the shell rather than as ordinary executables. If you need shell syntax, invoke a shell explicitly and quote the script carefully:
nohup sh -c 'command_one && command_two' </dev/null >"$HOME/logs/sequence.log" 2>&1 &
Use this form only when you understand which shell interprets the string and how its quoting works.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Treating nohup as a restart system
Symptom: The process stops after an application error, machine reboot, administrator action, or resource exhaustion.
Fix: Use a service or job-management system that provides the missing behavior: restart-on-failure, boot integration, health checks, resource controls, dependency ordering, and managed logs. nohup promises none of those features.
Portability and shell differences
A shell may provide its own nohup function or built-in command, which can take precedence over the external utility. The Linux manual page cautions that behavior can therefore depend on the shell and environment. Check what will run before relying on GNU-specific behavior:
command -V nohup
For a script that requires GNU semantics, run it on an environment where GNU Coreutils is present and test the target shell. Avoid assuming that implementation-specific terminal-input behavior, diagnostics, or extensions are portable across Unix-like systems.
Recommended Free Tools
POSIX standardizes the requirement to ignore SIGHUP and defines the nohup.out and $HOME/nohup.out fallback model, while allowing some details—particularly terminal standard-input handling—to vary. Explicitly redirecting stdin, stdout, and stderr is the simplest way to make a script’s behavior predictable.
When nohup is the right tool—and when it is not
| Requirement | nohup | Terminal multiplexer | Service or job manager |
|---|---|---|---|
| Survive a logout or dropped SSH connection | Yes, for a command that handles its files and signals appropriately | Yes, while the session remains in the multiplexer | Yes |
| Reconnect to an interactive terminal | No | Yes; you can detach and reattach to the session | Usually no interactive terminal by default |
| Restart after failure | No | No automatic restart | Yes, when configured |
| Start automatically at boot | No | No | Yes, when configured |
| Health checks and dependencies | No | No | Available in systems designed for supervision |
| Resource limits and accounting | Only what the launching environment already supplies | Only what the launching environment already supplies | Often available as a first-class feature |
| Managed logging and rotation | No; you choose files and tools | Session output is retained according to the multiplexer | Usually available through the manager or its logging integration |
| Portability for a quick one-off command | High on POSIX-like systems, subject to shell differences | Requires the multiplexer to be installed | Depends on the operating system and manager |
Choose nohup for a one-off, noninteractive task
Use it for work such as a long export, compilation, archive, or data conversion that should continue after you disconnect and does not need a live terminal. Redirect all streams and retain the log path.
Choose a terminal multiplexer for interactive work
If you need to reconnect and continue typing commands, inspect a full-screen interface, or preserve an interactive shell, a multiplexer is a better match. nohup cannot recreate that terminal session.
Choose a service or job manager for durable operations
For a daemon, production workload, boot-time process, or anything that must recover automatically, use the operating system’s service or job-management facilities. Configure restart policy, startup ordering, health checks, resource limits, and log handling there rather than trying to build them around nohup.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteReady-to-use command patterns
Simple background job with one log
nohup /opt/tools/indexer --rebuild </dev/null >"$HOME/logs/indexer.log" 2>&1 &
Append to an existing log
nohup /opt/tools/indexer --incremental </dev/null >>"$HOME/logs/indexer.log" 2>&1 &
Separate normal output and errors
nohup /opt/tools/import --source data.csv
</dev/null
>"$HOME/logs/import.out"
2>"$HOME/logs/import.err" &
Run a shell sequence
nohup sh -c 'prepare && process && cleanup'
</dev/null
>"$HOME/logs/sequence.log" 2>&1 &
Because the sequence is interpreted by sh, quote the script as one argument and ensure each command can run without an interactive prompt.
Final checklist before disconnecting
- The command path and arguments are correct.
- The executable and its dependencies are accessible to the launching user.
- The log directory exists, is writable, and has enough free space.
- Standard input is redirected to a deliberate source, commonly
/dev/null. - Standard output and standard error have explicit destinations.
- The final
&is present when asynchronous execution is required. - You recorded the PID or a distinctive process query.
- You know how to inspect the log and identify a normal completion.
- You do not require automatic restart, boot startup, health checks, resource policy, or log rotation from
nohup.
For a quick, noninteractive Linux job, nohup command </dev/null >log 2>&1 & is the essential pattern: ignore SIGHUP, detach the shell’s wait, and make every data stream explicit. Anything beyond surviving logout belongs in a supervisor or job-management system.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




