Login to Remote Linux machine and chRoot preserving all Terminal Windows

0

Everyday I connect to a remote machine (RedHat) from my macbook (Lion). I use Terminal to connect to remote machine and then to chroot. Then I open 2-3 windows on Terminal for various files.

Is there any shortcut to preserve the windows with open files and connection?

I tried "Save Windows as Group" on Macbook terminal but it does not work.

Update:

I want to see all open files visible in various terminal instead of it going into background!

Satya Prakash

Posted 2012-05-03T14:09:02.473

Reputation: 101

Answers

1

Yes, you want to use a terminal multiplexer such as screen or tmux on the remote RedHat host.

You can launch multiple virtual terminals inside a screen or tmux session. when you detach from the session, your virtual terminals continue to persist. This enables you to continue to run jobs that you want to monitor, continue editing files, keep a man page open. You can later reattach to the session and continue to work.

There is a lot of good documentation about both programs (and opinion about which is better). These tmux and screen wikis are specific to ArchLinux, but are good starting points.

George M

Posted 2012-05-03T14:09:02.473

Reputation: 632

Ok, I will give it a try. Earlier I tried to use screen from the connecting server that did not work correctly. and Open files used to go into background. I want to see all open files visible. – Satya Prakash – 2012-05-05T10:03:21.400

Will all open files will be visited at the same time or only one will be visible and other will be open in Background! – Satya Prakash – 2012-05-05T10:04:00.337

0

It sounds like you are asking for several things: 1) You want to reopen Terminal windows in the same position on your screen 2) You want the Terminal windows to connect to specified servers 3) You want an uninterrupted connection to the server: so you can pick up where you left off.

I'm at a Windows machine right now, but I believe Terminal.app only does #1. You can achieve #1 and #2 through AppleScript (or appscript) scripts: search and ye shall find. But #3 would require the use of either screen or tmux (or possibly dtach, but I've never used that). screen is more widely available, but I would recommend tmux slightly above screen. They work very similarly, though, so either should more than meet your needs.

You'd run screen (or tmux) on the server that you connect to, and detach from your screen session when you're done for the day. screen would still be running on the server, keeping your shell session alive, and preserving its state for the next time you log in. The next day you'd log in and reattach to the screen session, and be good to go.

iconoclast

Posted 2012-05-03T14:09:02.473

Reputation: 2 752

If #1 is about the position of Terminal window on screen then that is not a big issue. I want #2 and #3. I tried screen earlier but I think I have not used it correctly. I started screen from MacBook terminal. But you said to use screen on the connecting server. Then I saw each open files goes into background there which I don't like. I want to see 2-3 file open at a time. – Satya Prakash – 2012-05-05T09:59:52.917

I may give a screen and tmux a try again. If you have simple usage document for my case then please point me to there. Thanks! – Satya Prakash – 2012-05-05T10:00:34.680