Linux 后台运行命令

Linux · 26 天前
  1. 使用 nohup

    nohup scp -r user@remote:/path/to/remote/dir /local/dir
  2. screen命令

    # centos安装screen
     yum install -y screen

    使用screen命令

    # 创建一个新的窗口
    screen -S test
     
    # 进入窗口后 执行文件
    python test.py
     
    # 退出当前窗口
    ctrl+a+d   (方法1:保留当前窗口)
    screen -d  (方法2:保留当前窗口)
    exit       (方法3:退出程序,并关闭窗口)
     
    # 查看窗口
    screen -ls
     
    # 重新连接窗口
    screen -r id或窗口名称
     
    # 示例:
    screen -r 344 
    screen -r test

详细看这里:
Linux——让程序在后台运行(四种方法+使用推荐)

Theme Jasmine by Kent Liao