How to Share Your Linux Terminal With Other Users?

As someone who often collaborates with other users and provides remote support, we know how important it is to have efficient ways of sharing a terminal or screen with others.

Sharing your Linux terminal with other users can come in handy in several situations. For example, if you're working with a team of developers, sharing your terminal allows everyone to see and work on the same codebase simultaneously, regardless of their physical location. Similarly, if you need to provide remote support, sharing your terminal allows you to see the user's system and fix issues quickly and easily.

Remote support is another scenario where sharing your terminal can be extremely helpful. As an IT professional, you may need to troubleshoot issues for users who are not physically present. By sharing your terminal with them, you can see exactly what's happening on their system and provide the necessary support quickly and effectively.

In this article, we will explore three different methods for sharing your Linux terminal with other users using SSH, Screen, and Tmux.

Method 1: Using SSH

SSH (Secure Shell) is a highly secure protocol that enables us to access and manage a computer over the network remotely. Its popularity lies in its speed, reliability, and most importantly, its security features. With SSH, we have the freedom to access not only the remote machine's terminal but also share our local terminal with others.

Step 1: Find Your Machine's IP Address

ip addr

By executing this command, the output may look like this

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:11:22:33:44:55 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.100/24 brd 192.168.1.255 scope global eth0
       valid_lft forever preferred_lft forever

The output shows two network interfaces: lo (loopback interface) and eth0 (Ethernet interface). Note the IP address 192.168.1.100 for the eth0 interface.

Step 2: Share Your Terminal

ssh -X username@your_ip_address

Replace username with the actual username and your_ip_address with your machine's IP address. The -X option enables X11 forwarding for graphical applications.

username@192.168.1.100's password:
Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.4.0-91-generic x86_64)

Last login: Wed Feb 23 14:55:36 2023 from 192.168.1.2
username@hostname:~$

Method 2: Using Screen

Screen is a terminal multiplexer that allows us to create multiple terminal sessions within a single terminal window. With the screen command, we can create a shared terminal session that multiple users can connect to simultaneously.

Step 1: Start a New Screen Session

screen

This creates a new screen session. You'll see a welcome message with basic instructions.

Step 2: List Active Sessions

screen -ls
There is a screen on:
    2876.pts-0.hostname    (Detached)
1 Socket in /var/run/screen/S-username.

In this example, the session ID is 2876.

Step 3: Share Your Screen Session

screen -x [session_ID]

For example

screen -x 2876

Other users can now connect to the same session using the session ID. The screen -x command allows multiple users to attach to the same session simultaneously.

Screen Key Commands

Command Action
Ctrl-A + C Create new window
Ctrl-A + N Switch to next window
Ctrl-A + P Switch to previous window
Ctrl-A + D Detach from session

Method 3: Using Tmux

Tmux is a modern terminal multiplexer that serves as an alternative to Screen. It offers additional features like window splitting, customizable interfaces, and better session management.

Step 1: Install Tmux

sudo apt-get install tmux
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  libevent-2.1-7 libutempter0 tmux
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Do you want to continue? [Y/n] y
Setting up tmux (2.6-3) ...

Step 2: Start a New Tmux Session

tmux new-session -s shared_session

This creates a new named session called shared_session.

Step 3: Share the Session

Other users can attach to the same session using

tmux attach-session -t shared_session

Tmux Key Commands

Command Action
Ctrl-B + C Create new window
Ctrl-B + N Switch to next window
Ctrl-B + P Switch to previous window
Ctrl-B + D Detach from session
Ctrl-B + % Split window vertically
Ctrl-B + " Split window horizontally

Comparison of Methods

Method Best For Key Features Security
SSH Remote access Encrypted connections, X11 forwarding High
Screen Local sharing Session persistence, multi-user support Local only
Tmux Advanced sharing Window splitting, better interface Local only

Conclusion

Sharing your Linux terminal with other users is essential for collaboration and remote support. SSH provides secure remote access with encrypted connections, Screen enables multi-user session sharing with persistence, and Tmux offers advanced features like window splitting and better session management. Each method serves different use cases, making them valuable tools for developers and IT professionals who need to collaborate effectively or provide remote assistance.

Updated on: 2026-03-17T09:01:39+05:30

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements