Have you ever wondered how you can do pair programming with your friends using some simple tools?
To achieve this, you only need two things: ssh and tmux.
I’ve already explained about ssh in my other articles, you can go and check them out to get some basic understanding.
If you haven’t installed tmux, you can do so by typing the following command (Works for Debian based systems):
sudo apt install tmux
On the remote server, start a new tmux session. You can do this by running:
tmux
This creates a new tmux session with a single terminal window.
Inside tmux, you can create additional terminal windows as needed. You can do this by pressing Ctrl+b
, then typing c
:
Ctrl+b c
This command creates a new window.
To switch between different tmux windows, you can use Ctrl+b
followed by a number. For example, Ctrl+b 0
will switch to the first window, Ctrl+b 1
to the second, and so on.
On Your Local Machine, Connect to the remote server using SSH, just as you normally would
ssh username@remote_server_ip
Now, attach to the Tmux session.
To join the tmux session that is running on the remote server, use the tmux attach-session
command followed by the -t
option and the session name (usually 0
for the first session, unless it’s renamed):
tmux attach-session -t 0
You should now be sharing the same terminal session with your teammate on the remote server.
Follow me on other social media