1. command & : 后台运行,你关掉终端会停止运行
2. nohup command & : 后台运行,你关掉终端也会继续运行(不依赖当前终端)

 

ctrl+z , 挂起程序

bg 1 , 1为作业号,后台运行

fg 1,调用到前台运行

jobs 查看后台的工作任务

 

输出重定向到文件

[nohup] command > out.file 2>&1 &

nohup, no hang up, 不依赖当前终端,及时关闭当前终端,也会继续运行。

 

参考地址: