Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm using cygwin. and use it with ssh to login into a ubuntu server. sometimes, I want to switch back to my cygwin and then quickly switch to ubuntu shell. How to do this?

share|improve this question
add comment

2 Answers 2

up vote 20 down vote accepted

You can background the ssh client just like any other shell job by sending it a signal and returning to the parent shell. Since the ssh client traps most key strokes, it would grab the normal shell job control keystrokes, but you can get its attention and get through to the shell using an escape sequence. For most ssh-clients this involves sending a ~ that has been directly preceded by a newline. The following sequence should do the job:

Enter ~ Ctrl+Z

After it is suspended you can continue using the local shell. When you want to go back to the suspended job, just run the fg command.

For further reading, look up Bash Job Control.

share|improve this answer
3  
Nice; beat me to it. For more further reading, run man ssh and search for "Escape Characters", or type ~? in an ssh session. –  Jander Oct 14 '11 at 14:22
add comment

@Caleb's answer is good, but you could also consider installing a terminal multiplexer like screen or tmux. Apparently (according to what I can find on the web) tmux has had some problems with running on Cygwin in the past, but I don't know about the current status of it.

share|improve this answer
1  
Both tmux and screen can certainly be used to solve the problem the OP is facing, but getting started with a multiplexer is quite pile of stuff to get your head around the first time. Perhaps you could expand this answer to an exact set of commands for tmux that would get a newcomer through the process of opening a terminal, ssh'ing, detatching back to the main shell, then attaching again... –  Caleb Oct 19 '11 at 6:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.