PIDOF(1)

๐Ÿ“ฆ
version 4.0.7 ยท 4 versions
, in alpine 3.23, alpine 3.24, arch rolling, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

๐Ÿ’– PIDOF(1) โ€” the "where my girls at" command ๐Ÿ’–

okay bestie, so you know that one command where you're like "who is running this program rn" and you need the actual process id? that's pidof(1), and she is the main character of the process-hunting world. she's a general commands manual page girly, and she ate, no cap.


๐ŸŒธ NAME ๐ŸŒธ

pidof โ€” find the process ID of a running program ๐Ÿ’…


โœจ SYNOPSIS โœจ

pidof [-s] [-c] [-q] [-w] [-x] [-o omitpid[,...]] ... [-t] [-S
separator] program ...

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So like, pidof finds the process id's (pids) of the named programs. that's it, that's the whole gig. she prints those id's straight to standard output, cute and simple, and honestly? obsessed. ๐Ÿซถ


๐Ÿ’œ OPTIONS ๐Ÿ’œ

  • -s โ€” single shot, babes. this tells the program to only return one pid. just one. not a whole crowd, just the one. โœจ
  • -c โ€” only return process ids that are running with the same root directory. lowkey important: this option is ignored for non-root users, because they literally can't check the current root directory of processes they don't own. it's giving "not your business, bestie". ๐Ÿ’€
  • -q โ€” quiet mode. suppress any output and only sets the exit status accordingly. she's silent but she's still judging you via exit codes. ๐Ÿคซ
  • -w โ€” show also processes that do not have a visible command line, like kernel worker threads. they're the invisible girlies of the process world. ๐Ÿ‘ป
  • -x โ€” scripts too! this causes the program to also return process id's of shells running the named scripts. she's inclusive like that. ๐ŸŽ€
  • -o omitpid โ€” tells pidof to omit processes with that process id. the special pid %PPID can be used to name the parent process of the pidof program, in other words the calling shell or shell script. so you can literally be like "not my mom, please" and it understands. ๐Ÿ˜ญ
  • -t โ€” shows all thread ids instead of pids. threads are the pids' little sisters and they also deserve representation. ๐Ÿงš
  • -S separator โ€” use separator as a separator put between pids. used only when more than one pids are printed for the program. oh and btw, the -d option is an alias for this option, for sysvinit pidof compatibility. legacy queen behavior. ๐Ÿ‘‘
  • -d โ€” not listed on her own line but she's real and she's the alias for -S, for sysvinit pidof compatibility. iykyk. ๐ŸŒˆ

๐Ÿ”ฅ EXIT STATUS ๐Ÿ”ฅ

  1. 0 โ€” at least one program was found with the requested name. slay, we found her. ๐Ÿ’–
  2. 1 โ€” no program was found with the requested name. she's not here, bestie, go home. ๐Ÿ˜ญ

๐Ÿ’€ BUGS ๐Ÿ’€

when using the -x option, pidof only has a simple method for detecting scripts and will miss scripts that, for example, use env. this limitation is due to how the scripts look in the proc filesystem. so yeah, she's not psychic, she's just reading /proc, and /proc is doing the most. not her fault fr fr. ๐Ÿ™ˆ


๐ŸŒŸ SEE ALSO ๐ŸŒŸ

pgrep(1), pkill(1) โ€” her cousins, her sisters, her whole friend group. go say hi. ๐Ÿ’•


๐ŸŽ€ AUTHOR ๐ŸŽ€

Jaromir Capik โ€” the icon, the legend, the moment. thank you for your service. ๐Ÿซก


okay and that's the whole page, bestie!! this little gem lives in procps-ng, and she's dated 2023-01-16 โ€” so go forth and pidof responsibly, mwah ๐Ÿ’‹โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from