星期日, 17 8 月, 2025
No Result
View All Result
育心文具行

育心文具行

  • 首頁
  • 心得x體驗
  • 筆記x備忘
  • 閒談x雜記
  • 我的工具箱
  • 關於我
育心文具行
  • 首頁
  • 心得x體驗
  • 筆記x備忘
  • 閒談x雜記
  • 我的工具箱
  • 關於我
No Result
View All Result
育心文具行
Home 筆記x備忘

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

2023-10-09
in 筆記x備忘
Reading Time:2 mins read
A A
0

紀錄一下之前用很久的一個 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* 'ti@:te@'
termcapinfo xterm ti@:te@
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
Share22Tweet14
Previous Post

排程檢查服務是否正常

Next Post

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

Related Posts

筆記x備忘

使用 Nginx 基本認證保護動態內容。以一個舊網站為例。

最近處理一個舊網站,因為是 demo 用...

2024-10-27
100
筆記x備忘

Mac 使用 Nodejs 的管理工具 n 來切換版本

Nodejs 在前端應用越來越廣泛,有時...

2024-08-19
100
筆記x備忘

使用 Dropbox 實作異地備份

這邊是以線上運作中的 web 網站作為目...

2024-06-20
100
筆記x備忘

Linux 上使用 Monit 做監控

Monit 是一個不錯用的監控軟體,可以...

2023-12-26
100
dense computer vision output log text IDE, font, layout, debug session, black and white, command line
筆記x備忘

開放原始碼防毒軟體 ClamAV

ClamAV 是 Linux 相當知名的...

2024-12-15
100
筆記x備忘

製作 Ubuntu 遠端桌面伺服器

有時我們會需要安裝一個雲端的伺服器是有 ...

2023-10-05
100
Load More
Next Post

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

Wordpress SSL 錯誤修復

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

全站搜尋

No Result
View All Result

關於我

育心文具行

Jerry Lin

程式設計師

育心文具行是一家文具店,老闆的小兒子是一個設計師,職業是設計程式,興趣是設計人,倒是還沒有實作的機會。
--
所有的相遇都不是巧合。
在廣告公司待了三年有兩年多在做內容產品,離職後繼續在內容產業走了四年多,最後選則離開台灣的公司體制在家 SOHO ,碰上了 2020 年疫情才知道原來自己這是走在時代的潮流尖端。 感謝許多老闆和貴人相助,至今目前尚能存活,在台北街頭努力著。

近期文章

  • LLM 生成參數清單與說明
  • 使用 google 的 Gemini CLI 來製作字幕
  • 2025-07-29 社交模式檢討
  • 2025-07-25 社交模式檢討
  • 2025-07-12 N8N Workshop 筆記心得

分類

  • 心得x體驗 (47)
  • 筆記x備忘 (79)
  • 閒談x雜記 (15)

贊助買咖啡

Facebook Instagram RSS

標籤

android ci4 cloudflare Codeigniter codeigniter 4 flutter git ios linode linux MAC macos nginx php plugin QBQ!問題背後的問題 server work sublime sublime text vps vue.js vue3 What if What If? 如果這樣,會怎樣? wordpress 備份 原則 團隊,從傳球開始 團隊,從傳球開始:五百年都難以超越的 UCLA 傳奇教練伍登培養優越人才和團隊的領導心法 外掛 如果這樣,會怎樣?:胡思亂想的搞怪趣問 正經認真的科學妙答 媒體識讀 工作的原則 心得 意志力 活動心得 灰階思考 第三部分 第二部分 第四部分 股癌 自慢10 自慢10:18項修練 謝孟恭 讀書心得

文章分類

  • 心得x體驗 (47)
  • 筆記x備忘 (79)
  • 閒談x雜記 (15)

近期文章

  • LLM 生成參數清單與說明
  • 使用 google 的 Gemini CLI 來製作字幕
  • 2025-07-29 社交模式檢討
  • 2025-07-25 社交模式檢討
  • 2025-07-12 N8N Workshop 筆記心得

近期留言

  • 「Bolin Lai」於〈WordPress 之中藍新金流開啟後, Elementor 外掛有時會打不開的問題處理〉發佈留言
  • 「Jerry Lin」於〈WordPress 之中藍新金流開啟後, Elementor 外掛有時會打不開的問題處理〉發佈留言
  • 「JCL」於〈WordPress 之中藍新金流開啟後, Elementor 外掛有時會打不開的問題處理〉發佈留言

文章月曆

2025 年 8 月
日 一 二 三 四 五 六
 12
3456789
10111213141516
17181920212223
24252627282930
31  
« 7 月    

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

No Result
View All Result
  • 首頁
  • 心得x體驗
  • 筆記x備忘
  • 閒談x雜記
  • 我的工具箱
  • 關於我

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