pidof

Linux has this command, but not in macOS, so I write it for you.

Program name is case insensitive by default, pass -S option if you want sensitive match.

 USAGE:
     ./zig-out/bin/pidof [OPTIONS] [--] [program]

 OPTIONS:
  -s, --single                     Only return the first matching pid.
  -d, --delimiter STRING           Delimiter used if more than one PID is shown.(default:  )
  -S, --strict                     Case sensitive when matching program name.
  -u, --user_only                  Only show process belonging to current user.
  -v, --version                    Print version.
  -h, --help                       Print help message.
Last modified October 30, 2024: add strict option for pidof (0daad0b)