Skip to content

Instantly share code, notes, and snippets.

@pzxbc
Last active October 8, 2018 12:15
Show Gist options
  • Save pzxbc/2fcfc53a1db3814ace99698735d4370e to your computer and use it in GitHub Desktop.
Save pzxbc/2fcfc53a1db3814ace99698735d4370e to your computer and use it in GitHub Desktop.
[Tmux使用] #Tmux

Tmux

Tmux是一个终端复用软件,它可以让你在单一屏幕上创建和使用多个终端。它最大的作用是可以让你的终端会话永不掉线!

原理

通过伪终端技术来实现,类似相关的应用有SSHTelnet

相关介绍:
伪终端原理

使用

启动

.bash_aliases中设置别名

alias tmux='tmux -2'

这样启动的Tmux会支持256色

配置文件

系统配置文件路径/etc/tmux.conf,用户配置文件路径~/.tmux.conf

另外,Tmux支持插件,对应有插件管理应用TPM

配置备份

配置说明

  1. 键位映射
bind-key -T root C-p send-keys Up

Ctrl-p映射为Up键, -T root表示键位映射记入到root表中,这样Ctrl-p就直接映射为Up键了,不需要前置键来解析。

  1. 选项设置
set -g option 

常用操作

  1. tmux new-session -s session_name 创建新的session
  2. tmux attach-session -t session_name 重连已经存在的某个session
  3. man tmux查看Tmux帮助文档
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment