新启动程序
|
nohup ./test.sh >log 2>&1 &
|
setsid ./test.sh >log 2>&1 &
|
已运行程序
|
nohup -p PID
|
disown -h %n
|
screen -S NAME
|
screen -S sxhlinux
|
新建一个名为sxhlinux的screen会话
|
screen -ls
|
screen -ls
|
查看当前系统中全部的screen会话
|
screen -d NAME
|
screen -d sxhlinux
|
将sxhlinux会话与当前shell终端分离
|
screen -r NAME
|
screen -r sxhlinux
|
在当前shell进程中与名为sxhlinux的进程从新链接
|
screen -R NAME
|
screen -R sxhlinux
|
同-r选项,另外若是sxhlinux不存在,
就会从新新建一个名为sxhlinux的screen会话
|
screen -x NAME
|
screen -x sxhlinux
|
多个终端同时操做名为sxhlinux的screen会话,操做同步可见
|
ctrl-a c
|
在当前会话中建立一个新的的shell窗口
|
ctrl-a n/p
|
切换到下/上一个窗口
|
ctrl-a d
|
使当前会话与原shell detach
|
ctrl-a w
|
列出当前会话中的全部窗口
|
ctrl-a k
|
关闭当前窗口
|
ctrl-a x/q
|
锁定、解锁当前窗口
|
ctrl-a [/]
|
[启动复制模式(vi操做习惯),第一次空格键表示开始复制,第二次空格表示结束复制;
]将[复制的内容粘贴到当前位置
|
ctrl-a S/|
|
将当前屏幕水平/垂直分红两部分,能够经过ctrl-a TAB来切换
|
tmux new -s NAME
|
tmux new -s sxhlinux
|
建立一个
|
tmux detach -s NAME
|
tmux detach -s sxhlinux
|
将sxhlinux会话分离
|
tmux attach -t NAME
|
tmux a -t sxhlinux
|
从新链接sxhlinux会话
|
tmux ls
|
tmux ls
|
列出当前全部的tmux会话
|
tmux lsc [-t NAME]
|
tmux lsc [-t sxhlinux]
|
列出全部[链接到sxhlinux]的客户端
|
tmux rename -t OLD NEW
|
tmux rename -t sxh sxhlinux
|
将会话sxh重命名为sxhlinux
|
tmux kill-session -t NAME
|
tmux kill-session -t sxhlinux
|
关闭sxhlinux会话
|
ctrl-a c
|
同screen
|
ctrl-a d
|
同screen
|
ctrl-a f
|
在当前会话全部打开的窗口中搜索文本
|
ctrl-a n/p
|
同screen
|
ctrl-a &
|
关闭当前窗口
|
ctrl-a x
|
关闭当前会话
|
set -g prefix C-a #配置快捷键前缀为ctrl a unbind C-b #取消快捷键前缀ctrl b unbind '%' #取消左右分pane的快捷键 % bind | splitw -h #指定左右分pane的快捷键 | bind k selectp -U #指定选择上方pane的快捷键 k bind j selectp -D #指定选择上方pane的快捷键 j bind h selectp -L #指定选择上方pane的快捷键 h bind l selectp -R #指定选择上方pane的快捷键 l
# Edit ~/.tmux.conf and added lines below at the bottom set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-continuum' set -g @continuum-restore 'on' # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) run '~/.tmux/plugins/tpm/tpm'
参考资料:https://github.com/tmux/tmux https://github.com/tmux-plugins/tpm https://github.com/tmux-plugins/tmux-continuumlinux