screen command

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

screen1

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

screen0.png

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.

screen2.png

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s