Apollo Connecting the World

Diligence and Intelligence

Archive for the ‘terminal’ Category

Maintain the Program Running on the Remote Machine while Network Is Not Persistent

leave a comment »

Let’s take this scenario:

You ssh to a remote machine and work (eg. run programs). When a network error occurs that you lost connection to the remote machine, your work will be interrupted in half way, and even worse, your work will be lost without being stored. What you have to do is ssh to that machine again and do the work again. So the following question rises:

How to preserve my work in remote machine while connection failure is possible?

The solution is simple. Use a program “screen” in the remote machine.

When ssh to remote machine, before you want to run any programs or do other work, you first type “screen” to open a screen. The function of the screen is that, it provide you with a new terminal, in which you can do you work as usual in a ordinal terminal, however, the work in screen is safe if you lost connection to the remote. If you ssh again, and use screen to the previous job, you will see your work is preserved. You can continue your work easily.

Some cmd for screen:

1. detach (temporarily go out of the screen): Ctrl+a, d

2. see the detached screens: screen -list (or: screen -ls). You will get all the screens, in a form of [pid.tty.host]

3. re-attach to the screen: screen -r tty (or: screen -r pid.tty.host)

Reference:
1. http://www.ibm.com/developerworks/cn/linux/l-cn-screen/

Written by apollozhao

2010/04/30 at 12:38

Multi-terminal in one window

leave a comment »

It is not convenient to run several terminals at the same time – difficult when there are a lot of other windows. There is one tool called “Terminator” that could display multi-terminal in just one window.

To install the software, simply input the command below:
yum install terminator

You can find it in “Applications->Accessories->Terminator”. Or just press “Alt+F2” and type “terminator” to run it.

The settings of Terminator are very simple. Now you can split the window and enjoy your work!

Written by apollozhao

2010/01/14 at 12:35