Three ways to lock your Ubuntu screen

When you have to take a break from work but do not want to end your current session, locking your computer screen is the way out. You can, of course, shut down your system and start it again when you are back, but that means you have to save all your work and open it all in the same state when you need to. Why opt for this second option when your system allows you to temporarily lock your system so that unauthorized people can not access it.

In this article, we will explain three methods to lock your Ubuntu screen; through the UI, through the keyboard shortcut, and through the command line.

We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 and Ubuntu 20.04 LTS system.

Method 1: Through the Settings Panel

The UI based method to lock your Ubuntu screen is through the Settings Panel that can be accessed from the top bar of your Ubuntu desktop.

Click on the downward arrow located at the top right corner of your Ubuntu screen. This is the panel that will appear:

Lock screen using settings panel

This panel gives you quick graphical access to many configurable system settings. You can lock your computer screen through the Lock icon, which by default is the second last icon located at the bottom on Ubuntu 20.04. As soon as you click on this icon, your computer screen will be locked.

Method 2: Through keyboard shortcut

All Ubuntu systems come with some predefined keyboard shortcuts that you can utilize in order to perform some basic system functions. Since screen locking is also a frequent operation, there is a shortcut for that too. In Ubuntu 20.04, you can use the Super+L shortcut to lock your computer screen. The Super key in the Windows button on your keyboard.

In previous versions of Ubuntu, you could use the Ctrl+Alt+L shortcut for this purpose.

You can easily view all the keyboard shortcuts from the system Settings utility.

The simplest way to access these settings is through the system Dash or the application launcher search bar as follows:

Keyboard shortcuts

Enter relevant keywords to access keyboard shortcuts in this bar and then click the appropriate search result.

This will open the Settings>Devices>Keyboard view as follows:

Keyboard shortcut to lock the screen

Here you can view the list of all the predefined shortcuts, edit one by clicking on it, and also create new custom shortcuts for your ease of use.

Method 3: Through the command line

There is a utility called Gnome Screensaver that lets you lock your Ubuntu screen through the command line.

Open your Ubuntu command line, the Terminal, either through the application launcher search or the Ctrl+Alt+T shortcut.

Then enter the following command as sudo in order to install the Gnome Screensaver utility:

$ sudo apt-get install gnome-screensaver

Install GNOME Screensaver

Please note that only an authorized user can add/remove, and configure software on Ubuntu. Enter the password for sudo and the software will be installed on your system.

You can then use the following command in order to lock your Ubuntu screen:

$ gnome-screensaver-command -l

Lock the screen using gnome screensaver command

These were the ways through which you can ensure the security of your system while you are away by locking your Ubuntu screen.