Linux command
nohup 命令
文本
涉及管道、覆盖或删除,执行前请先确认路径和参数。
常用示例
Run command immune to hangups
nohup [command] &
Run with output to file
nohup [command] > [output.log] 2>&1 &
Run script in background
nohup [./script.sh] &
Run with custom output
nohup [command] > [custom.out] &
说明
nohup runs _command_ while ignoring the SIGHUP signal, so the process keeps running after the controlling terminal is closed or the user logs out. If standard output is a terminal, it is appended to nohup.out in the current directory, or to $HOME/nohup.out if that is not writable. If standard error is a terminal, it is redirected to standard output. If standard input is a terminal, it is redirected from an unreadable file. Note: nohup does not itself put the process in the background; combine with & (or a shell job-control facility) to detach.
参数
- --help
- Display help information.
- --version
- Output version information.
FAQ
What is the nohup command used for?
nohup runs _command_ while ignoring the SIGHUP signal, so the process keeps running after the controlling terminal is closed or the user logs out. If standard output is a terminal, it is appended to nohup.out in the current directory, or to $HOME/nohup.out if that is not writable. If standard error is a terminal, it is redirected to standard output. If standard input is a terminal, it is redirected from an unreadable file. Note: nohup does not itself put the process in the background; combine with & (or a shell job-control facility) to detach.
How do I run a basic nohup example?
Run `nohup [command] &` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --help do in nohup?
Display help information.