iOS, Blink Shell, Mosh and tmux

https://youtu.be/M0axVFIemQ86

Over the years as a developer I’d heard about tmux a number of times, but when someone said it was a terminal multiplexer my eyes would glaze over and I’d move on to a more immediate problem that needed solving in my development workflow. Then as I moved to the iPad as my main machine I found that while Blink shell and Mosh are great, I’d still drop connections in different Blink sessions.

While it started as a minor frustration, after a few times of dropping all my work and needed to login with 3 different windows in Blink, I was getting annoyed.

I was also getting ready to solve a bigger problem with my iOS web development workflow, moving lots of files around from client sites to my staging environments. Few of my clients have their sites in any version control when I start with them. That means I have to use FTP to grab all their files and then push them to my dev server before I get it in Git and then in a deployment process with Deploybot.

This was one of the last vestiges of macOS in my workflow.

Turns out that tmux is my answer all around. With tmux I can connect to my remote server, issue an SFTP command then disconnect and it will keep running in the background. tmux is also the answer to my disconnection woes when I’m coding for clients from my iPad.

Watch the video to see exactly how I use tmux day to day. Check out the list below for the tmux commands that I use day in day out.

Useful tmux commands

As with most things, there are a very few commands that you need to know to make tmux useful. If you want a full list of tmux commands, look here. Once you’ve started tmux every command starts with CTRL + B as a signifier to your terminal that you’re about to do a tmux command.

  • CTRL + B C (new window)
  • CTRL + B $ (name your session)
  • CTRL + B , (renames a window)
  • CTRL + B D (detach from your session)

The other two commands I use regularly are to list the sessions I have and then to connect to a named session. These don’t start with CTRL + B because you haven’t started tmux yet.

  • tmux ls (list sessions)
  • tmux a -t $name (connect to a named session)