linux Screen 命令簡單總結

2021-10-23 13:25:16 字數 2902 閱讀 7739

系統管理員經常需要ssh 或者telent 遠端登入到linux 伺服器,經常執行一些需要很長時間才能完成的任務,比如系統備份、ftp 傳輸等等。通常情況下我們都是為每乙個這樣的任務開乙個遠端終端視窗,因為它們執行的時間太長了。必須等待它們執行完畢,在此期間不能關掉視窗或者斷開連線,否則這個任務就會被殺掉,一切半途而廢了。

yum -y install

screen

screen
exit
ctrl-a + d
screen -ls
screen -r sessionid
這個sessionid就是下圖紅色部分內容:

進入後相當於新開乙個視窗,進行編輯。如果想終端新視窗中的vi操作,ctrl-a + d即可回到原有視窗

然後screen -ls顯示出所有

root@node01:/home/myowner>screen -ls

there is a screen on:

25821.pts-7.mypc1 (detached)

1 socket in /var/run/uscreens/s-mypc1.

然後用screen -r 25821即可重新進入vi操作。

(會與securecrt快捷鍵衝突)

在每個screen session 下,所有命令都以 ctrl+a(c-a) 開始。

use: screen [-opts] [cmd [args]]

or: screen -r [host.tty]

引數

功能-4

use ipv4.

-6use ipv6.

-aforce all capabilities into each window』s termcap.

-a -[r|r]adapt all windows to the new display width & height.

-c file

read configuration file instead of 『.screenrc』.

-d (-r)

detach the elsewhere running screen (and reattach here).

-dms name

start as daemon: screen session in detached mode.

-d (-r)

detach and logout remote (and reattach here).

-d -rr

do whatever is needed to get a screen session.

-e xy

change command characters.

-fflow control on, -fn = off, -fa = auto.

-h lines

set the size of the scrollback history buffer.

-iinterrupt output sooner when flow control is on.

-llogin mode on (update /var/run/utmp), -ln = off.

-list

or -ls. do nothing, just list our sockdir.

-lturn on output logging.

-mignore $sty variable, do create a new screen session.

-ochoose optimal output rather than exact vt100 emulation.

-p window

preselect the named window if it exists.

-qquiet startup. exits with non-zero return code if unsuccessful.

-rreattach to a detached screen process.

-rreattach if possible, otherwise start a new session.

-s shell

shell to execute rather than $shell.

-s sockname

name this session.sockname instead of...

-t title

set title. (window』s name).

-t term

use term as $term for windows, rather than 「screen」.

-utell screen to use utf-8 encoding.

-vprint 「screen version 4.00.03 (fau) 23-oct-06」.

-wipe

do nothing, just clean up sockdir.

-xattach to a not detached screen. (multi display mode).

-xexecuteas a screen command in the specified session.

Linux screen命令詳解

linux下screen主要是管理程式的,用screen管理的程序可以在使用者斷開連線的時候保持程式繼續在伺服器上執行。第一步 首先肯定是登入到linux伺服器上。敲入screen ls 命令可以看到伺服器上已有的screen。用screen s s的大寫 screen名稱可以建立乙個screen。...

linux screen 命令詳解

使用telnet或ssh遠端登入linux時,如果連線非正常中斷 遠端機器關閉 重新連線時,系統將開乙個新的session,無法恢復原來的session.screen命令可以解決這個問題。screen工具是乙個終端多路轉接器,在本質上,這意味著你能夠使用乙個單一的終端視窗執行多終端的應用。1,開啟乙...

linux screen 命令詳解

作為linux伺服器管理員,經常要使用ssh登陸到遠端linux機器上做一些耗時的操作。也許你遇到過使用telnet或ssh遠端登入linux,執行一些程式。如果這些程式需要執行很長時間 幾個小時 而程式執行過程中出現網路故障,或者客戶機故障,這時候客戶機與遠端伺服器的鏈結將終端,並且遠端伺服器沒有...