06 May 2011

Screen : shell command for making daemon process in Linux

Those who like to use terminal in Linux, usually already know how to make a process into a daemon. Some of us usually using the characters '&' after the command. Anyway that way has as weaknesess.  The weaknesses of the daemon by using the character is the difficulty in monitoring the log process or see the current process. Sometime we must create a program to produce a log file. It will be simple if the program is mad by your self, but if not? You will get dificulties and takes long time.

For that I now prefer to use a screen, a small program that really helped me. The way is simple, just type "screen", you will move to shadow of the console and press the space bar. In the new console you can type various another Linux commands. So, how do I return to the old terminal. Quite simple as well, press Ctrl A and D. Remember Ctrl A and D at the same time. Do not only press Ctrl D alone because Ctrl + D means that you turn off the screen of the terminal. If we have exit the screen, we can see a list of screen that we created with the command bellow :


There are screens on:
     28694.pts-0.test (03/05/11 11:28:02) (detached)
     28479.pts-0.test (03/05/11 11:26:31) (detached)
     26057.pts-4.test (02/05/11 14:34:46) (detached)

If we want to return to the screen that we just created can we type the command bellow

screen-r numberscreen

screen-r 28694

so from now on you can make the process as much as possible with the "screen" command.

No comments:

Post a Comment