When you start a session on a Linux Server, and then you need to run a program or a process that is going to take a long time to finish, you will have to let your session open until that process finish.
This is because Linux Operating System, by default will end the process if you exit your session.
Now it is not secure to let your session open while you are not there, or maybe not possible to let it open if you are over a ssh connection, so you may want to use
nohup command to let the process running even when you exit your session.
nohup is a POSIX command to ignore the HUP (hangup) signal, enabling the command to keep running after the user who issues the command has logged out. The HUP (hangup) signal is by convention the way a terminal warns depending processes of logout.
nohup command is most often used to run commands in the background as daemons. Output that would normally go to the terminal goes to a file called nohup.out if it has not already been redirected. This command is very helpful when there is a need to run numerous batch jobs which are inter-dependent.
Here is an example of how the command nohup can be used in a Debian Linux machine.
nohup aptitude update &
Now you can leave the session and the update will continue until it finish.
you can also use this with nice to let the program running in a low scheduling priority.
nohup nice -n 4 aptitude update &
By default the output of the command will be redirected to $HOME/nohup.out, unless you redirect it to another file.
nohup nice -n 4 aptitude update > output.txt &
This time the output will be redirected to output.txt.
Be sure to add the & sign so the command is executed in background.