垂直分割 screen 視窗

網路上流傳太多 debian/ubuntu 的 screen 可以垂直分割,但是其他 linux distro 還沒跟進 (更何況是 FreeBSD 及 Mac OSX),那我們這些人怎辦呢?

其實就是使用 git 版的 screen

安裝

步驟:

$ git clone git://git.savannah.gnu.org/screen.git
$ cd screen/src
$ ./autogen.sh
$ ./configure
$ make
$ cp screen ~/bin/
$ ... # 進自己的 .<shell>.rc 去修改,比如 alias screen='~/bin/screen'

當然,如果覺得這個 git 版的 screen 要直接取代原本安裝的 screen,那就直接以下面的指令來取代剛剛的後兩個步驟:

$ sudo cp screen /usr/bin/screen # 或是 copy 到 /usr/local/bin/screen (FreeBSD) 等 `which screen` 出現的路徑

使用 (請注意<C-a> 後面按鍵的大小寫)

以下以 <C-a> 表示 Ctrl + a

「切成」垂直分割的視窗:

<C-a> |

「切換」到新生成的垂直視窗:

<C-a> <C-tab> <C-a>

持續「切換」垂直視窗:

<C-a> <tab>  # 就一直 <C-a> 再按 tab

「關閉」垂直分割的功能:

<C-a> Q

水平分割?

應該一般現行 screen 都有,只要把上述使用方法的第一步,改成:

<C-a> S

其他 screen 指令

Key Action Notes
Ctrl+a c new window  
Ctrl+a n next window  
Ctrl+a p previous window  
Ctrl+a “ select window from list  
Ctrl+a Ctrl+a previous window viewed  
Ctrl+a S split terminal horizontally into regions Ctrl+a c to create new window there
Ctrl+a | split terminal vertically into regions Requires debian/ubuntu patched screen 4.0
Ctrl+a :resize resize region  
Ctrl+a :fit fit screen size to new terminal size Ctrl+a F is the same. Do after resizing xterm
Ctrl+a :remove remove region Ctrl+a X is the same
Ctrl+a tab Move to next region  
Ctrl+a d detach screen from terminal Start screen with -r option to reattach
Ctrl+a A set window title  
Ctrl+a x lock session Enter user password to unlock
Ctrl+a [ enter scrollback/copy mode Enter to start and end copy region. Ctrl+a ] to leave this mod
Ctrl+a ] paste buffer Supports pasting between windows
Ctrl+a > write paste buffer to file useful for copying between screens
Ctrl+a < read paste buffer from file useful for pasting between screens
Ctrl+a ? show key bindings/command names Note unbound commands only in man page
Ctrl+a : goto screen command prompt up shows last command entered

你可能感兴趣的:(linux,screen)