2

There's a bunch of proprietary software installed on our university linux computers, which is accessible through remote control via Putty.

When I'm using my own Linux box, if I want to retain control over the terminal after launching a program, I just use 'matlab $' etc. But for some reason, this doesn't work in Putty, which is pretty annoying since we need access to Matlab, emacs and AMPL all at the same time. 'matlab $' in the Putty terminal simply opens Matlab and leaves my one terminal unavailable.

Any ideas on what's going on here?

1
  • Are you really typing matlab $ and not matlab &? On Linux, does this launch Matlab in a separate window? Feb 25, 2014 at 23:41

2 Answers 2

2

I think you are trying to run a process in the background, if this is the case then & is the character you put at the end of the line to indicate "run in background" and you will get your terminal prompt back. However the background task will still have access to your terminal for output unless you redirect that as well.

If you want to run multiple foreground tasks at the same time, then there are some terminal programs that allow you to start multiple terminals on the same screen, they multiplex a physical terminal between several processes, terminator is one I've used, but there are many. tmux screen

Research those programs and see which one works for your situation. man screen for example.

1

It sounds like you want to run GUI programs. When you start Emacs, if a GUI environment is available, it opens a GUI window; otherwise, it runs in the terminal. I don't know about Matlab but I suspect that the same thing happens. Your question is confusing: matlab $ is invalid shell syntax, but I suspect that you're running matlab &. When you put & after a command line, the command runs in the background. This is fine for a GUI application, but can't be done for a text mode application: it'll need to go back to the foreground as soon as it wants to access the terminal.

If you want to run Emacs, Matlab or other commands in text mode in a PuTTY window and switch between them, run Screen or Tmux in the remote shell launched by PuTTY. Screen and Tmux are terminal multiplexer applications: they provide multiple windows where you can run separate applications, and let you switch between the windows. So for example, to run Matlab, open a new window and run matlab (without & since Matlab will be in the foreground of that window). Screen or Tmux have the benefit that if the SSH connection is closed due to a network glitch, the terminal session remains active and you can restart PuTTY and reconnect to the existing session.

If you want to run Matlab (or any other application) in GUI mode, you need X11 forwarding. The Linux GUI is based on the X Window System (X11), which have a communication protocol between applications and the display server that can be forwarded over the network. You'll need an X11 server on the Windows machine for that. As part of my Windows survival kit, I use Xming; download and install the free version. Run Xming (put it in your Windows session startup if you like). In the PuTTY configuration, under “Connection → SSH → X11”, make sure to enable X11 forwarding and set the “X display location” to localhost:0 (see e.g. this tutorial). After this, when you connect with PuTTY, you'll be able to run remote GUI applications.

For Emacs, I recommend running it locally and editing remote files. Install EmacsW32, which has slightly improved Windows support from the official sources. Emacs can open remote files pretty much transparently through Tramp — just type /remotehostname:path/to/file to open a file under your home directory or /remotehostname:/path/to/file to type an absolute path. Set up Tramp to use the plinkx method and point Emacs to the plink executable from PuTTY.

You must log in to answer this question.

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