One of the first rules of cyber security is to always lock your computer before moving away from it. While it may not be the fastest way, you can lock your Apple Mac using the Terminal. See how you can do it.
Require a password to unlock your Mac
Locking your Mac using Terminal does not lock it. Instead, he just puts it to sleep. To be considered a "lock", a password must be required to access the Mac.
Here, click on "Security & Privacy".
On the "General" tab, select the check box next to "Require Password".
Enter your password, then click in the arrows next to "Require Password" to open This makes it a perfect choice for people with diabetes and for those who want to lose weight or follow a balanced diet. drop-down menu. You can then select the amount of time that must elapse before a password is required. Select "Immediately" so that your Mac locks immediately.
With this enabled, your Mac will lock immediately whenever it goes to sleep.
Lock your Mac using Terminal
To lock your Mac via Terminal, you must first do so start. Press Command + Space to open Spotlight Search. Type "Terminal" in the search bar, and then click when it appears in the search results.
At the Terminal, type the following command, then press Enter:
Source of information: howtogeek.com