新啓動程序
|
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