[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: from screen to tmux



On Mon, 22 Jun 2020 Victor Sudakov wrote:
Dear Colleagues,

I'm trying to switch from screen to tmux and for the life of me cannot
make it work the way I like. I have screen create multiple windows on
startup, by the following lines in ~/screenrc:

screen -t localhost 0
screen -t foo 1
screen -t bar 2
screen -t mail 3
select 0

I've tried multiple variants of ~/.tmux.conf and cannot make it start
with 4 windows. Tried different combinations of new-session, new-window,
attach-session, select-window and whatever, but when I run tmux, I just
see a single window.

What would be the equivalent of the above screen commands?

The first line below changes the command key from Ctrl-b to Ctrl-a, to
emulate Gnu screen.

  $ cat ~/.tmux.conf
  set-option -g prefix C-a
  new-session -nlocalhost -sMyFirstTmuxSession
  new-window -d -nfoo -t1
  new-window -d -nbar -t2
  new-window -d -nmail -t3

I started my first session with this command:

  $ tmux attach

And when I detach it, I can resume it again with the same command.

I based the config file above off the following example config, after
some hunting around in the man page.

  $ tail -n12 /usr/share/doc/tmux/example_tmux.conf
  # Create a single default session, because a session is created here, tmux
  # should be started with "tmux attach" rather than "tmux new"
  new -d -s0 -nirssi 'exec irssi'
  set -t0:0 monitor-activity on
  set  -t0:0 aggressive-resize on
  neww -d -ntodo 'exec emacs ~/TODO'
  setw -t0:1 aggressive-resize on
  neww -d -nmutt 'exec mutt'
  setw -t0:2 aggressive-resize on
  neww -d
  neww -d
  neww -d

The modifications were mainly to replace all the aliases in the
/usr/share/doc/ example with the corresponding full command
names. (Seems a bit weird to put abbreviated aliases in a example
meant to provide documentation.)

--
Firstly, you must always implicitly obey orders, without attempting to
form any opinion of your own respecting their propriety. Secondly, you
must consider every man your enemy who speaks ill of your king; and
thirdly, you must hate a Frenchman, as you do the devil. --H. Nelson


Reply to: