Run a command in the background
Launch a long-running command without blocking the current shell session.
How to run a command in the background in each shell
long-running-command &`&` puts the command in the background of the current session. Use `disown` after to detach from job control, or `nohup long-running-command &` to also ignore SIGHUP on logout.
long-running-command &long-running-command &Fish has no shell builtin `nohup` — call the binary: `nohup long-running-command &`. Fish auto-disowns on shell exit, so `disown` is rarely needed.
Start-Job { long-running-command }`Start-Job` runs in a separate PowerShell **runspace**. `Get-Job` / `Receive-Job <id>` retrieves output. For an external `.exe` prefer `Start-Process command -NoNewWindow`.
start /b long-running-command`/b` runs in the same console without opening a new window. `start /min`, `start /max`, `start /wait` vary the window behaviour.
Equivalents listed for Bash, Zsh, Fish, PowerShell, cmd.exe.
Gotchas & notes
- A bare `command &` (bash) survives only as long as the **shell session** does — logout sends SIGHUP and kills it. `nohup command &` redirects stdout/stderr to `nohup.out` and ignores SIGHUP.
- PowerShell `Start-Job` jobs are **bound to the launching session**. To outlive logout, use `Start-Process` (creates an OS process) or register a scheduled task.
- On Windows, jobs created by `start /b` inherit the console; closing the console kills them. Use `start "" cmd /c command` (note the empty title) for a true detach.
- For "fire and forget at boot" workloads, prefer a real service manager: `systemd` (Linux), `launchd` (macOS), or `nssm` / Task Scheduler (Windows). Background-in-shell is for ad-hoc work.