screen command on nix systems

screen is a tool for running a job on a nix server and keep it running even after you have logged out from the server.

1. Create a screen and give it a name myjob
[code language=”shell”]
screen -S myjob
[/code]

2. After you have typed the above command, it will bring you to the screen window you just created with the name myjob. Now you can start a long running program on the screen. Let’s you are running a script on your current directory.
[code language=”shell”]
./myjob.sh
[/code]

3. After you have started your long running program, you can exit the screen by detach command by press
[code language=”shell”]
Ctrl-a d
[/code]

4. Now you are back to your normal command line window. You can see a list of screens that are running by this command.
[code language=”shell”]
screen -ls
[/code]

5. The above command will give you something like this
[code language=”shell”]
13148.myjob (Detached)
16763.myjob2 (Detached)
11796.myjob3 (Detached)
[/code]

6. To go back to the screen myjob, type the command
[code language=”shell”]
screen -r 13148.myjob
[/code]

7. To kill/quit the screen myjob
[code language=”shell”]
screen -X -S 13148.myjob quit
[/code]

Search within Codexpedia

Custom Search

Search the entire web

Custom Search