One of the first rules of cybersecurity is to always lock your computer before getting off it. While this may not be the fastest way, you can lock your Apple Mac with Terminal. Here’s how to do it.
Require a password to unlock your Mac
The command to lock your Mac with Terminal does not really Close it. It just puts it to sleep. To be considered “locked”
To password protect your Mac after it hibernates, click the Apple icon at the top left of the menu bar, then select “System Preferences”.
Click here on ‘Security and privacy’.
In the ‘General’ tab, select the check box next to ‘Require password’.
Type your password, then click the arrows next to “Require password” to open the drop-down menu. You can then select the amount of time that must pass before a password is required. Select “Immediately” to lock your Mac when you put it to sleep.
With this enabled, your Mac will be instantly locked when it goes to sleep.
Lock your Mac with Terminal
To lock your Mac via Terminal, you need to start it first. Press Command + Spacebar to open Spotlight Search. Type “Terminal” in the search bar and click it when it appears in the search results.
In Terminal, type the following command and press Enter:
Your Mac is now in sleep mode. If you selected the option to require a password to activate it, it is now effectively locked as well.
Locking your Mac is a great way to prevent unauthorized access to your Mac while still allowing applications to run in the background. If you’d rather kill all operations, you can also shut down your Mac via Terminal.
RELATED: How to Lock Your Windows 10 PC with Command Prompt