I want to logout my Mac OS X from the command line. My OS X version is 10.9.
I tried command
pkill -KILL -u uid, but this command didn't work out.
Is there a command that can be used to log out a user from the system using command line only, not AppleScript?
This has worked for me in the past:
Log out (with confirmation)
Log out directly (no confirmation)
This way any running application will get noticed and can terminate in a safe fashion.
Just kill the loginwindow process.
You could get fancy and specify the user if multiple users have a loginwindow process, but this is an easy one shot, no prompt way to end a user's graphical session.