nohup命令 后台运行: sh test.sh & 关闭终端也运行: nohup sh test.sh & 一般使用: nohup sh test.sh > nohup.out 2>&1 & 2>&1 解释: 将标准错误 2 重定向到标准输出 &1 ,标准输出 &1 再被重定向输入到 nohup.out 文件中。