Run a Program in the Background with nohup on Ubuntu Gnome 15.04

This is post is how to run a program from the terminal in the background so that it will continue to run even when the terminal window is closed. I use the nohup command to accomplish this. I have a server that I log into with ssh. I run a rysnc backup command to that copies data to a usb3, 2 GB external hard drive.  This can take several hours to complete. Sometimes I need to close my ssh session, for example to reboot my client computer, yet I don’t want the backup to stop. I am running linux, Ubuntu Gnome 15.04 and all commands are run from the terminal.

Example of no hup command

nohup nice -n20 > /dev/null 2>&1 &

I will break down what is happening.

nohup – prevents the commands following from stopping if the terminal window is closed

nice -n20 – runs the program at a lower priority for cpu resources to prevent other programs on the computer from slowing down – the python backup program to execute

> /dev/null 2>&1 – This does not show error messages and output, nohup normally writes standard output to a file nohup.txt. When my output was written to nohup.txt, the file size was 1.2 GB!

& – puts the command in the background so that you can use the terminal for other tasks

To see the status of your running application run the following command:


Output will be:

[1]+  Running   nohup nice -n20 &

A good reference for working with jobs:


Leave a Reply

Your email address will not be published. Required fields are marked *