Social icon element need JNews Essential plugin to be activated.
星期日, 2 4 月, 2023
No Result
View All Result
育心文具行

育心文具行

  • 首頁
  • 創作x紀錄
  • 心得x體驗
  • 筆記x備忘
  • 閒談x雜記
  • 當紅俱樂部
  • 留言給我
育心文具行
  • 首頁
  • 創作x紀錄
  • 心得x體驗
  • 筆記x備忘
  • 閒談x雜記
  • 當紅俱樂部
  • 留言給我
No Result
View All Result
育心文具行
Home 心得x體驗

Linux SSH 斷線後保持 session 的工具 – Screen

2021-09-01
in 心得x體驗
Reading Time: 2 mins read
Share on FacebookShare on Twitter

紀錄一下之前用很久的一個 linux 套件,主要用途是作爲讓 Server 在再斷線後,依然可以跑池長時間非背景運作。

安裝方法,權限問題請自行加上 sudo:

# ubuntu \ debian
apt-get install screen

# centos
yum install screen

一些基本的操作:

# 建立一個新的 screen 
screen -U -S SCREEN_NAME

# 進入已開啟的 screen
screen -drU SCREEN_NAME

# 列出所有 screen
screen -ls

至於進入 screen 內的操作,請參考:

linuxize.com
Please Wait... | Cloudflare

大概可以記住:所有指令都是 ctrl + a 開始。

  • c 是關閉一個建立一個新視窗。另外要離開當前視窗,就和一般 ssh 一樣輸入 exit 就行了,會殺掉當前視窗的 session。
  • d 是離開當前的 screen (keep session)
  • A 大寫的 a 可以重新命名當前的視窗,這很好用

以前同事有分享一個 screenrc 設定檔案,不錯用。請自行取代 /etc/screenrc 檔案:

startup_message off
defencoding utf8
encoding utf8 utf8
#caption always "%{= wk} %{= KY} [%n]%t @ %H %{-} %= %{= KR} %l %{-} | %{= KG} %Y-%m-%d %{-} "
#hardstatus alwayslastline " %-Lw%{= Bw}%n%f %t%{-}%+Lw %=| %0c:%s "
#bindkey ^[z prev
#bindkey ^[x next
termcapinfo xterm*|rxvt* '[email protected]:[email protected]'
termcapinfo xterm [email protected]:[email protected]
vbell off
# C + left : prev
# C + right : next
bindkey "^[[1;5C" next
bindkey "^[O5C" next
bindkey "^[[C" next
bindkey "^[[1;5D" prev
bindkey "^[O5D" prev
bindkey "^[[D" prev


# C-a b : encoding big5
# C-a u : encoding utf8
bind b encoding big5 utf8
bind u encoding utf8 utf8


# C-b $num : move current window to number $num
bind -c move 0 number 0
bind -c move 1 number 1
bind -c move 2 number 2
bind -c move 3 number 3
bind -c move 4 number 4
bind -c move 5 number 5
bind -c move 6 number 6
bind -c move 7 number 7
bind -c move 8 number 8
bind -c move 9 number 9
bindkey "^b" command -c move


# F12 : fast kill
#bindkey "^[[24~" kill


#termcapinfo xterm 'hs:ts=\E]0;:fs=\007:ds=\E]0;bash\007'
#caption always "%{= bk} %{= wk} %-Lw%{by}%n+%f %t%{wk}%{wk}%+Lw %=%{kw}%{= R}%{-}"


shelltitle '$ |csh'


defhstatus "\005t"
#hardstatus on
#caption always "%{= wk} %{= KY} [%n]%t @ %H %{-} %= %{= KR} %l %{-} | %{= KG} %Y-%m-%d %{-} "
#hardstatus alwayslastline " %-Lw%{= Bw}%n%f %t%{-}%+Lw %=| %0c:%s "


#buttom status bar
caption always "%{= .G} %-w%<%{=ub .y}[%n %t]%{= .G}%+w "
hardstatus alwaysignore
#hardstatus alwayslastline "%{= .K} [%l]%<%=%{= .W}@%H %=%{= .y} %Y/%m/%d%{= .m} %C %A"


#shelltitle '$|csh'
#caption always "%{bw}%M/%d %c %{wb} %-w%{c}%n %t%{w}%+w%{k}"


shell -$SHELL
Tags: centosdebianlinuxscreenubuntu
Share22Tweet14Share6
Previous Post

排程檢查服務是否正常

Next Post

WordPress 之中藍新金流開啟後, Elementor 外掛有時會打不開的問題處理

Next Post

Wordpress 之中藍新金流開啟後, Elementor 外掛有時會打不開的問題處理

Wordpress SSL 錯誤修復

Wordpress 核心架構圖/堆棧圖 相關檔案結構說明鏈結

發佈留言 取消回覆

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Google reCAPTCHA 保護機制,這項服務遵循 Google 隱私權政策及服務條款。

全站搜尋

No Result
View All Result

近期文章

  • PHP Codeigniter 4 框架速度優化
  • 《自慢10:18項修練》第四部讀書心得
  • 網頁製作,外包要注意的事情
  • 《自慢10:18項修練》第三部讀書心得
  • 在 Mac 上,大型 CSV 檔案切割方法

分類

  • 創作x紀錄 (12)
  • 心得x體驗 (32)
  • 筆記x備忘 (26)
  • 閒談x雜記 (4)

贊助買咖啡

Social icon element need JNews Essential plugin to be activated.

標籤

22.04 android centos Channel Access Token composer dart dev dist f facebook flutter gist git git hook gitignore highlight hook ios line linode linux MAC php php7.3 php8 QBQ!問題背後的問題 sdk sublime sublime3 ubuntu vps vue vue.js vue3 wordpress 團隊,從傳球開始 團隊,從傳球開始:五百年都難以超越的 UCLA 傳奇教練伍登培養優越人才和團隊的領導心法 意志力 權限 自慢10 自慢10:18項修練 規格 調整硬碟空間 調整規格 讀書心得

文章分類

  • 創作x紀錄 (12)
  • 心得x體驗 (32)
  • 筆記x備忘 (26)
  • 閒談x雜記 (4)

近期文章

  • PHP Codeigniter 4 框架速度優化
  • 《自慢10:18項修練》第四部讀書心得
  • 網頁製作,外包要注意的事情
  • 《自慢10:18項修練》第三部讀書心得
  • 在 Mac 上,大型 CSV 檔案切割方法

© 2020 hipster.crazyjerry.studio - a blog about experience, notes and nonsense, by Jerry Lin.

No Result
View All Result
  • 首頁
  • 創作x紀錄
  • 心得x體驗
  • 筆記x備忘
  • 閒談x雜記
  • 當紅俱樂部
  • 留言給我

© 2020 hipster.crazyjerry.studio - a blog about experience, notes and nonsense, by Jerry Lin.