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

How to use the Linux disown command

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Most people do not understand the knowledge of this "Linux disown command how to use" article, so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "Linux disown command how to use" article.

Disown removes jobs from the current shell.

Summary disown [- h] [- ar] [jobspec. | pid.] The main purpose is to remove all jobs from the job list in the current shell.

Removes the specified one or more jobs from the job list in the current shell.

Removes running jobs from the list of jobs in the current shell.

Mark jobs so that they do not end after the current shell exits.

The option-h marks each job identifier, and these jobs will not receive a sighup signal when shell receives a sighup signal. -a remove all jobs. -r removes the running job. Parameter jobspec (optional): the job identifier to remove, which can be one or more.

Pid (optional): the process ID corresponding to the job to be removed can be one or more.

The return value returns success unless job control is not enabled or there is an error in execution.

Example # demo. [user2@pc] ssh 192.168.1.4 user2@192.168.1.4's password: # Press ctrl+z at this time to stop the interaction. [1] + Stopped ssh 192.168.1.4 [user2@pc] ssh 192.168.1.7 user2@192.168.1.7's password: # press ctrl+z at this time to stop the interaction. [1] + Stopped ssh 192.168.1.7 [user2@pc] sleep 120 & [3] 28986 # lists jobs and pid information. [user2@pc] jobs-l [1]-28756 Stopped ssh 192.168.1.4 [2] + 28833 Stopped ssh 192.168.1.7 [3] 28986 Running sleep 120 & # Delete a running job. [user2@pc] disown-r [user2@pc] jobs-l [1]-28756 Stopped ssh 192.168.1.4 [2] + 28833 Stopped ssh 192.168.1.7 # Note disown just removes the job and does not stop. [user2@pc] pgrep-a-u user2-f 'sleep 120' 28986 sleep 120 # deletes the specified job. [user2@pc] disown% 2 bash: warning: deleting stopped job 2 with process group 28833 [user2@pc] jobs-l [1]-28756 Stopped ssh 192.168.1.4 # Note disown only removes jobs and does not stop. [user2@pc] pgrep-a-u user2-f 'ssh 192.168.1.7' 28833 ssh 192.168.1.7 # Delete all jobs. [user2@pc] disown-a bash: warning: deleting stopped job 1 with process group 28756 [user2@pc] jobs-l # Note that disown only removes jobs and does not stop. [user2@pc] pgrep-a-u user2-f 'ssh 192.168.1.4' 28756 ssh 192.168.1.4 # demonstrate the effect of the-h option. [user2@pc] sleep 90 & [1] 109080 [user2@pc] jobs-l [1] + 109080 Running sleep 90 & [user2@pc] disown-h% 1 [user2@pc] exit # at this time the previous terminal has been closed, and now open a new terminal to look for the job. [user2@pc] pgrep-a-u user2-f 'sleep 90' 109080 sleep 90 Note bash's job control commands include bg fg kill wait disown suspend.

This command needs to be executed when the set option monitor is on; to view the job control status: type set-o to view the monitor line; execute set-o monitor or set-m to turn on this option.

This command is a bash built-in command. For help, please see the help command.

The usage of reference link disown

The above is about the content of this article on "how to use Linux disown commands". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please 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