Terminal
- 电传打字机 (Teletypewriter,
TTY) 是物理设备, 最初是为电报设计, 后来被连接到计算机上, 发送输入和获取输出. - 电传打字机 (
TTY) 现在被运行在内核中的模块所模拟, 被称为终端模拟器 (Terminal Emulator). - 伪终端 (Pseudo Terminal,
PTY) 是运行在用户区的终端模拟程序. - Shell 由 Terminal fork 出来, 是 Terminal 的子进程. Terminal 处理键盘事件, 负责字符的显示. Shell 负责解释执行用户输入的字符, 返回操作系统底层响应.
- 可以使用
stty命令对 TTY 设备进行配置. - 远程终端
ssh也是一种伪终端PTY:- Local:
PTYMaster is Terminal,PTYSlave isbashandssh client. - Remote:
PTY Master isssh server,PTYSlave isbash.
- Local:
TTY
Ctrl+Alt+F1 ~ F6: 在 TTY1 ~ TTY6 间切换.
Ghostty
Configuration
Config fonts and shaders ~/.config/ghostty/config.
Hotkeys
Ctrl+Shift+p: command palette.Ctrl+Shift+,: reload config.
Shell Integration
Source Ghostty shell integration manually for tmux.
Tmux
tmux ls
tmux new -s sessionID
tmux a -t sessionID
tmux show -g >> current.tmux.conf # export configuration
Setup
- Set up tmux
~/.config/tmux/tmux.conf. - Set up
Matugenconfig~/.config/matugen/config.tomland template~/.config/matugen/templates/tmux.conf.
Session
?: list key bindings:new: 创建新的 Session,其中 : 是进入 Tmux 命令行的快捷键s: list sessions$: rename the current sessiond: detach from the current session- Auto attach tmux session for terminal
~/.local/bin/ghostty-tmux.sh.
Window
c: create a new window,: rename the current windoww: list windows%: split horizontally": split verticallyn: change to the next windowp: change to the previous window0~9: select windows0through9
Pane
%: create a horizontal pane": create a vertical pane<space>: 切换 pane 布局h: move to left panej: move to below panel: move to right panek: move to above paneq: show pane numberso: toggle between panes}: swap with next pane{: swap with previous pane!: break the pane out of the windowx: kill current panet: 显示一个时钟
Scroll
C-a+[to into scroll mode,qto quit scroll mode- Copy mode can scroll too
set -g mouse onfor enabling mouse scrolling
Windows
Fix git bash flicker:
bind 'set bell-style none'