Get more productive with SSH using tmux

Please share if you found it helpful!

I’m sure all of us who’ve used SSH to manage a server have faced these issues at some point:

  1. Process that’s running gets killed if the internet gets disconnected
  2. Multi-tasking on the server (like reading log files and debugging some code at the same time) is a pain
  3. No way to save and retrieve work.

Enter tmux. Tmux is a terminal multiplexer. What’s that? In simple words, it lets you have multiple tabs open on a server. You can move around tabs, long running processes don’t get killed and what’s more, you can pick up just where you left off the last time.

Tmux is very memory efficient and it will run as long as the server doesn’t reboot. Tmux is also useful for pair programming, debugging something with your buddy, etc. Multiple people can join the same tmux and see what’s happening in the server.

I am very fond of tmux and use it on all the servers that I manage. In fact, it’s the first thing I configure on any server.

tmux session

Tmux is very useful when you have to manage remote servers

Tmux is also very configurable and so you can change it the way you want it. If you spend a lot of time on SSH managing servers, I would recommend you to go ahead and spend time learning tmux and how to use it. You can thank me later! 🙂

Here’s my tmux.conf: https://github.com/ckailash/dotfiles/blob/master/.tmux.conf

It comes with these shortcuts:

Create new window: alt + n
Move between windows: shift + left arrow (to move left) or shift + right arrow (to move right)
Kill a window: ctrl + d
Rename a window: alt + r
Move a window: shift + up arrow (to move right) or shift + down arrow (to move left)
Detach from tmux: ctrl + b (press and let go) then d

I also add some aliases to my .bashrc so it’s easy to deal with tmux

Once you’ve added the above to the .bashrc file and sourced it, you can use tmux really well

Opening a new tmux session: tm
Listing all the tmux sessions: tl
Joining an existing tmux session: ta

Hope this helps!

Like what you just read? Subscribe To Receive tips and tricks about:

Like what you just read? Subscribe To Receive tips and tricks about:

1. Linux

2. Web development

3. Developer life hacks

4. Web security

5. Entrepreneurship

Thanks for subscribing, hopefully I will make your life better by sharing all the tips and tricks that make my life easier.

Leave a Reply

Your email address will not be published. Required fields are marked *