bash

How to Use nohup

How to Use nohup

The nohup command allows you to run a script or command in the background, even after you log out from the terminal. This is particularly useful for long-running processes.

Basic Usage

To use nohup, simply prefix your command with it and redirect the output:

nohup ./your-script.sh > output.log 2>&1 &

Understanding Output Redirection

By default, nohup outputs to a file called nohup.out. You can redirect this to a different file using:

nohup ./your-script.sh > custom-output.log 2>&1 &

Checking the Process

To check if your process is running, you can use the ps command:

ps aux | grep your-script.sh
moin

Recent Posts

Bash Script Basics Tutorial: #1

Bash Script Basics Bash scripting is a powerful way to automate tasks in Linux. This…

1 year ago

Screen vs Tmux: Which One to Choose?

Screen vs Tmux Both screen and tmux are popular terminal multiplexers that allow you to…

1 year ago

Running Bash script in background

Running Bash script in background Running Bash script in the background is useful for executing…

1 year ago

How do I make Git ignore file mode (chmod)?

How do I make Git ignore file mode (chmod)? Git is a powerful version control…

1 year ago

Setup Tailwind CSS with Angular 11

Install tailwind css with npm Run the following command to install tailwind css npm install…

3 years ago

How to setup laravel project using homestead

Step 1 : Create a new directory Homestead by using this command  cd ~/Homestead Step…

3 years ago

This website uses cookies.