Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the use of Linux's nohup command

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of the use of Linux's nohup command, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this Linux nohup command. Let's take a look at it.

Linux commonly used command nohup English full name no hang up (do not hang up), used in the system background without hanging up to run the command, exit the terminal will not affect the operation of the program.

Syntax format nohup Command [Arg... ] [&] Parameter description: Command: command to be executed.

Arg: some parameters, you can specify the output file.

&: let the command execute in the background, and the command will still be executed after the terminal exits.

For example, the following command executes the runoob.sh script in the root directory in the background:

Nohup / root/runoob.sh-if you see the following output on the terminal, the operation is successful:

Appending output to nohup.out when we open the root directory, we can see that the nohup.out file is generated.

If you want to stop running, you need to find the nohup run script to PID using the following command, and then use the kill command to delete it:

Ps-aux | grep "runoob.sh" parameter description:

A: show all programs

U: display in a user-based format

X: show all programs, regardless of terminal

You can also use the ps-def | grep "runoob.sh" command to find it.

Once the PID is found, you can use kill PID to delete it.

Kill-9 process number PID the following command executes the runoob.sh script in the root directory in the background and redirects the input to the runoob.log file:

Nohup / root/runoob.sh > runoob.log 2 > & 1 & 2 > & 1 explanation:

Standard error 2 is redirected to standard output & 1, and standard output & 1 is then redirected into the runoob.log file.

0-stdin (standard input, standard input)

1-stdout (standard output, standard output)

2-stderr (standard error, standard error output)

This is the end of the article on "what is the use of Linux's nohup command". Thank you for reading! I believe you all have a certain understanding of the knowledge of "what is the use of Linux's nohup command". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report