Kenny Woo

finding new ways to procrastinate.

github twitter linkedin email rss
Running Processes using GNU Screen
Jan 2, 2014
One minute read

Running a process (especially remotely) that takes too long? Here’s a neat trick using GNU Screen to solve that problem:

screen -dmS [NAME] sh -c '[CMD]; exec bash'


  • -dm : detached mode
  • -S [NAME] : name of session
  • sh -c “ : runs shell command with string arguments
  • exec bash : runs bash in order to keep session active after completion of [CMD]

Now you can check the list of active screen sessions:

screen -ls

Reattach to your desired screen session to check its progress:

screen -r [NAME]

And finally, if you need to detach again just hit <ctrl-a>; d.

Back to posts