Forrest logo
back to the nohup tool

nohup:tldr:49a0f

nohup: Run a process and write the output to a specific file.
$ nohup ${command} ${argument1 argument2 ---} > ${path-to-output_file} &
try on your machine

The given command is to execute a command asynchronously in the background without being terminated when the terminal session ends. Here is a breakdown of the individual components:

  • nohup: It is short for "no hang up". This command is used to prevent the command from being terminated even if the user closes the terminal session or logs out.
  • ${command}: This is a placeholder for the actual command you want to execute. Replace ${command} with the desired command name, like python, bash, java, etc.
  • ${argument1 argument2 ---}: This is a placeholder for the arguments that you want to pass to the command. Replace ${argument1 argument2 ---} with the desired arguments, separated by spaces.
  • >: This symbol is used for output redirection. It tells the command to redirect the standard output (stdout) to a file instead of the terminal.
  • ${path-to-output_file}: This is a placeholder for the path where you want to save the output of the command. Replace ${path-to-output_file} with the desired path and filename, like /path/to/output.txt.
  • &: This symbol is used to run the command in the background, allowing you to continue using the terminal for other tasks.

When you put all these components together, the command will execute the specified command with the provided arguments, and redirect its output to the specified file. The command will continue running independently in the background, even if you close the terminal session.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the nohup tool