I have a bot running in a terminal window on my Pi and would like to close that window through SSH (to kill the process and make adjustments to the bot).

Afterwards, I'd like to restart the bot but have it open in a terminal window again, so when I'm using the GUI I can see the bot running/the log in the terminal.

  • 1
    Your question is confusing to me. A bot is running on your Pi. You want it to open a terminal window so that you can log it? Why can't you put logging statements in the bot itself?
    – NomadMaker
    Commented Aug 17, 2018 at 17:14
  • This question seems more like a general GNU/Linux question. Do any of these questions help? Commented Aug 17, 2018 at 18:09
  • if you are logging to a file. Then tail that file in a window on the GUI, even if you stop and restart the program, the tail will still be running and will show you current logs
    – Chad G
    Commented Aug 17, 2018 at 18:36
  • you have not asked a question
    – jsotola
    Commented Aug 18, 2018 at 4:04

1 Answer 1


I'm not sure if I understand your question right. But there is a program that may help you to achieve what you want. You can ssh into the pi and in the terminal you start screen. It looks like a normal terminal but you can do some interesting things with it. You control it <ctrl>A. For example <ctrl>A+? gives you help. For this issue the most important command is <ctrl>A+d that means detach. Now you can start your bot in the screen window and look at its output. Then detach from screen with <ctrl>A+d and you are back on your ssh terminal. The bot on the screen is running in the background. You can logout from ssh and later connect again and reattach to screen with screen -r. Then you see your bot running with all its output it has done over the time. Try screen if it can help you. Look at man screen.

  • AWESOME - that helped a lot! I have the session open and attached on my desktop and can easily join it through screen -x session_name. Now the only thing I'm wondering is, when I kill a screen to make adjustments and afterwards restart it, how can I have a new terminal window open on the desktop and attach the new screen? I tried to write a script, but that was rather unsuccessful.
    – user90820
    Commented Aug 18, 2018 at 16:48
  • @user90820 Glad that I could help you :-) May it be possible that you upvote and/or accept my answer? It is the way this site works. But with your comment I'm still confused what you want to achieve. I have shown you a possibility to "Open/Close Terminal Window Through SSH". Your bot is running on a RPi in a terminal window. But what's about the GUI? What GUI? And now you are talking about a desktop. What's with it? Please can you edit your question and ask what you like to do? Maybe a sentence with a question mark?
    – Ingo
    Commented Aug 18, 2018 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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