In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
 
            
                     
                
2025-10-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "CentOS how to view the files opened by the process or the corresponding process". In daily operation, I believe that many people have doubts about how to view the files opened by the process or the corresponding process in CentOS. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for everyone to answer the question of "how to view the files opened by the process or the corresponding process of files opened by CentOS". Next, please follow the editor to study!
1. View the files "opened" by the process:
1) pidof programe-name (get the PID of the process (programe-name) you want to know)
Or ps-aux | grep programe-name (get the PID of the process (programe-name) you want to know)
Find out the PID of the process
2) cd / proc/$PID/fd (you will see the file descriptor)
3) ls-l
Get the actual file pointed to by the file descriptor, that is, the file opened by the current process
2. View the file "opened" by the process 2:
1) the PID method of getting the process you want to know is the same as above.
2) lsof-c programe-name
Or lsof-p $PID
3. View the process corresponding to the file:
Lsof file-name
4. Usage of lsof command:
Lsof-c abc displays the files now opened by the abc process
Lsof abc shows the process of opening the file abc
Lsof-I: 22 shows what programs port 22 is running now.
Lsof-g gid shows the process that belongs to the gid
Lsof + d / usr/local/ displays the files opened by the process in the directory
Lsof + D / usr/local/ is the same as above, but will search the directory under the directory for a long time.
Lsof-d 4 shows processes using fd 4
Lsof-I is used to display eligible processes.
Lsof-s lists the size of the open file, leaving it blank if there is no size
Lsof-u username lists open files in UID
5. Check the network status:
Lsof-Pnl + M-i4 displays ipv4 services and listeners
Netstat-anp all listening ports and corresponding processes
Netstat-tlnp function is the same as above
At this point, the study on "how CentOS views the files opened by the process or the corresponding process" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about

The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r


A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from

Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





 
             
            About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.