I am trying to figure out how many launch agents are loaded right now using following command the it
find /System/Library/Launch* /Library/Launch* ~/Library/Launch* -name '*.plist' -exec sh -c '/usr/libexec/PlistBuddy -c "Print Label" {} && echo {}' ';' | grep -wf <(launchctl list | grep -o "\S\+\..*$") -A1
grep -B 1 -A 1 "active count = 1$" <<< "$(launchctl dumpstate)"
but its not listed the one I am looking for. is it correct?
Using launchctl you can list all the running agents and daemons like such:
and
please note that the two are different commands. Oddly enough, running
sudo launchutil listprints out the root daemons, and only the root deamons.If you are running the commands in the terminal you will want to run the non-sudo version first, because if you don't, the sudo version will create a root session which will force version #1 to have root privileges anyways!
If you would like to find the file path to such an agent or daemon, this may help.
Edit:
Okay, I don't know how I missed the word "unloaded" in the giant title in your question but... here are the directories that daemons/agents like to hide in (copied from the man page of launchctl):