코딩일상

[Dev]리눅스 화면 분할 사용 본문

개발 공부/dev

[Dev]리눅스 화면 분할 사용

solutionMan 2024. 3. 6. 18:13
반응형

tmux 설치

  • 대부분의 Linux 배포판에서는 apt, yum 또는 brew 등의 패키지 관리자를 사용하여 tmux를 설치할 수 있습니다.
    • Debian/Ubuntu 계열: sudo apt-get install tmux
    • Red Hat/Fedora 계열: sudo yum install tmux
    • macOS: brew install tmux (Homebrew가 설치된 경우

tmux 사용법

  • 세션에서 나가기: Ctrl+b 누른 후 d
  • 창(pane) 분할하기
    • 가로로 분할: Ctrl+b 누른 후 "
    • 세로로 분할: Ctrl+b 누른 후 %
  • 창(pane) 이동: Ctrl+b 누른 후 방향키(↑, ↓, ←, →)
  • 창(pane) 크기 조절: Ctrl+b 누른 후 Ctrl 키를 누른 상태에서 방향키를 사용
  • 창(pane) 닫기: exit 명령어 입력 또는 해당 창(pane)에서 Ctrl+d
  • 세션 목록 보기: tmux ls
  • 다른 세션에 접속: tmux attach -t 세션명
  • 세션 종료: tmux kill-session -t 세션명

실 사용 예제

 

화면 4분할 쉘 스크립트

#!/bin/bash

# tmux 세션 시작
tmux new-session -d -s mySession

# 첫 번째 창에서 가로로 창 분할 (")
tmux split-window -v

# 각 창을 다시 세로로 분할 (%)
tmux select-pane -t 0
tmux split-window -h
tmux select-pane -t 2
tmux split-window -h

# 모든 창을 동일한 크기로 조정
tmux select-layout tiled

# tmux 세션에 접속
tmux attach-session -t mySession

 

파일 권한부여

chmod +x setup_tmux_4panes.sh

 

쉘 스크립트 실행

./setup_tmux_4panes.sh

 


 

A beginner's guide to tmux

Make your Linux terminal more useful with tmux, a terminal multiplexer that allows you to run multiple Linux programs over a single connection.

www.redhat.com

 

반응형
Comments