[linux] screen 사용법

somnode·2021년 3월 12일
0

OS : CentOS 7.6

screen 설치

$ sudo yum install screen

설정

$ vim ~/.screenrc
# screen version 3.09.15 버전 이상
hardstatus alwayslastline
hardstatus string ‘%{= bW}%-Lw%{= BW}%50>%n%f* %t%{= bW}%+Lw%< %{= bG}%-= %{-}'
vbell off
defscrollback 20000

# Make shift-PgUp and shift-PgDn work like they do in xterm. (Note that this
# requires xterm to be configured to pass those keys through, and not try to
# act on them itself.)
bindkey "^[[5;2~" eval "copy" "stuff ^u"
bindkey -m "^[[5;2~" stuff ^u
bindkey -m "^[[6;2~" stuff ^d

# Walking around region: C+\
bindkey -d "\034" focus down

# Resizing region
bind - resize -15
bind + resize +15
bind = resize =

# I don't want ^a s
bind s

# Kill the current region
bind q remove

# Automatically detach on hangup

사용법

$ screen -S <session_name>   # 세션 이름을 지정하여 실행
$ screen -r <session_name>   # 실행 중(Detached)인 세션에 접속
$ screen -x <session_name>   # 실행 중(Attached)인 세션에 접속
$ screen -list   # 실행 중인 세션 목록 보기
$ screen -dmS <session_name> <cmd>   # 세션은 Detached 상태로 <cmd>에 해당하는 데몬을 실행
$ screen -X -S <session_name> kill   # 실행 중인 세션 삭제

스크롤

  • Shift + PgUp : 스크롤 업
  • Shift + PgDn : 스크롤 다운

단축키

  • Ctrl + a + d: screen에서 빠져나오기

0개의 댓글