4

I'm trying to run a remote command on an SSH server via the Remote command field of the PuTTY Configuration dialog (Connection -> SSH) and every time I do the window closes before I've had a chance to read the output of that command.

Here's a screenshot:

http://www.snapfiles.com/screenfiles/putty2.gif

Any ideas?

1
  • why dont you login and run the command regularly? Nov 21, 2013 at 8:57

3 Answers 3

7

putty has a setting to do exactly what you want: http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter4.html#config-closeonexit

3

or add bash to the command :
ls -ltr ; bash

3
  • 3
    Why? How does it work?
    – peterh
    Apr 28, 2020 at 13:27
  • it will open a shell after all the commands you set and hence stay in input command line mode, and wont close the session Apr 29, 2020 at 16:03
  • To find out which shell you are currently using type this command: echo "$SHELL"
    – vanowm
    May 23, 2020 at 16:55
1

Simply add a read to your command, for example:

uptime && read

This will show the output of uptime and then waits for you to press the enter key.

1
  • That works great unless you're connecting to something like a switch or router or something that might not have read as a command.
    – neubert
    Nov 21, 2013 at 20:09

You must log in to answer this question.

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