Can not stop nohup process
I am trying to run a very complex statistical model that I expected to take a very long time, so I used nohup to run the process. However, I underestimated the length and it would take like 260+ days to complete so I want to cancel the process.
I attempted using ps aux |grep nohup to get the PID, I get the following output:
When I use kill -9 14224 I am told there is no process. So I used ps -ef | grep beast-2 as I do not remember the entire command I entered. Pulls up the following:
I use kill -9 144039 and check again but the process is still running underneath a new PID.
![]()
1 Answer 1
Your process 14224 is the grep nohup , as ps told you. So, when you get your prompt back, the grep ended and therefore, it is logical that kill reports that there is no such process.
You will not see s process called nohup in your ps output.
So, how to find the process to kill?
As I don’t have your beast-2 , I will demonstrate with nohup sleep 99 & .
which would give me
1492021 is again my grep , so not important here. 1491988 is my nohupped sleep . The parent PID is 1336776. So checking it gives me
That is a bash . You can go-up even further, , for example using pstree :
So, if you kill the parent, it will no longer spawn new beast-2 s. Here I would
which kills the console and the bash , but not the nohupped sleep:
The parent has now become 1 , which is the init process. If you kill the sleep now,
How to Use Linux nohup Command
SIGHUP (Signal Hang UP) is a signal that terminates a Linux process when its controlling terminal is closed. If you accidentally close a terminal or lose connection with the server, all processes running at the time are automatically terminated.
Using the nohup command is one way of blocking the SIGHUP signal and allowing processes to complete even after logging out from the terminal/shell.
In this article, you will learn how to use the nohup command while running processes.

nohup Syntax
The syntax for using the nohup command is:
nohup Options
The nohup command features two basic command options, the —help and the —version options.
To display the help message, run the command:

To display version information, type:

Note: Although nohup may appear similar to daemons, there is a significant difference. Daemons are reserved for processes that continuously run in the background, while nohup is used for processes that take a long time but don’t continue running once done.
nohup Examples
There are a number of ways to use the nohup command, including running the required process in the background, running multiple processes simultaneously, or redirecting the output to a different file.
The examples below explain common use cases for the nohup command.
1. Running a Process with nohup
To run a command using nohup without any arguments, simply follow the syntax:
The shell ignores the output and appends it to the nohup.out file.
For instance, running the example.sh bash script (which is a simple Hello World script) should prompt the Hello World message in the nohup.out file:
Verify the contents of the file with:

2. Running a Process in the Background with nohup
Running a Linux process in the background frees up the terminal you are working in. To run a Linux process in the background with the nohup command, add the & symbol at the end of the command:
For example, to run the example.sh bash script in the background, use the command:
The output displays the shell job ID and process ID — [1] 7366 in the example below.

To bring the command in the foreground, type:

The output indicates whether the process is in progress or complete.
Note: For a list of all the important Linux commands in one place, check out our Linux Commands Cheat Sheet.
3. Running Multiple Processes in the Background with nohup
Replace [command1] and [command2] with the commands of your choice. Add more commands if necessary, making sure to separate them with && .
For instance, to show the date/time and the calendar of the current month, run:
As the output is directed to the nohup.out file, use the cat command to list the contents of the file and verify the command above:
The output shows the date and calendar prompted with the command above.

4. Redirecting Output to a Different File
As mentioned in the section above, nohup logs all output messages and errors into the nohub.out file.
Redirect these messages by specifying a custom location within the command:
In the example below, the output for the command nohup bash -c 'date && cal' is redirected to the output.txt file. Check the output with the command:

After reading this article, you should know how to use the nohup command to run processes in the background and redirect their output.
As an alternative to using the nohup command, consider checking out Tmux. Tmux was built to support multitasking in a terminal window. Learn more in our comprehensive Tmux Tutorial.
How to use Nohup in Linux
Nohup (stands for no hangup) is a command that ignores the HUP signal. You might be wondering what the HUP signal is. It is basically a signal that is delivered to a process when its associated shell is terminated. Usually, when we log out, then all the running programs and processes are hangup or stopped. If we want to continue running the process even after logout or disconnection from the current shell, we can use the nohup command. It makes the processes immune to HUP signals in order to make the program run even after log out. With nohup, you will no longer need to login for a long time just to wait for the process to be completed.
In this article, we will explain how to use the Nohup command in different scenarios in Linux.
Nohup Command Syntax
To use the nohup command, syntax is:
To find the help regarding the nohup command, use the following command:
To find the version information of nohup, use the following command:
Start a process using Nohup
If you want to keep a command or process running even if you exit the shell, use the nohup followed by the command to execute:
Once you run the above command, all the output, along with the error messages, will be added to the nohup.out file in the Home directory or in the current directory. Now, if the shell is closed or you log out, the above-executed command will not be terminated.
Redirect output to different file
By default, the output of nouhup command is added to the nohup.out file. To redirect this output to some other file, use > redirector operator followed by the name of the specific file. For instance, we have used the following command to save the output of nohup command to a new file named “myscript.sh”.
Start a process in the background using Nohup
To start and put the process in the background, you will need to use the nohup as follows:
The & symbol tells the shell to run the command in the background. It is similar to the above nohup command except that when the session ends, it returns immediately to the shell prompt. To bring it back to the forefront, use the “fg” command.

The output of all the commands you execute will be appended to the nohup.out file. You can view this file using the cat nohup command in the Terminal. The number 80132 in the above screenshot indicates the process Identification number (PID) of the process running in the background.
Start multiple processes in the background using Nohup
You can run multiple commands in the background by using the nohup command. In the following example, mkdir, ping, and ls commands are executed in the background by using nohup command.

Terminate process running in the background
To terminate a process running in the background, use the kill command as follows:
You will find the PID of a process when using the nohup with “&”. Another way to find PID is through the pgrep –a command. For instance, if you have run the Ping command with nohup, it’ll keep running in the background even if you close the shell. Now in this case, to find the PID of a Ping process running in the background, use this command:
It will list all the processes associated with the Ping command.

Now to terminate the Ping process running in the background, use the kill command as follows:$ kill -9 80928So, this was the brief introduction of nohup command in Linux. Nohup command is used to prevent an important process from being terminated when you log out or close the session. It helps a lot when you are running a process, especially scripts that take a long time to complete.
About the author

Karim Buzdar
Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.
Shell Programming and Scripting
10, 0 
6, 0 
10, 0 
Hi esmith92000 ,
I have done that but it is saying That no such process there.
———- Post updated at 09:27 PM ———- Previous update was at 09:25 PM ———-