0

I am ssh'ing into my Raspberry Pi 3 (with latest Raspbian Stretch Lite, freshly installed, updated and upgraded) since today. Just learning things for now. I would like to have all things I do from my SSH window (using PuTTY for Windows and Termius for Mac) being echo'ed to my regular main Raspberry Pi 3 display, which is still connected to it. So if I disconnect my ssh session or switch the computer, I can still see all past commands and printed returns I did.

Thanks in advance!

  • the 'history' command will give you all the commands you have used, but you will have to redirect stdout to a log file to get all the output from the commands you issued – Chad G Feb 17 '18 at 0:20
  • How do I do the part you mentioned after the history command? – MeebusJaximus Feb 17 '18 at 7:07
0

You could use GNU screen or tmux to keep a persistent session on the console open while connecting over the net. Both the console and ssh will see the same thing.

https://www.tecmint.com/keep-remote-ssh-sessions-running-after-disconnection/

Teamviewer can also reach any VT, which are the terminals you get from CTRL-ALT-F keys

https://blog.teamviewer.com/remote-access-headless-linux/

  • Thanks for the reply! Does this works on a non GUI Raspbian Stretch ("Lite")? Btw I do not want to use teamviewer because of several reasons. So my question would be about GNU screen / tmux. By the way what are the downsides of keeping a "persistent session" open? I also would want to ssh into the RPi from my other Computer into aswell, so ssh would need to work with this echo'ing from at least 2 computers. Only 1 is connected at a time. – MeebusJaximus Feb 17 '18 at 1:40
  • I use screen al the time. It is designed for text screens. It does not work that way. There's always a virtual console. Basically you detach it from one consloe and attach to another one. If the connection drops the program keeps running in the backgroud. Here's an article on how to use screen: computerhope.com/unix/screen.htm – Kerem Ersoy Feb 17 '18 at 4:18
0

There might be a better solution that might give you an actual log file, but one thing you can try is VNC into an account on the pi and manipulate it's desktop from a remote computer, then while in there just open the terminal and do your terminal commands through the VNC and have the terminal window open. You might even be able to open a terminal shell via command line and echo >> the response to a log file on the pi. But running a bash >> tofile.log will not log the commands you want so maybe following the guidance of this previous post will yield positive results.

https://askubuntu.com/questions/393574/logging-of-commands-executed-in-bash

  • 1
    Sadly, as mentioned, I am bound to use the non GUI version of Stretch. Also a simple log file is not enough, I would like to have everything echo'ed directly to my RPi 3 display. Thanks anyway for the idea though! – MeebusJaximus Feb 16 '18 at 22:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.