Install the screen package
yum install screen -y
apt-get install screen -y

mohammedrafi@NOC-RAFI:~$ tty
/dev/pts/0

screen -S session-name will create a new session on terminal with that name
mohammedrafi@NOC-RAFI:~$ screen -S session1
Open another terminal and search with command screen -ls to list sessions’s
mohammedrafi@NOC-RAFI:~$ tty
/dev/pts/5
mohammedrafi@NOC-RAFI:~$ screen -ls
There is a screen on:
29071.session1 (Monday 10 July 2017 07:18:10 IST) (Attached)
1 Socket in /var/run/screen/S-mohammedrafi.

Use -x command with screen and appropriate session id to get session which is another terminal which is having same tty
mohammedrafi@NOC-RAFI:~$ screen -x 29071.session1
mohammedrafi@NOC-RAFI:~$ exit
[screen is terminating]
few more screen options
screen -ls list available screen
screen -S
screen -x
screen -r reattach screen
screen -R reattach screen,create new one if possible
screen -s specific shell for the screen
screen -t create a window with name
screen -t Shell /bin/bash
screen -t Python /usr/bin/python3ve
screen -t PHP
/usr/bin/php -a # Interactive mode.
check man pages for more info
mohammedrafi@NOC-RAFI:~$ man screen
