xterm - X 윈도우 시스템 터미널 에뮬레이터
xterm은 X 윈도우 시스템의 표준 터미널 에뮬레이터로, 많은 현대 터미널 애플리케이션의 기반이 됩니다. 1984년에 처음 개발된 이후, xterm은 Unix 계열 시스템에서 가장 널리 사용되고 기능이 풍부한 터미널 에뮬레이터 중 하나로 남아있습니다. 광범위한 사용자 정의 옵션, 유니코드 지원을 제공하며, 터미널 에뮬레이션 표준의 참조 구현체 역할을 합니다.
설치
Linux (Debian/Ubuntu)
sudo apt update
sudo apt install xterm
Linux (Red Hat/CentOS/Fedora)
sudo dnf install xterm
# or on older systems:
sudo yum install xterm
Linux (Arch)
sudo pacman -S xterm
macOS (X11 포함)
# Install XQuartz first, then:
brew install xterm
FreeBSD
pkg install xterm
기본 사용법
xterm 시작하기
# Basic xterm window
xterm
# Start with specific title
xterm -title "My Terminal"
# Start with specific geometry
xterm -geometry 80x24+100+100
# Start with specific font
xterm -fn "fixed"
# Start in fullscreen
xterm -fullscreen
명령줄 옵션
# Display options
xterm -display :0.0
xterm -geometry 132x43
xterm -iconic
xterm -maximized
# Font options
xterm -fn "9x15"
xterm -fa "Monospace:size=12"
xterm -fs 14
# Color options
xterm -fg white -bg black
xterm -rv # Reverse video
xterm -cm # Color mode
# Scrolling options
xterm -sb # Enable scrollbar
xterm -sl 1000 # Set scrollback lines
xterm -si # Scroll on input
xterm -sk # Scroll on key press
# Logging options
xterm -l # Enable logging
xterm -lf logfile.txt # Log to specific file
키보드 단축키
텍스트 선택 및 클립보드
# Text selection
Left Click + Drag # Select text
Double Click # Select word
Triple Click # Select line
Shift + Left Click # Extend selection
# Clipboard operations
Ctrl + Shift + C # Copy (modern xterm)
Ctrl + Shift + V # Paste (modern xterm)
Middle Click # Paste selection (traditional)
Shift + Insert # Paste clipboard
# Traditional X11 clipboard
Select text # Automatically copies to primary selection
Middle Click # Paste primary selection
창 및 폰트 제어
# Font size control
Ctrl + Right Click # Font menu
Ctrl + Plus # Increase font size
Ctrl + Minus # Decrease font size
Ctrl + 0 # Reset font size
# Window operations
Alt + F4 # Close window
Alt + F10 # Maximize window
Alt + F9 # Minimize window
Alt + F5 # Restore window
스크롤링
# Scrollback navigation
Shift + Page Up # Scroll up one page
Shift + Page Down # Scroll down one page
Shift + Home # Scroll to top
Shift + End # Scroll to bottom
Shift + Up Arrow # Scroll up one line
Shift + Down Arrow # Scroll down one line
터미널 제어
# Terminal reset and clear
Ctrl + L # Clear screen
reset # Reset terminal state
clear # Clear screen content
# Process control
Ctrl + C # Interrupt (SIGINT)
Ctrl + Z # Suspend (SIGTSTP)
Ctrl + D # EOF/Exit
Ctrl + \ # Quit (SIGQUIT)
마우스 작업
컨텍스트 메뉴
# Main menu (Ctrl + Left Click)
- New Window
- Print Window
- Redraw Window
- Send Signal
- Quit
# VT Options menu (Ctrl + Middle Click)
- Enable/Disable Scrollbar
- Enable/Disable Jump Scroll
- Enable/Disable Reverse Video
- Enable/Disable Auto Wraparound
- Enable/Disable Reverse Wraparound
- Enable/Disable Auto Linefeed
- Enable/Disable Application Cursor Keys
- Enable/Disable Application Keypad
- Scroll to Bottom on Output
- Scroll to Bottom on Key
- Allow 80/132 Column Switching
- Keep Selection
- Select to Clipboard
# VT Fonts menu (Ctrl + Right Click)
- Default Font
- Tiny Font
- Small Font
- Medium Font
- Large Font
- Huge Font
- Escape Sequence Font
- Selection Font
선택 모드
# Selection types
Single Click # Position cursor
Double Click # Select word
Triple Click # Select line
Quadruple Click # Select all
# Extended selection
Shift + Click # Extend selection
Ctrl + Click # Rectangular selection
Alt + Click # Line selection mode
구성
명령줄 구성
# Resource file options
xterm -xrm "XTerm*background: black"
xterm -xrm "XTerm*foreground: white"
xterm -xrm "XTerm*font: 9x15"
xterm -xrm "XTerm*scrollBar: true"
# Multiple resources
xterm -xrm "XTerm*background: black" \
-xrm "XTerm*foreground: green" \
-xrm "XTerm*font: fixed"
X 리소스 구성 (~/.Xresources)
! Basic appearance
XTerm*background: black
XTerm*foreground: white
XTerm*cursorColor: yellow
XTerm*pointerColor: red
XTerm*borderColor: blue
! Font configuration
XTerm*font: -misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1
XTerm*boldFont: -misc-fixed-bold-r-normal--14-130-75-75-c-70-iso8859-1
XTerm*faceName: Liberation Mono:size=12:antialias=false
XTerm*faceSize: 12
! Scrolling
XTerm*scrollBar: true
XTerm*scrollbar.width: 8
XTerm*rightScrollBar: true
XTerm*saveLines: 10000
XTerm*scrollTtyOutput: false
XTerm*scrollKey: true
! Bell configuration
XTerm*visualBell: true
XTerm*bellIsUrgent: true
! Selection and clipboard
XTerm*highlightSelection: true
XTerm*trimSelection: true
XTerm*cutNewline: false
XTerm*cutToBeginningOfLine: false
XTerm*charClass: 33:48,35:48,37:48,43:48,45-47:48,64:48,95:48,126:48
! Terminal behavior
XTerm*loginShell: true
XTerm*jumpScroll: true
XTerm*multiScroll: true
XTerm*toolBar: false
XTerm*titeInhibit: false
! Color scheme (Solarized Dark example)
XTerm*color0: #073642
XTerm*color1: #dc322f
XTerm*color2: #859900
XTerm*color3: #b58900
XTerm*color4: #268bd2
XTerm*color5: #d33682
XTerm*color6: #2aa198
XTerm*color7: #eee8d5
XTerm*color8: #002b36
XTerm*color9: #cb4b16
XTerm*color10: #586e75
XTerm*color11: #657b83
XTerm*color12: #839496
XTerm*color13: #6c71c4
XTerm*color14: #93a1a1
XTerm*color15: #fdf6e3
X 리소스 적용
# Load resources
xrdb -merge ~/.Xresources
# Load and replace all resources
xrdb -load ~/.Xresources
# View current resources
xrdb -query
# Remove all resources
xrdb -remove
고급 기능
유니코드 및 국제화
# UTF-8 support
xterm -u8
# Locale-specific startup
LC_ALL=en_US.UTF-8 xterm
# Font configuration for Unicode
XTerm*utf8: 1
XTerm*locale: true
XTerm*utf8Title: true
XTerm*fontMenu*fontdefault*Label: Default
XTerm*faceName: DejaVu Sans Mono:size=11
XTerm*faceNameDoublesize: WenQuanYi Zen Hei Mono:size=11
터미널 에뮬레이션 모드
# VT100 mode
xterm -tn vt100
# VT220 mode
xterm -tn vt220
# Linux console mode
xterm -tn linux
# Set terminal type
export TERM=xterm-256color
로깅 및 세션 기록```bash
Enable logging
xterm -l -lf ~/xterm.log
Logging with timestamp
xterm -l -lf ~/xterm-$(date +%Y%m%d-%H%M%S).log
Session recording with script
script -f ~/session.log
Then start xterm within the script session
```bash
# Disable dangerous features
XTerm*allowSendEvents: false
XTerm*allowWindowOps: false
XTerm*allowTitleOps: false
XTerm*allowFontOps: false
# Secure keyboard input
XTerm*secureKeyboard: true
# Disable menu access
XTerm*omitTranslation: popup-menu
```## 사용자 정의 예시
```bash
# Solarized Light
XTerm*background: #fdf6e3
XTerm*foreground: #657b83
XTerm*fadeColor: #fdf6e3
XTerm*cursorColor: #586e75
XTerm*pointerColorBackground: #93a1a1
XTerm*pointerColorForeground: #586e75
# Monokai
XTerm*background: #272822
XTerm*foreground: #f8f8f2
XTerm*cursorColor: #f8f8f0
XTerm*color0: #272822
XTerm*color1: #f92672
XTerm*color2: #a6e22e
XTerm*color3: #f4bf75
XTerm*color4: #66d9ef
XTerm*color5: #ae81ff
XTerm*color6: #a1efe4
XTerm*color7: #f8f8f2
# Gruvbox Dark
XTerm*background: #282828
XTerm*foreground: #ebdbb2
XTerm*color0: #282828
XTerm*color1: #cc241d
XTerm*color2: #98971a
XTerm*color3: #d79921
XTerm*color4: #458588
XTerm*color5: #b16286
XTerm*color6: #689d6a
XTerm*color7: #a89984
```### 색상 스킴
```bash
# Bitmap fonts
XTerm*font: -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-1
XTerm*boldFont: -misc-fixed-bold-r-semicondensed--13-120-75-75-c-60-iso8859-1
# TrueType fonts
XTerm*faceName: Inconsolata:size=12
XTerm*faceSize: 12
XTerm*renderFont: true
# Multiple font sizes
XTerm*faceSize1: 8
XTerm*faceSize2: 10
XTerm*faceSize3: 12
XTerm*faceSize4: 14
XTerm*faceSize5: 16
XTerm*faceSize6: 18
```### 글꼴 구성
```bash
# Window class and name
XTerm*iconName: Terminal
XTerm*title: xterm
XTerm*geometry: 80x24+0+0
# Window manager hints
XTerm*allowWindowOps: true
XTerm*disallowedWindowOps: 1,2,3,4,5,6,7,8,9,11,13,18,19
# Session management
XTerm*sessionMgt: true
```### 창 관리자 통합
```bash
# Font problems
xlsfonts|grep fixed # List available fonts
xterm -fn fixed # Use basic fixed font
fc-list : family|grep Mono # List monospace fonts
# Color issues
echo $TERM # Check terminal type
tput colors # Check color support
xterm -tn xterm-256color # Force 256 color mode
# Clipboard problems
xclip -version # Check if xclip is installed
xsel --version # Check if xsel is installed
echo $DISPLAY # Verify X11 display
# Locale issues
locale # Check current locale
xterm -u8 # Enable UTF-8 mode
export LANG=en_US.UTF-8 # Set UTF-8 locale
```## 문제 해결
```bash
# Disable unnecessary features
XTerm*jumpScroll: true
XTerm*multiScroll: true
XTerm*fastScroll: true
# Reduce resource usage
XTerm*saveLines: 1000 # Limit scrollback
XTerm*visualBell: false # Disable visual bell
XTerm*toolBar: false # Disable toolbar
# Font rendering optimization
XTerm*renderFont: true
XTerm*antialias: true
XTerm*faceSize: 11
```### 일반적인 문제
```bash
# Debug mode
xterm -debug 1
# Verbose output
xterm -verbose
# Check resources
xrdb -query|grep -i xterm
# Test configuration
xterm -xrm "XTerm*background: red" -geometry 40x10
```### 성능 최적화
```bash
# With tmux
xterm -e tmux
# With screen
xterm -e screen
# With specific session
xterm -e "tmux attach-session -t main"
```### 디버깅
```bash
# Specific shell
xterm -e bash
xterm -e zsh
xterm -e fish
# Login shell
xterm -ls
# Execute command and exit
xterm -e "ls -la; read"
```## 다른 도구와의 통합
```bash
#!/bin/bash
# Launch multiple xterm windows
xterm -geometry 80x24+0+0 -title "Main" &
xterm -geometry 80x24+400+0 -title "Logs" -e "tail -f /var/log/syslog" &
xterm -geometry 80x24+0+300 -title "Monitor" -e "htop" &
```### 터미널 멀티플렉서
```bash
# Use version control for configs
cd ~
git init
git add .Xresources
git commit -m "Initial xterm configuration"
# Backup configurations
cp ~/.Xresources ~/.Xresources.backup
```### 셸 통합
```bash
# Disable dangerous operations
XTerm*allowSendEvents: false
XTerm*allowWindowOps: false
XTerm*allowTitleOps: false
# Use secure keyboard mode
XTerm*secureKeyboard: true
# Limit font operations
XTerm*allowFontOps: false
```### 창 관리자 스크립트
```bash
# Optimize for speed
XTerm*jumpScroll: true
XTerm*multiScroll: true
XTerm*fastScroll: true
# Limit resource usage
XTerm*saveLines: 2000
XTerm*buffered: true
```## 모범 사례