121be3b31SYaroslav Tykhiy.\" $NetBSD: pkill.1,v 1.8 2003/02/14 15:59:18 grant Exp $ 221be3b31SYaroslav Tykhiy.\" 321be3b31SYaroslav Tykhiy.\" Copyright (c) 2002 The NetBSD Foundation, Inc. 421be3b31SYaroslav Tykhiy.\" All rights reserved. 521be3b31SYaroslav Tykhiy.\" 621be3b31SYaroslav Tykhiy.\" This code is derived from software contributed to The NetBSD Foundation 721be3b31SYaroslav Tykhiy.\" by Andrew Doran. 821be3b31SYaroslav Tykhiy.\" 921be3b31SYaroslav Tykhiy.\" Redistribution and use in source and binary forms, with or without 1021be3b31SYaroslav Tykhiy.\" modification, are permitted provided that the following conditions 1121be3b31SYaroslav Tykhiy.\" are met: 1221be3b31SYaroslav Tykhiy.\" 1. Redistributions of source code must retain the above copyright 1321be3b31SYaroslav Tykhiy.\" notice, this list of conditions and the following disclaimer. 1421be3b31SYaroslav Tykhiy.\" 2. Redistributions in binary form must reproduce the above copyright 1521be3b31SYaroslav Tykhiy.\" notice, this list of conditions and the following disclaimer in the 1621be3b31SYaroslav Tykhiy.\" documentation and/or other materials provided with the distribution. 1721be3b31SYaroslav Tykhiy.\" 1821be3b31SYaroslav Tykhiy.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 1921be3b31SYaroslav Tykhiy.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 2021be3b31SYaroslav Tykhiy.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 2121be3b31SYaroslav Tykhiy.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 2221be3b31SYaroslav Tykhiy.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2321be3b31SYaroslav Tykhiy.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2421be3b31SYaroslav Tykhiy.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2521be3b31SYaroslav Tykhiy.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2621be3b31SYaroslav Tykhiy.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2721be3b31SYaroslav Tykhiy.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2821be3b31SYaroslav Tykhiy.\" POSSIBILITY OF SUCH DAMAGE. 2921be3b31SYaroslav Tykhiy.\" 30*3d17b350SFernando Apesteguía.Dd October 5, 2020 3121be3b31SYaroslav Tykhiy.Dt PKILL 1 3221be3b31SYaroslav Tykhiy.Os 3321be3b31SYaroslav Tykhiy.Sh NAME 3421be3b31SYaroslav Tykhiy.Nm pgrep , pkill 3521be3b31SYaroslav Tykhiy.Nd find or signal processes by name 3621be3b31SYaroslav Tykhiy.Sh SYNOPSIS 3721be3b31SYaroslav Tykhiy.Nm pgrep 387b0706f6SPawel Jakub Dawidek.Op Fl LSafilnoqvx 3921be3b31SYaroslav Tykhiy.Op Fl F Ar pidfile 4021be3b31SYaroslav Tykhiy.Op Fl G Ar gid 4121be3b31SYaroslav Tykhiy.Op Fl M Ar core 4221be3b31SYaroslav Tykhiy.Op Fl N Ar system 4321be3b31SYaroslav Tykhiy.Op Fl P Ar ppid 4421be3b31SYaroslav Tykhiy.Op Fl U Ar uid 45cc55ad3dSEdward Tomasz Napierala.Op Fl c Ar class 4621be3b31SYaroslav Tykhiy.Op Fl d Ar delim 4721be3b31SYaroslav Tykhiy.Op Fl g Ar pgrp 48c4f0631fSJamie Gritton.Op Fl j Ar jail 4921be3b31SYaroslav Tykhiy.Op Fl s Ar sid 5021be3b31SYaroslav Tykhiy.Op Fl t Ar tty 5121be3b31SYaroslav Tykhiy.Op Fl u Ar euid 5221be3b31SYaroslav Tykhiy.Ar pattern ... 5321be3b31SYaroslav Tykhiy.Nm pkill 5421be3b31SYaroslav Tykhiy.Op Fl Ar signal 55b040210dSBrian Somers.Op Fl ILafilnovx 5621be3b31SYaroslav Tykhiy.Op Fl F Ar pidfile 5721be3b31SYaroslav Tykhiy.Op Fl G Ar gid 5821be3b31SYaroslav Tykhiy.Op Fl M Ar core 5921be3b31SYaroslav Tykhiy.Op Fl N Ar system 6021be3b31SYaroslav Tykhiy.Op Fl P Ar ppid 6121be3b31SYaroslav Tykhiy.Op Fl U Ar uid 62cc55ad3dSEdward Tomasz Napierala.Op Fl c Ar class 6321be3b31SYaroslav Tykhiy.Op Fl g Ar pgrp 64c4f0631fSJamie Gritton.Op Fl j Ar jail 6521be3b31SYaroslav Tykhiy.Op Fl s Ar sid 6621be3b31SYaroslav Tykhiy.Op Fl t Ar tty 6721be3b31SYaroslav Tykhiy.Op Fl u Ar euid 6821be3b31SYaroslav Tykhiy.Ar pattern ... 6921be3b31SYaroslav Tykhiy.Sh DESCRIPTION 7021be3b31SYaroslav TykhiyThe 7121be3b31SYaroslav Tykhiy.Nm pgrep 7221be3b31SYaroslav Tykhiycommand searches the process table on the running system and prints the 7321be3b31SYaroslav Tykhiyprocess IDs of all processes that match the criteria given on the command 7421be3b31SYaroslav Tykhiyline. 7521be3b31SYaroslav Tykhiy.Pp 7621be3b31SYaroslav TykhiyThe 7721be3b31SYaroslav Tykhiy.Nm pkill 7821be3b31SYaroslav Tykhiycommand searches the process table on the running system and signals all 7921be3b31SYaroslav Tykhiyprocesses that match the criteria given on the command line. 8021be3b31SYaroslav Tykhiy.Pp 8121be3b31SYaroslav TykhiyThe following options are available: 8221be3b31SYaroslav Tykhiy.Bl -tag -width ".Fl F Ar pidfile" 8321be3b31SYaroslav Tykhiy.It Fl F Ar pidfile 8421be3b31SYaroslav TykhiyRestrict matches to a process whose PID is stored in the 8521be3b31SYaroslav Tykhiy.Ar pidfile 8621be3b31SYaroslav Tykhiyfile. 8721be3b31SYaroslav Tykhiy.It Fl G Ar gid 8821be3b31SYaroslav TykhiyRestrict matches to processes with a real group ID in the comma-separated 8921be3b31SYaroslav Tykhiylist 9021be3b31SYaroslav Tykhiy.Ar gid . 9121be3b31SYaroslav Tykhiy.It Fl I 9221be3b31SYaroslav TykhiyRequest confirmation before attempting to signal each process. 9321be3b31SYaroslav Tykhiy.It Fl L 9421be3b31SYaroslav TykhiyThe 9521be3b31SYaroslav Tykhiy.Ar pidfile 9621be3b31SYaroslav Tykhiyfile given for the 9721be3b31SYaroslav Tykhiy.Fl F 9821be3b31SYaroslav Tykhiyoption must be locked with the 9921be3b31SYaroslav Tykhiy.Xr flock 2 10021be3b31SYaroslav Tykhiysyscall or created with 10121be3b31SYaroslav Tykhiy.Xr pidfile 3 . 10221be3b31SYaroslav Tykhiy.It Fl M Ar core 10321be3b31SYaroslav TykhiyExtract values associated with the name list from the specified core 10421be3b31SYaroslav Tykhiyinstead of the currently running system. 10521be3b31SYaroslav Tykhiy.It Fl N Ar system 10621be3b31SYaroslav TykhiyExtract the name list from the specified system instead of the default, 10721be3b31SYaroslav Tykhiywhich is the kernel image the system has booted from. 10821be3b31SYaroslav Tykhiy.It Fl P Ar ppid 10921be3b31SYaroslav TykhiyRestrict matches to processes with a parent process ID in the 11021be3b31SYaroslav Tykhiycomma-separated list 11121be3b31SYaroslav Tykhiy.Ar ppid . 11221be3b31SYaroslav Tykhiy.It Fl S 11321be3b31SYaroslav TykhiySearch also in system processes (kernel threads). 11421be3b31SYaroslav Tykhiy.It Fl U Ar uid 11521be3b31SYaroslav TykhiyRestrict matches to processes with a real user ID in the comma-separated 11621be3b31SYaroslav Tykhiylist 11721be3b31SYaroslav Tykhiy.Ar uid . 11821be3b31SYaroslav Tykhiy.It Fl d Ar delim 11921be3b31SYaroslav TykhiySpecify a delimiter to be printed between each process ID. 12021be3b31SYaroslav TykhiyThe default is a newline. 12121be3b31SYaroslav TykhiyThis option can only be used with the 12221be3b31SYaroslav Tykhiy.Nm pgrep 12321be3b31SYaroslav Tykhiycommand. 1240a091aebSBrian Somers.It Fl a 1250a091aebSBrian SomersInclude process ancestors in the match list. 1260a091aebSBrian SomersBy default, the current 1270a091aebSBrian Somers.Nm pgrep 1280a091aebSBrian Somersor 1290a091aebSBrian Somers.Nm pkill 1300a091aebSBrian Somersprocess and all of its ancestors are excluded (unless 1310a091aebSBrian Somers.Fl v 1320a091aebSBrian Somersis used). 133cc55ad3dSEdward Tomasz Napierala.It Fl c Ar class 134cc55ad3dSEdward Tomasz NapieralaRestrict matches to processes running with specified login class 135cc55ad3dSEdward Tomasz Napierala.Ar class . 13621be3b31SYaroslav Tykhiy.It Fl f 13721be3b31SYaroslav TykhiyMatch against full argument lists. 13821be3b31SYaroslav TykhiyThe default is to match against process names. 13921be3b31SYaroslav Tykhiy.It Fl g Ar pgrp 14021be3b31SYaroslav TykhiyRestrict matches to processes with a process group ID in the comma-separated 14121be3b31SYaroslav Tykhiylist 14221be3b31SYaroslav Tykhiy.Ar pgrp . 14321be3b31SYaroslav TykhiyThe value zero is taken to mean the process group ID of the running 14421be3b31SYaroslav Tykhiy.Nm pgrep 14521be3b31SYaroslav Tykhiyor 14621be3b31SYaroslav Tykhiy.Nm pkill 14721be3b31SYaroslav Tykhiycommand. 14821be3b31SYaroslav Tykhiy.It Fl i 14921be3b31SYaroslav TykhiyIgnore case distinctions in both the process table and the supplied pattern. 150c4f0631fSJamie Gritton.It Fl j Ar jail 151c4f0631fSJamie GrittonRestrict matches to processes inside the specified jails. 152c4f0631fSJamie GrittonThe argument 153c4f0631fSJamie Gritton.Ar jail 154c4f0631fSJamie Grittonmay be 15521be3b31SYaroslav Tykhiy.Dq Li any 156c4f0631fSJamie Grittonto match processes in any jail, 15721be3b31SYaroslav Tykhiy.Dq Li none 158c4f0631fSJamie Grittonto match processes not in jail, 159c4f0631fSJamie Grittonor a comma-separated list of jail IDs or names. 16021be3b31SYaroslav Tykhiy.It Fl l 16121be3b31SYaroslav TykhiyLong output. 1623ba0e470SBrian SomersFor 1633ba0e470SBrian Somers.Nm pgrep , 1643ba0e470SBrian Somersprint the process name in addition to the process ID for each matching 16521be3b31SYaroslav Tykhiyprocess. 16621be3b31SYaroslav TykhiyIf used in conjunction with 16721be3b31SYaroslav Tykhiy.Fl f , 16821be3b31SYaroslav Tykhiyprint the process ID and the full argument list for each matching process. 1693ba0e470SBrian SomersFor 1703ba0e470SBrian Somers.Nm pkill , 1713ba0e470SBrian Somersdisplay the kill command used for each process killed. 17221be3b31SYaroslav Tykhiy.It Fl n 17321be3b31SYaroslav TykhiySelect only the newest (most recently started) of the matching processes. 17421be3b31SYaroslav Tykhiy.It Fl o 17521be3b31SYaroslav TykhiySelect only the oldest (least recently started) of the matching processes. 1767b0706f6SPawel Jakub Dawidek.It Fl q 177231ad771SBryan DreweryFor 178231ad771SBryan Drewery.Nm pgrep , 1797b0706f6SPawel Jakub DawidekDo not write anything to standard output. 18021be3b31SYaroslav Tykhiy.It Fl s Ar sid 18121be3b31SYaroslav TykhiyRestrict matches to processes with a session ID in the comma-separated 18221be3b31SYaroslav Tykhiylist 18321be3b31SYaroslav Tykhiy.Ar sid . 18421be3b31SYaroslav TykhiyThe value zero is taken to mean the session ID of the running 18521be3b31SYaroslav Tykhiy.Nm pgrep 18621be3b31SYaroslav Tykhiyor 18721be3b31SYaroslav Tykhiy.Nm pkill 18821be3b31SYaroslav Tykhiycommand. 18921be3b31SYaroslav Tykhiy.It Fl t Ar tty 19021be3b31SYaroslav TykhiyRestrict matches to processes associated with a terminal in the 19121be3b31SYaroslav Tykhiycomma-separated list 19221be3b31SYaroslav Tykhiy.Ar tty . 19318aa158fSEd SchoutenTerminal names may be of the form 19418aa158fSEd Schouten.Pa tty Ns Ar xx 19518aa158fSEd Schoutenor the shortened form 19618aa158fSEd Schouten.Ar xx . 19721be3b31SYaroslav TykhiyA single dash 19821be3b31SYaroslav Tykhiy.Pq Ql - 19921be3b31SYaroslav Tykhiymatches processes not associated with a terminal. 20021be3b31SYaroslav Tykhiy.It Fl u Ar euid 20121be3b31SYaroslav TykhiyRestrict matches to processes with an effective user ID in the 20221be3b31SYaroslav Tykhiycomma-separated list 20321be3b31SYaroslav Tykhiy.Ar euid . 20421be3b31SYaroslav Tykhiy.It Fl v 20521be3b31SYaroslav TykhiyReverse the sense of the matching; display processes that do not match the 20621be3b31SYaroslav Tykhiygiven criteria. 20721be3b31SYaroslav Tykhiy.It Fl x 20821be3b31SYaroslav TykhiyRequire an exact match of the process name, or argument list if 20921be3b31SYaroslav Tykhiy.Fl f 21021be3b31SYaroslav Tykhiyis given. 21121be3b31SYaroslav TykhiyThe default is to match any substring. 21221be3b31SYaroslav Tykhiy.It Fl Ns Ar signal 21321be3b31SYaroslav TykhiyA non-negative decimal number or symbolic signal name specifying the signal 21421be3b31SYaroslav Tykhiyto be sent instead of the default 21521be3b31SYaroslav Tykhiy.Dv TERM . 21621be3b31SYaroslav TykhiyThis option is valid only when given as the first argument to 21721be3b31SYaroslav Tykhiy.Nm pkill . 21821be3b31SYaroslav Tykhiy.El 21921be3b31SYaroslav Tykhiy.Pp 22021be3b31SYaroslav TykhiyIf any 22121be3b31SYaroslav Tykhiy.Ar pattern 222e4c7371cSGuangyuan Yangoperands are specified, they are used as extended regular expressions to match 22321be3b31SYaroslav Tykhiythe command name or full argument list of each process. 22421be3b31SYaroslav TykhiyIf the 22521be3b31SYaroslav Tykhiy.Fl f 22621be3b31SYaroslav Tykhiyoption is not specified, then the 22721be3b31SYaroslav Tykhiy.Ar pattern 22821be3b31SYaroslav Tykhiywill attempt to match the command name. 22921be3b31SYaroslav TykhiyHowever, presently 23021be3b31SYaroslav Tykhiy.Fx 23121be3b31SYaroslav Tykhiywill only keep track of the first 19 characters of the command 23221be3b31SYaroslav Tykhiyname for each process. 23321be3b31SYaroslav TykhiyAttempts to match any characters after the first 19 of a command name 23421be3b31SYaroslav Tykhiywill quietly fail. 23521be3b31SYaroslav Tykhiy.Pp 23621be3b31SYaroslav TykhiyNote that a running 23721be3b31SYaroslav Tykhiy.Nm pgrep 23821be3b31SYaroslav Tykhiyor 23921be3b31SYaroslav Tykhiy.Nm pkill 24021be3b31SYaroslav Tykhiyprocess will never consider itself nor system processes (kernel threads) as 24121be3b31SYaroslav Tykhiya potential match. 24295880592SSevan Janiyan.Sh IMPLEMENTATION NOTES 24395880592SSevan JaniyanThe Sun Solaris implementation utilised procfs to obtain process information. 24495880592SSevan JaniyanThis implementation utilises 24595880592SSevan Janiyan.Xr kvm 3 24695880592SSevan Janiyaninstead. 247d7a57037SSevan JaniyanOn a live system, 248d7a57037SSevan Janiyan.Xr kvm 3 249d7a57037SSevan Janiyanuses 250d7a57037SSevan Janiyan.Va kern.proc 251d7a57037SSevan JaniyanMIB to obtain the list of processes, kernel memory through 252d7a57037SSevan Janiyan.Pa /dev/kmem 253d7a57037SSevan Janiyanis not accessed. 25421be3b31SYaroslav Tykhiy.Sh EXIT STATUS 25521be3b31SYaroslav TykhiyThe 25621be3b31SYaroslav Tykhiy.Nm pgrep 25721be3b31SYaroslav Tykhiyand 25821be3b31SYaroslav Tykhiy.Nm pkill 25921be3b31SYaroslav Tykhiyutilities 26021be3b31SYaroslav Tykhiyreturn one of the following values upon exit: 26121be3b31SYaroslav Tykhiy.Bl -tag -width indent 26221be3b31SYaroslav Tykhiy.It 0 26321be3b31SYaroslav TykhiyOne or more processes were matched. 26421be3b31SYaroslav Tykhiy.It 1 26521be3b31SYaroslav TykhiyNo processes were matched. 26621be3b31SYaroslav Tykhiy.It 2 26721be3b31SYaroslav TykhiyInvalid options were specified on the command line. 26821be3b31SYaroslav Tykhiy.It 3 26921be3b31SYaroslav TykhiyAn internal error occurred. 27021be3b31SYaroslav Tykhiy.El 271*3d17b350SFernando Apesteguía.Sh EXAMPLES 272*3d17b350SFernando ApesteguíaShow the pid of the process holding the 273*3d17b350SFernando Apesteguía.Pa /tmp/.X0-lock 274*3d17b350SFernando Apesteguíapid file: 275*3d17b350SFernando Apesteguía.Bd -literal -offset indent 276*3d17b350SFernando Apesteguía$ pgrep -F /tmp/.X0-lock 277*3d17b350SFernando Apesteguía1211 278*3d17b350SFernando Apesteguía.Ed 279*3d17b350SFernando Apesteguía.Pp 280*3d17b350SFernando ApesteguíaShow the pid and the name of the process including kernel threads in the 281*3d17b350SFernando Apesteguíasearch: 282*3d17b350SFernando Apesteguía.Bd -literal -offset indent 283*3d17b350SFernando Apesteguía$ pgrep -lS vnlru 284*3d17b350SFernando Apesteguía37 vnlru 285*3d17b350SFernando Apesteguía.Ed 286*3d17b350SFernando Apesteguía.Pp 287*3d17b350SFernando ApesteguíaSearch for processes including kernel threads that match the extended regular 288*3d17b350SFernando Apesteguíaexpression pattern: 289*3d17b350SFernando Apesteguía.Bd -literal -offset indent 290*3d17b350SFernando Apesteguía$ pgrep -S 'crypto.*[2-3]' 291*3d17b350SFernando Apesteguía20 292*3d17b350SFernando Apesteguía19 293*3d17b350SFernando Apesteguía6 294*3d17b350SFernando Apesteguía5 295*3d17b350SFernando Apesteguía.Ed 296*3d17b350SFernando Apesteguía.Pp 297*3d17b350SFernando ApesteguíaShow long output for firefox processes: 298*3d17b350SFernando Apesteguía.Bd -literal -offset indent 299*3d17b350SFernando Apesteguía$ pgrep -l firefox 300*3d17b350SFernando Apesteguía1312 firefox 301*3d17b350SFernando Apesteguía1309 firefox 302*3d17b350SFernando Apesteguía1288 firefox 303*3d17b350SFernando Apesteguía1280 firefox 304*3d17b350SFernando Apesteguía1279 firefox 305*3d17b350SFernando Apesteguía1278 firefox 306*3d17b350SFernando Apesteguía1277 firefox 307*3d17b350SFernando Apesteguía1264 firefox 308*3d17b350SFernando Apesteguía.Ed 309*3d17b350SFernando Apesteguía.Pp 310*3d17b350SFernando ApesteguíaSame as above but just showing the pid of the most recent process: 311*3d17b350SFernando Apesteguía.Bd -literal -offset indent 312*3d17b350SFernando Apesteguía$ pgrep -n firefox 313*3d17b350SFernando Apesteguía1312 314*3d17b350SFernando Apesteguía.Ed 315*3d17b350SFernando Apesteguía.Pp 316*3d17b350SFernando ApesteguíaLook for vim processes. 317*3d17b350SFernando ApesteguíaMatch against the full argument list: 318*3d17b350SFernando Apesteguía.Bd -literal -offset indent 319*3d17b350SFernando Apesteguía$ pgrep -f vim 320*3d17b350SFernando Apesteguía44968 321*3d17b350SFernando Apesteguía30790 322*3d17b350SFernando Apesteguía.Ed 323*3d17b350SFernando Apesteguía.Pp 324*3d17b350SFernando ApesteguíaSame as above but matching against the 325*3d17b350SFernando Apesteguía.Ql list 326*3d17b350SFernando Apesteguíaword and showing the full argument list: 327*3d17b350SFernando Apesteguía.Bd -literal -offset indent 328*3d17b350SFernando Apesteguía$ pgrep -f -l list 329*3d17b350SFernando Apesteguía30790 vim list.txt 330*3d17b350SFernando Apesteguía.Ed 331*3d17b350SFernando Apesteguía.Pp 332*3d17b350SFernando ApesteguíaSend 333*3d17b350SFernando Apesteguía.Va SIGSTOP 334*3d17b350SFernando Apesteguíasignal to processes that are an exact match: 335*3d17b350SFernando Apesteguía.Bd -literal -offset indent 336*3d17b350SFernando Apesteguía$ pkill -SIGSTOP -f -x "vim list.txt" 337*3d17b350SFernando Apesteguía.Ed 338*3d17b350SFernando Apesteguía.Pp 339*3d17b350SFernando ApesteguíaWithout 340*3d17b350SFernando Apesteguía.Fl f 341*3d17b350SFernando Apesteguíanames over 19 characters will silently fail: 342*3d17b350SFernando Apesteguía.Bd -literal -offset indent 343*3d17b350SFernando Apesteguía$ vim this_is_a_very_long_file_name & 344*3d17b350SFernando Apesteguía[1] 36689 345*3d17b350SFernando Apesteguía$ 346*3d17b350SFernando Apesteguía 347*3d17b350SFernando Apesteguía[1]+ Stopped vim this_is_a_very_long_file_name 348*3d17b350SFernando Apesteguía$ pgrep "vim this" 349*3d17b350SFernando Apesteguía$ 350*3d17b350SFernando Apesteguía.Ed 351*3d17b350SFernando Apesteguía.Pp 352*3d17b350SFernando ApesteguíaSame as above using the 353*3d17b350SFernando Apesteguía.Fl f 354*3d17b350SFernando Apesteguíaflag: 355*3d17b350SFernando Apesteguía.Bd -literal -offset indent 356*3d17b350SFernando Apesteguía$ pgrep -f "vim this" 357*3d17b350SFernando Apesteguía36689 358*3d17b350SFernando Apesteguía.Ed 359*3d17b350SFernando Apesteguía.Pp 360*3d17b350SFernando ApesteguíaFind the 361*3d17b350SFernando Apesteguía.Xr top 1 362*3d17b350SFernando Apesteguíacommand running in any jail: 363*3d17b350SFernando Apesteguía.Bd -literal -offset indent 364*3d17b350SFernando Apesteguía$ pgrep -j any top 365*3d17b350SFernando Apesteguía34498 366*3d17b350SFernando Apesteguía.Ed 367*3d17b350SFernando Apesteguía.Pp 368*3d17b350SFernando ApesteguíaShow all processes running in jail ID 58: 369*3d17b350SFernando Apesteguía.Bd -literal -offset indent 370*3d17b350SFernando Apesteguía$ pgrep -l -j58 '.*' 371*3d17b350SFernando Apesteguía28397 pkg-static 372*3d17b350SFernando Apesteguía28396 pkg-static 373*3d17b350SFernando Apesteguía28255 sh 374*3d17b350SFernando Apesteguía28254 make 375*3d17b350SFernando Apesteguía.Ed 37621be3b31SYaroslav Tykhiy.Sh COMPATIBILITY 37721be3b31SYaroslav TykhiyHistorically the option 37821be3b31SYaroslav Tykhiy.Dq Fl j Li 0 37921be3b31SYaroslav Tykhiymeans any jail, although in other utilities such as 38021be3b31SYaroslav Tykhiy.Xr ps 1 38121be3b31SYaroslav Tykhiyjail ID 38221be3b31SYaroslav Tykhiy.Li 0 38321be3b31SYaroslav Tykhiyhas the opposite meaning, not in jail. 38421be3b31SYaroslav TykhiyTherefore 38521be3b31SYaroslav Tykhiy.Dq Fl j Li 0 38621be3b31SYaroslav Tykhiyis deprecated, and its use is discouraged in favor of 38721be3b31SYaroslav Tykhiy.Dq Fl j Li any . 38821be3b31SYaroslav Tykhiy.Sh SEE ALSO 38921be3b31SYaroslav Tykhiy.Xr kill 1 , 39021be3b31SYaroslav Tykhiy.Xr killall 1 , 39121be3b31SYaroslav Tykhiy.Xr ps 1 , 39221be3b31SYaroslav Tykhiy.Xr flock 2 , 39321be3b31SYaroslav Tykhiy.Xr kill 2 , 39421be3b31SYaroslav Tykhiy.Xr sigaction 2 , 395d7a57037SSevan Janiyan.Xr kvm 3 , 39621be3b31SYaroslav Tykhiy.Xr pidfile 3 , 39721be3b31SYaroslav Tykhiy.Xr re_format 7 39821be3b31SYaroslav Tykhiy.\" Xr signal 7 39921be3b31SYaroslav Tykhiy.Sh HISTORY 40021be3b31SYaroslav TykhiyThe 40121be3b31SYaroslav Tykhiy.Nm pkill 40221be3b31SYaroslav Tykhiyand 40321be3b31SYaroslav Tykhiy.Nm pgrep 40421be3b31SYaroslav Tykhiyutilities 40521be3b31SYaroslav Tykhiyfirst appeared in 40621be3b31SYaroslav Tykhiy.Nx 1.6 . 40721be3b31SYaroslav TykhiyThey are modelled after utilities of the same name that appeared in Sun 40821be3b31SYaroslav TykhiySolaris 7. 40921be3b31SYaroslav TykhiyThey made their first appearance in 41021be3b31SYaroslav Tykhiy.Fx 5.3 . 41121be3b31SYaroslav Tykhiy.Sh AUTHORS 412bd0891ceSBaptiste Daroussin.An Andrew Doran Aq Mt ad@NetBSD.org 413