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 get process PID in Linux system

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Today, I want to introduce you to how Linux system gets PID. The content of the article Xiaobian think good, now to share with you, think there is a need for friends can understand, hope to help everyone, the following with the idea of Xiaobian to read together.

How to get process PID in Linux system:

method one

#ps -ef |grep xxx |awk ‘{print $1}’

e.g:

ps -ef |grep java |awk ‘{print $1}’

Notes:

1. xxx is the name of the command executed

2. For example, get java process [pid] under current user

[admin@vm168a ~]$ ps -ef |grep java |awk ‘{print $1}’

16920

3. Use three commands: ps, grep, awk.

Method 2 (Recommended)

$pgrep xxx

e.g:

pgrep java

Original text: lionbule.iteye.com/blog/713585

Number of Java processes:

proNo=pgrep java | wc -l

The above is how Linux system to obtain the full content of the process PID, more and Linux system how to obtain the process PID related content can be searched before the article or browse the following article to learn Ha! I believe that Xiaobian will add more knowledge to everyone, I hope you can support it!

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: 279

*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