The default keyboard shortcut for locking the screen on macOS Mojave is Command + Control + Q. You can use these keystrokes at any time. Once you hit the command sequence on the keyboard, the current macOS user session screen will instantly lock, requiring a login to regain access to the session.

This is equivalent in functionality to the Command + L key combination in Microsoft Windows. You can also select this key combination from the Apple menu.

Bookmarked Getting the bundle identifier of an OS X application in a shell script (Super User)

How about reading the bundle identifier from the application's Info.plist file directly using PlistBuddy (8):

/usr/libexec/PlistBuddy -c 'Print CFBundleIdentifier' /Applications/Safari.app/Contents/Info.plist

I needed to obtain the bundle identifier to setup QuickCursor. This did the trick.