List of services via terminal

AVmcclint
Honored Contributor

Since Jamf Pro lacks any useful way to generate reports, and our ability to use the API right now is limited (long story, don't ask), I need a way to generate the same list of Services that can be found in the Computer records. I thought launchctl might do it but there's a lot that's missing.  I tried using ps aux | grep -v '/Applications' and that seems to be a bit closer to what I want, but it's still not the succinct format Jamf displays.  Any clues?

1 ACCEPTED SOLUTION

mm2270
Legendary Contributor III

I'm pretty sure it's just something like this.

/bin/launchctl list | /usr/bin/awk '{print substr($0, index($0, $3))}' | /usr/bin/sed '1d'

It doesn't match up exactly on my Mac, but it's very close. I actually seem to list a couple of more services when I run that manually in Terminal as root vs what Jamf captures, but it mostly lines up. At least I don't think there's anything missing.

View solution in original post

3 REPLIES 3

mm2270
Legendary Contributor III

I'm pretty sure it's just something like this.

/bin/launchctl list | /usr/bin/awk '{print substr($0, index($0, $3))}' | /usr/bin/sed '1d'

It doesn't match up exactly on my Mac, but it's very close. I actually seem to list a couple of more services when I run that manually in Terminal as root vs what Jamf captures, but it mostly lines up. At least I don't think there's anything missing.

AVmcclint
Honored Contributor

That's good enough for me!

Hayes69
New Contributor II

msc from the command prompt or by opening the start menu, typing "services" from the Start Menu and then launching the Service Manager icon that should show up right away.