Start a long-running program over SSH [closed]

I have a Virtual Machine that is running Ubuntu, and I can SSH into the Virtual Machine just fine. I can even start my python program over SSH using the following:

python foldername/app.py

I am on a Windows machine, using Git Bash to SSH. If I start my python program this, way I have to leave the Git Bash window open. How can I start the python program without having to leave the Git Bash open on my Windows machine? Any help is much appreciated!


you can use nohup:

nohup python foldername/app.py &

now you can close your connection and the program will keep running. You can find more information here and here.


Another option would be to use a virtual terminal, e.g:

    <li>screen</li> <li>tmux</li> </ul>

    Both of them should be available via the ubuntu package manager.

    Then (after logging in via ssh) issue the following commands:

      <li>screen</li> <li>python myprog.py</li> <li>CTRL+A D</li> </ul>

      or for tmux

        <li>tmux</li> <li>python myprog.py</li> <li>CTRL+B D</li> </ul>

        Then you can close your ssh connection and look at the output when you return later by typing screen attach or tmux attach

        I'd personally recommend using tmux.


        Two main approaches come to my mind, depending on what you are up to:

        <ol> <li>

        Make the program run as a daemon (a program that runs in the background, not connected to any terminal); if appropriate (and logistically feasible), configure the system-wide init system to start it.

        </li> <li>

        Alternatively, just run the program under a terminal multiplexer program (like GNU screen) that implements a persistent virtual terminal that you can attach to/detach from as needed.

        </li> </ol>


  • PHP Exec: Without Waiting, Without Discarding the Output, Without nohup
  • Running a script from a script in android
  • Running a script from a script in android
  • Running K Kestrel in the background
  • Python 3.2.2, error(scripts to exe)
  • Detecting null parameter in preprocessor macro
  • Azure webjobs output logs indexing taking very long
  • ThreadStatic in asynchronous ASP.NET Web API
  • pillow imaging ImportError
  • Check for zero lines output from command over SSH
  • nonblocking BIO_do_connect blocked when there is no internet connected
  • Django simple Captcha “No module named fields” error
  • How do I access an unhandled exception in an MVC Error view?
  • Custom Tabgroup Appcelerator
  • How to know when stdin is empty if it contains EOF?
  • MailKit: The IMAP server replied to the 'EXAMINE' command with a 'BAD' response
  • Google Custom Search with transparent background
  • PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse
  • Projection media query: browser support and workarounds?
  • Different response to non-authenticated users and AJAX calls
  • Optimizing database types to compact database (SQLite)
  • TFS: Get latest causes slow project reloading
  • DirectX11 ClearRenderTargetViewback with transparent buffer?
  • Running a C# exe file
  • Perl system calls when running as another user using sudo
  • vba code to select only visible cells in specific column except heading
  • Display Images one by one with next and previous functionality
  • Why is the timeout on a windows udp receive socket always 500ms longer than set by SO_RCVTIMEO?
  • Web-crawler for facebook in python
  • Rearranging Cells in UITableView Bug & Saving Changes
  • Circular dependency while pushing http interceptor
  • Linker errors when using intrinsic function via function pointer
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • How can I remove ASP.NET Designer.cs files?
  • python draw pie shapes with colour filled
  • Is there any way to bind data to data.frame by some index?
  • Reading document lines to the user (python)
  • How can i traverse a binary tree from right to left in java?
  • To Get the radio button value in ruby on rails