创建一个tmux会话而不附加它


14

我正在尝试创建一个新tmux会话而不附加它。跑步man tmux对此没有任何显示,但是必须有某种方法可以执行此操作。

Answers:


14

你可以跑

tmux new-session -d

以分离模式启动新会话。

$ tmux list-sessions
failed to connect to server: Connection refused
$ tmux new-session -d
$ tmux list-sessions 
0: 1 windows (created Sun Aug 21 16:18:46 2016) [80x23]

您可以运行特定的命令,例如

tmux new-session -d vi

vi在新会话中运行,但已分离。

$ ps -ef | grep -w vi   
sweh      2313  1906  0 16:20 pts/2    00:00:00 grep -w vi
$ tmux new-session -d vi
$ ps -ef | grep -w vi   
sweh      2317     1  0 16:20 ?        00:00:00 tmux new-session -d vi
sweh      2318  2317  0 16:20 pts/3    00:00:00 vi
sweh      2320  1906  0 16:20 pts/2    00:00:00 grep -w vi

可以通过-s-d

$ tmux new-session -d -s foobar          
$ tmux list-sessions
foobar: 1 windows (created Sun Aug 21 16:27:10 2016) [80x23]

$ tmux attach-session -t foobar

能够命名该会话怎么样?我试过:tmux new -s {name} -d那没有用。
innectic

@innectic看起来像tmux new -d -s <name>作品
RPiAwesomeness

@innectic查看最新答案
Stephen Harris
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.