我如何将当前运行的linux进程放在后台? [英] How can I put the current running linux process in background?
问题描述
我有一个命令,使用git从Linux shell将文件上传到远程服务器,这将需要很多小时才能完成。
I have a command that uploads files using git to a remote server from the Linux shell and it will take many hours to finish.
如何将运行程序在后台?那么我仍然可以在shell上工作,并且该过程也会完成?
How can I put that running program in background? So that I can still work on shell and that process also gets completed?
推荐答案
CTRL + Z然后使用命令<$ c
CTRL+Z then use the command bg
to put the process in the background.
EDIT
要开始一个进程,你甚至可以杀死终端,它仍然继续运行
To start a process where you can even kill the terminal and it still carries on running
nohup [command] [-args] > [filename] 2>&1 &
例如
nohup /home/edheal/myprog -arg1 -arg2 > /home/edheal/output.txt 2>&1 &
要忽略输出(不太明智),将文件名更改为 dev / null
To just ignore the output (not very wise) change the filename to /dev/null
要将错误消息设置为其他文件,请更改& 1
到文件名。
To get the error message set to a different file change the &1
to a filename.
这篇关于我如何将当前运行的linux进程放在后台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!