Live data from Hacker News

Tmux Tutorial

leimao.github.io

41–50 of 166 posts

Re: Tmux Tutorial

#41
post #40

Cool, a coworker showed me tmux yesterday. One question we had was about scrolling in the tmux window and keeping the terminal output (as in Linux where I can scroll back with Shift+PageUp). Does anybody knows how that works with tmux?

You can enter scroll mode with ctrl+b+[ then you can mouse wheel, PageUp, etc.

To exit just press q or ctrl+c

Re: Tmux Tutorial

#42

One of the downsides listed when you don't use tmux is that you have to type your password for each terminal you open to the remote machine. Does no one use ssh-agent?

I assume it's referring to a password login, not an SSH key login.

Re: Tmux Tutorial

#43

I used PM2[1] as process manager for Node.js, Python services in the cloud servers. It did its job well, apart from ensuring that process is always up, it provided monitoring capabilities(incl. emails), capturing logs from the stdout among other things. Recently I wanted to manage a Golang service, found that PM2 is not stable for it yet and I didn't want to install Node.js just for managing the Golang service; so us…

Tmux won't restart the service when it fails. It won't start the service when the machine reboots (or even if someone deliberately reboots the machine and forgets about the service).

Assuming you're on a modern Linux distribution, it's pretty easy creating a systemd service file which will make it easier to manage the service.

Re: Tmux Tutorial

#44

If you're on a Mac, try tmux -CC with iTerm2. You get tmux goodness like multiple panes, persistent sessions, etc. But you also get native scrolling, native copy and paste, etc. It's what makes tmux usable for me.

tmux -CC really is great on mac, but if it worked with mosh it would be incredible.

EternalTerminal works great as a mosh alternative and fully supports tmux -CC

Alternatively, there's apparently a forked version of mosh out there with iterm2 support hacked in, but I've not tried it.

Re: Tmux Tutorial

#45
I use tmux in conjunction with tmuxp and highly recommend the pairing (or alternately use tmuxinator). a bash shortcut I use every day to attach/create/restore dozens of sessions is.

  pc:bt2$ cat ~/bin/t
  #!/bin/bash
  if [[ $# == 0 ]]; then
      echo tmux list-sessions
      echo
      tmux list-sessions
      echo
      echo tmuxp sessions
      echo
      ls ~/.tmuxp

  else
      tmuxp load $1 || tmux attach -t $1 || tmux new-session -s $1
  fi
usage "t session_name"

Re: Tmux Tutorial

#46
I love tmux and use it extensively in my workflow. One thing that I found very useful was binding "synchronize panes" to ctrl+b+e combination, this allows me to quickly modify the configurations.

tmuxp is also a great tool for creating predefined layouts. Personally I store a config for every client and by typing "tmuxp load client_config" my session is immediatelly available and I can get productive within seconds.

Re: Tmux Tutorial

#48
We use tmux for remote peer programming in a pinch.

If Alice has a session on a remote machine you have access to. You can run `tmux new-session -s bob -t Alice`

With this both share he same view but can move cursors independently.

Re: Tmux Tutorial

#49
post #2

I have been using screen for almost 10 years now, is it worth switching? I know it's not much learning but why switching when screen is not broken? It feels like there's more important stuff I can learn.

> I have been using screen for almost 10 years now, is it worth switching?

I've been happy with the switch. I was a long-time `screen` user, too, and something that helped me a lot with the switch to tmux was adding a few lines to my ~/.tmux.conf to change the command prefix from ^b to ^a, like screen. It made the muscle-memory shortcuts I'd used for so long still basically work.

  unbind C-b
  set -g prefix C-a
  bind-key a send-prefix
Hope that helps, and good luck!

Re: Tmux Tutorial

#50
Looks like some of the shortcuts are really RSI prone, i.e. ctrl + b + & (where & is shift + 7). Are there any possibilities to have more wrist-friendly shortcuts?
Post reply on HN