Friday, April 1, 2011

What is the use of screen command in linux? How to use it?


What is the use of  screen command in linux? How to use it? The following post explains it.
Screen is a powerful tool useful for working in a remote environment. You can start a screen and execute the commands inside the screen. So even if the connection goes down between your system and remote system, you can later attach to the screen. The command will be working inside the screen.

#yum install screen

Then execute the command you want

To detatch screen
press "Ctrl+a"
then press "d"

To list the sceeen sessions
#sceen -ls

[root@server ~]# screen
[root@server ~]# screen -ls
There is a screen on:
        3063.pts-0.server       (Detached)        #Lists the existing sceen session ids.
1 Socket in /var/run/screen/S-root.
[root@server ~]#

To attach a screen again
# screen -r screen_id
[root@server ~]# screen -r 3063.pts-0.server

To name a screen while creating
# screen -S name_of_screen

To wipe off a dead screen
#screen -wipe screen_id

If you have only one screen. You can attach it by executing
#screen -x

No comments:

Post a Comment

Be nice. That's all.