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 pkill

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article introduces the relevant knowledge of "the usage of the Linux basic command pkill". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Pkill

Pkill can send information to a specified process, which can end an executing process or a user who logs in to a directory.

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

1. Grammar

Pkill [- signal] [- fvx] [- n |-o] [- P ppid,...] [- g pgrp,...] [- s sid,...] [- u euid,...] [- U uid,...] [- G gid,...] [- t term,...] [pattern]

2. List of options

Option

Description

-- help

Show help documentation

-- version

Show command version

-f

Find the completed file name

-g pgrp

Only processes in the listed process group ID are matched. Process group 0 is converted to pgrep or pkill's own process group.

-G gid

Only the processes listed in the actual group ID are matched. You can use numeric or symbolic values.

-n

Select the most recently executed process

-o

Select the earliest process

-P ppid

Select a process that matches the parent pid

-s sid

Only the processes listed in the process session ID are matched. Session ID 0 is converted to pgrep or pkill's own session ID.

-t term

Find a process that matches the terminal number

-u euid

Matches only the processes listed by its valid user ID.

-U uid

Only the processes listed by the actual user ID are matched. You can use numeric or symbolic values.

-v

Find processes that do not meet the criteria

-x

Matches only processes whose name (if-f specifies the command line) exactly matches the pattern.

-signal

The signal to be sent

3. Return value

Exit code

Description

One or more processes match.

one

No process matches

two

Syntax error of command

three

Fatal error: insufficient memory, etc.

4. Examples

Kill the wc process

[root@localhost ~] # pkill-SIGKILL wc / / sends a KILL signal to wc to kill the process

[1]-killed nice-n 19 wc

You have new mail in / var/spool/mail/root

[root@localhost ~] # ps / / View the process, wc has killed

PID TTY TIME CMD

8266 pts/0 00:00:00 bash

8554 pts/0 00:00:00 ps

This is the end of the introduction to "the usage of the Linux basic command pkill". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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