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

The usage of the Linux basic command pidof

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains "the usage of the Linux basic command pidof". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the usage of the basic Linux command pidof.

Pidof

Pidof can find the pid of a process with a specified name and send the results to standard output. Pidof has two return values: 0, at least one process is found, and 1, no process is found. Pidof is actually the same as killall5; the program operates according to the name that calls it.

The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.

1. Grammar

Pidof [options] name

2. List of options

Option

Description

S

Respond to only one process number at a time

-c

Only processes running in the root directory are displayed. This option is valid only for root users.

-o

Ignore the process with the specified process number

-x

Also show the same name in the shell script run

3. Examples

1) View the id of the specified process

[root@localhost ~] # pidof bash / / shows the id of the bash process, with two

8563 8266

2) display only one process at a time

[root@localhost ~] # pidof-s bash / / shows only one process id

8563

At this point, I believe you have a deeper understanding of "the use of the Linux basic command pidof". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Servers

Wechat

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

12
Report