都是在后台运行
ctrl c | 关掉shell | ||
& | 运行 | 进程消失 | |
nohup | 进程消失 | 运行 |
完美用法
nohup command
&
ctrl+z
将命令放到后台,并处于暂停状态
ctrl+c
终止前台命令
jobs
查看后台运行的命令
test.sh>test.log 2>&1
2>&1 stdout和stderr都被重定向到了test.log
/dev/null 表示空设备文件
> 重定向
0 表示stdin标准输入
1 表示stdout标准输出
2 表示stderr标准错误