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 the setsid command in Linux

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

Share

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

This article is to share with you about the use of the setsid command in Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Linux commonly used command setsid is mainly to re-create a session. The child process inherits SessionID, process group ID and open terminal from the parent process. If the child process wants to break away from the parent process, it is not controlled by the parent process.

Setsid runs the program in a new session

Add that the setsid command child process inherits from the parent process: SessionID, process group ID, and open terminal. If a child process wants to break away from this, it can be done by calling setsid in the code. The command line or script can be achieved by running the program using the command setsid. Setsid helps a process break away from open terminals, process groups, and sessions inherited from the parent process.

Syntax setsid [options] [arguments...] Option-c,-- ctty sets the control terminal to the current control terminal-f,-- fork is always fork-w,-- wait waits for the program to exit, and it is also very convenient to use the same return instance to see the use of setsid, just add setsid before the command to be processed.

[root@root ~] # setsid ping www.ibm.com [root@root ~] # ps-ef | grep www.ibm.com root 31094 10 07:28? 00:00:00 ping www.ibm.com root 31102 29217 0 07:29 pts/4 00:00:00 grep www.ibm.com [root@root] # Thank you for reading! This is the end of this article on "what is the use of setsid commands in Linux?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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