title: Opening remote terminal programmatically in eclipse terminals view and execute shell commands programmatically in it
body: <p>Using the below code to execute shell commands in remote shell and can able to read the command outputs:</p>
  
  
  
  <pre><code>    IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
          IStructuredSelection sel = (IStructuredSelection)window.getSelectionService().getSelection();
          RemoteProcessImpl ele = (RemoteProcessImpl)sel.getFirstElement();
          IHost conn = ele.getSystemConnection();
          IRemoteCmdSubSystem cmdSS = RemoteCommandHelpers.getCmdSubSystem(conn);
          Object[] obs = null;
          RemoteOutput fe = null;
          try {
              cmdSS.checkIsConnected(null);
          } catch (SystemMessageException e2) {
              e2.printStackTrace();
          }
          try {
              cmdSS.initializeSubSystem(null);
          } catch (SystemMessageException e1) {
              e1.printStackTrace();
          }
          RemoteCommandShell shell = null;
          try {
              shell = (RemoteCommandShell)cmdSS.getDefaultShell();
          } catch (Exception e) {
              e.printStackTrace();
          }
          shell.removeOutput();
          cmdSS.sendCommandToShell("ls -l", shell, null);
          Thread.sleep(1000);
          obs = new Object[shell.getRoots().length];
          obs = shell.getRoots();
          for (int i = 0; i &lt; obs.length; i++) {
              fe = (RemoteOutput)obs[i];
              String op1 = fe.getText();
              System.out.println(op1);
          }
          command.setLength(0);
  </code></pre>
  
  <p>But how I do the same thing in remote terminal which opens up in <strong>Terminals</strong> view?</p>
  
  <p>Also posted the same question in <a href="https://www.eclipse.org/forums/index.php?t=msg&amp;th=1079876&amp;goto=1739730&amp;#msg_1739730" rel="nofollow">eclipse forum</a> but no response.</p>