The nohup
command can run the program in a way that ignores the hanging signal. The output information of the program will not be displayed to the terminal, but redirected to the nohup.out
file, which is usually called running in the background. This is often done when connecting to a remote server through ssh
. If you run it directly, when you exit the connection, the program running in the corresponding terminal will stop.
Syntax format: nohup [parameter]
Common parameters
Example
# 在后台运行run.sh脚本nohup ./run.sh # 在后台运行run.sh脚本,并将程序输出重定向到文件output.txt nohup ./run.sh > output.txt
This article is reprinted from https://xugaoxiang.com/2022/06/15/linux-cmds-54-nohup/
This site is for inclusion only, and the copyright belongs to the original author.