3

Say I start a process from the local shell - keyboard, mouse, monitor connected directly to actual physical computer...

I then go to a second computer and SSH into the first computer.

Can I switch to the local shell that's running the process on the first computer?

Specifically I'm using putty to connect to Ubuntu Server 16.04. I want to see the local shell and interact with it. On Windows when I Remote Desktop and log in as the user it picks up that connection/session... I'm just not sure how to do it on linux so that I can monitor/continue/break/interact-with a running process remotely.

5
  • 6
    You may want to check out what screen can do for you. Open terminal, start screen. Do stuff. Disconnect from screen. Log out. Log in from elsewhere, reconnect to your screen process, and everything is still there and running and doing whatever it was doing when you left it.
    – ivanivan
    Commented Feb 23, 2017 at 4:02
  • VNC server/client will match what rdp does in windows. For all other remoting posibilities that windows do not have, your question needs to be more specific. and no ssh can not just take over keyboard and monitor of other computer.
    – MetNP
    Commented Feb 23, 2017 at 6:17
  • I've used RealVNC/TightVNC on windows and hadn't considered looking into the same/similar for Linux... but that's basically what I'm looking for. I'll also look into Screen as that also looks like a solid option for what I'm after.
    – WernerCD
    Commented Feb 23, 2017 at 16:36
  • vnc works well in linux if you need gui, but screen and tmux are much better and faster and more powerfull solutions that will work anywhere and inside ssh (if you just forget mouse and graphics).
    – MetNP
    Commented Feb 23, 2017 at 17:33
  • 1
    Use a terminal multiplexer as login shell => screen.
    – ingopingo
    Commented Feb 23, 2017 at 18:20

1 Answer 1

1

You can background the ssh session using ~^Z (saying Enter ~ Ctrl+Z) escape sequence (after the newline).

This will simply background your ssh job and you can restore the session by writing %1 (brings job back to foreground -- use different number if you suspended more jobs already). Example:

[local]$ ssh remote
jakuje@remote:~$ ~^Z [suspend ssh]

[1]+  Stopped                 ssh remote
[local]$ %1
ssh remote

remote:~$

For more about escape sequences that can be useful during the ssh session, have a look into manual page for ssh.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .