Log a User Out from Command Line


Automation is the dream of an administrator, a support agent and a person with technological knowledge. Automating tasks using remote scripts helps get customers out of trouble or even out of the organization itself. Large updates can often require users to log out. Removing a user from the command line is super easy on Macs!

To exit a macOS user with a confirmation warning, follow these steps from the command prompt:

osascript -e 'tell app "System Events" to log out'

To force exit from macOS without warning, follow these steps from the command prompt:

osascript -e 'tell application "loginwindow" to  «event aevtrlgo»'

osascript Is a truly amazing utility, one that allows you to change the volume of the system, send iMessages and identify app IDs. Read automation commands? Priceless!

  • How I stopped the WordPress Comments Spam

    How I stopped the WordPress Comments Spam

    I love almost every part of being a tech blogger: learning, preaching, whining, researching. The one part of blogging that I absolutely hate: dealing with spam comments. In the last two years, my blog has posted 8,000+ SPAM comments a day. for the day. Inflating my database …

  • Identify adding a DOM node with JavaScript and CSS animations
  • Familiarity with MooTools ScrollSpy

    Familiarity with MooTools ScrollSpy

    I have been excited to release this supplement for a long time. MooTools ScrollSpy is a unique but simple MooTools plugin that listens for page scrolling and runs events based on where the user scrolls the page. Now you can shoot specific …

  • MooTools CountDown plugin

    MooTools CountDown plugin

    There are many websites around the internet, RapidShare for example, that make you wait a set amount of time before submitting your reward. Using MooTools, I created a CountDown plugin that allows you to easily implement a similar system. The MooTools JavaScript Countdown Class …



Please enter your comment!
Please enter your name here