All Mac users know that if they close the lid, it would put the computer to sleep. However, in some cases, users may wish to lock their Mac. Doing so will also cause the system to enter into sleep mode with the difference that you will have to type a login password for the account the next time you reactivate it. This is a convenient way to prevent unwanted people from accessing your Mac. However, before you can lock your screen, it must be set up in System Preferences properly.
Launch System Preferences by either selecting it from the Apple menu or clicking its icon in the Dock. Open the 'Security & Privacy' pane. Go to the 'General' tab and from the 'Require Password...' drop-down menu select the option that best fits your needs. Afterward, the computer will be locked whenever it enters into sleep mode or a screensaver is started. To unlock the Mac, users will have to provide a login password, use TouchID, or gain access via Apple Watch.
Another method for initiating Lock or Sleep on your Mac is to use the appropriate keyboard commands. To lock the system, try pressing Command+Control+Q. On older macOS versions, try this command instead - Control+Shift+Power. If you just want to put the system in Sleep mode, press Command+Option+Power. While in Sleep mode, the Mac lowers the power consumption of the CPU, powers down the hard drive, and stops most background tasks to conserve energy.