Start SSH connection in PuTTY, run a command, and leave the session active

后端 未结 2 1697
轮回少年
轮回少年 2020-12-19 12:27

I want to run a few shell commands every time I SSH to a server via PuTTY. I\'m connecting to a production web server managed by someone else, and I don\'t want to store my

2条回答
  •  生来不讨喜
    2020-12-19 13:26

    One option to go is set up your putty remote command like this:

    ls > dir.ls & /bin/bash
    

    In this example command you want to run is "ls > dir.ls" what creates file dir.ls with content of directory listing.

    And as you want to leave shell open you can add aditional command "/bin/bash" or any other shell of your choice.

提交回复
热议问题