xterm - Émulateur de Terminal du Système X Window
xterm est l’émulateur de terminal standard pour le Système X Window, servant de base à de nombreuses applications de terminal modernes. Initialement développé en 1984, xterm reste l’un des émulateurs de terminal les plus utilisés et les plus riches en fonctionnalités dans les systèmes de type Unix. Il offre des options de personnalisation étendues, un support Unicode et sert d’implémentation de référence pour les standards d’émulation de terminal.
Installation
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 (avec X11)
# Install XQuartz first, then:
brew install xterm
FreeBSD
pkg install xterm
Utilisation de Base
Démarrer 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
Options de Ligne de Commande
# 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
Raccourcis Clavier
Sélection de Texte et Presse-Papiers
# 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
Contrôle de Fenêtre et de Police
# 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
Défilement
# 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
Contrôle du Terminal
# 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)
Opérations de Souris
Menus Contextuels
# 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
Modes de Sélection
# 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
Configuration
Configuration par Ligne de Commande
# 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"
Configuration des Ressources 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
Appliquer les Ressources X
# Load resources
xrdb -merge ~/.Xresources
# Load and replace all resources
xrdb -load ~/.Xresources
# View current resources
xrdb -query
# Remove all resources
xrdb -remove
Fonctionnalités Avancées
Unicode et Internationalisation
# 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
Modes d’Émulation de Terminal
# VT100 mode
xterm -tn vt100
# VT220 mode
xterm -tn vt220
# Linux console mode
xterm -tn linux
# Set terminal type
export TERM=xterm-256color
Journalisation et Enregistrement de Session
Would you like me to continue with the remaining sections?```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
```## Exemples de Personnalisation
```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
```### Schémas de Couleurs
```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
```### Configurations de Polices
```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
```### Intégration du Gestionnaire de Fenêtres
```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
```## Dépannage
```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
```### Problèmes Courants
```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
```### Optimisation des Performances
```bash
# With tmux
xterm -e tmux
# With screen
xterm -e screen
# With specific session
xterm -e "tmux attach-session -t main"
```### Débogage
```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"
```## Intégration avec d'Autres Outils
```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" &
```### Multiplexeurs de Terminal
```bash
# Use version control for configs
cd ~
git init
git add .Xresources
git commit -m "Initial xterm configuration"
# Backup configurations
cp ~/.Xresources ~/.Xresources.backup
```### Intégration de Shell
```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
```### Scripts de Gestionnaire de Fenêtres
```bash
# Optimize for speed
XTerm*jumpScroll: true
XTerm*multiScroll: true
XTerm*fastScroll: true
# Limit resource usage
XTerm*saveLines: 2000
XTerm*buffered: true
```## Meilleures Pratiques