Unix i ctr+;在通过ssh的nohup过程中使用c?
我有一些关于诺胡普的问题。下面显示了我尝试过的命令和结果如果我必须使用Unix i ctr+;在通过ssh的nohup过程中使用c?,unix,ssh,remote-access,nohup,Unix,Ssh,Remote Access,Nohup,我有一些关于诺胡普的问题。下面显示了我尝试过的命令和结果如果我必须使用nohup&然后否认,那么nohup有什么用呢?我可以简单地使用&然后断开连接 使用nohup运行命令,然后使用ctr+c,该命令不会继续执行 $ nohup somecommand -option inputfile > outputfile nohup: ignoring input and appending output to `nohup.out' ^C 使用nohup运行命令&然后ctr+c,命令继续,但在
nohup&
然后否认
,那么nohup
有什么用呢?我可以简单地使用&
然后断开连接
使用nohup
运行命令,然后使用ctr+c,该命令不会继续执行
$ nohup somecommand -option inputfile > outputfile
nohup: ignoring input and appending output to `nohup.out'
^C
使用nohup运行命令&代码>然后ctr+c,命令继续,但在退出后停止
$ nohup somecommand -option inputfile > outputfile &
nohup: ignoring input and appending output to `nohup.out'
^C
$ exit
$ nohup somecommand -option inputfile > outputfile &
nohup: ignoring input and appending output to `nohup.out'
^C
$ disown
$ exit
$ somecommand -option inputfile > outputfile &
nohup: ignoring input and appending output to `nohup.out'
^C
$ disown
$ exit
使用nohup运行命令&代码>然后ctr+c,即使在退出后命令仍将继续执行
$ nohup somecommand -option inputfile > outputfile &
nohup: ignoring input and appending output to `nohup.out'
^C
$ exit
$ nohup somecommand -option inputfile > outputfile &
nohup: ignoring input and appending output to `nohup.out'
^C
$ disown
$ exit
$ somecommand -option inputfile > outputfile &
nohup: ignoring input and appending output to `nohup.out'
^C
$ disown
$ exit
运行命令时不使用nohup
,然后使用ctr+c,即使退出后命令仍将继续执行
$ nohup somecommand -option inputfile > outputfile &
nohup: ignoring input and appending output to `nohup.out'
^C
$ exit
$ nohup somecommand -option inputfile > outputfile &
nohup: ignoring input and appending output to `nohup.out'
^C
$ disown
$ exit
$ somecommand -option inputfile > outputfile &
nohup: ignoring input and appending output to `nohup.out'
^C
$ disown
$ exit
确保同时使用
nohup
和&
重定向stdout和stderr
nohup somecommand -option inputfile > outputfile 2>&1 &
exit
命令仍将运行。
2>&1
将stderr(fd=2)重定向到&1
的位置(参考stdout)