Welcome guest, is this your first visit? Click the "Create Account" button now to join.
Results 1 to 1 of 1

Thread: Screen command in linux

  
Bookmark and Share
  1. #1

    Post Screen command in linux

    I have wrote about screen command long back. But I'm writing it again because last few days I was fighting with network connectivity issues. screen is your best friend when you have a bad connection.

    Why screen?
    Suppose you are running a bash script. What if you lost connection in between? script fails.

    How to use?
    You can create a screen and run the script inside the screen. You can detach and attach to the screen later whenever you want. Even if the connection fails between your remote server and laptop; the script will execute safe inside screen.


    In this post we will see how to use screen in Redhat / Centos Linux.

    Installation:
    Code:
    #yum install screen
    Code:
    #screen
    Then execute the command you want

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

    To list the screen sessions
    Code:
    #screen -ls
    [
    Code:
    root@server ~]# screen
    [detached]
    [root@server ~]# screen -ls
    There is a screen on:
            3063.pts-0.server       (Detached)        #Lists the existing screen session ids.
    [root@server ~]#
    To attach a screen again
    Code:
    # screen -r screen_id
    [root@server ~]# screen -r 3063.pts-0.server
    To name a screen while creating
    Code:
    # screen -S name_of_screen
    To wipe off a dead screen
    Code:
    #screen -wipe screen_id
    If you have only one screen. You can attach it by executing
    Code:
    #screen -x
    If you want to attach to a already attached screen
    Code:
    #screen -D -r screen_id
    Last edited by kuldeep; 02-21-2015 at 03:30 AM.

  2. # ADS
    Circuit advertisement
    Join Date
    Always
    Posts
    Many
     

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •