I have Windows Subsystem for Linux and I would like to be able to keep some commands running even if my computer is sleeping. I have been told that one way is to work in a remote terminal. I have been told that screen does the work. But I was wondering wether Terminator was able to do it as well, as I know this tool better.

  • Just to be clear, the "commands to be kept running" are on a remote machine, not on your sleeping windows machine? screen and tmux are programs to be run on the remote machine, and are nothing to do with how you connect to the remote machine. – icarus Feb 20 '20 at 14:28
  • @icarus Yes ! Sorry for the misunderstanding, I am brand new to run remote machines – Revolucion for Monica Feb 20 '20 at 14:29

Use screen or tmux on the remote computer. I prefer tmux for the improved scripting abilities.

  1. Connect to the remote computer using whatever program you like that provides terminal emulation.
  2. run tmux or screen. This will start a new shell in a "session"
  3. In a tmux session if you want to send ctrl-b to a program then type it twice.
  4. In a screen session if you want to send ctrl-a to a program then type it twice.
  5. run your program in this new shell.
  6. "detach" the tmux or screen session. For tmux type ctrl-b d, for screen type ctrl-a d
  7. logout from the remote machine and put your local machine to sleep.
  8. Power up you local machine and connect to your remote machine again.
  9. attach to the session. For tmux run tmux -a, for screen run screen -r.
  10. detach and reattach as often as you want. eventually stop your long running program and exit the shell. This will end the tmux/screen session.

Both tmux and screen can do a lot more, but this will get you started.

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.