Locking the screen is a simple but essential step in protecting the system when stepping away. It is very useful when working in a shared space or just want to prevent accidental keystrokes. This tutorial provides 3 methods how to lock screen on Ubuntu.
Method 1 - xdg-screensaver command
The xdg-screensaver
utility is a cross-desktop tool to control screensavers. To lock the screen, open a terminal and type:
xdg-screensaver lock
This works across many desktop environments and is a reliable, scriptable option.
Method 2 - dbus-send command
If you're using GNOME (default on Ubuntu), you can use D-Bus to signal the screen to lock:
dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock
This is a lower-level command but works well in scripts.
Method 3 - Super + L shortcut
You can also lock the screen using a keyboard shortcut by pressing Super + L
. The Super
is usually the Windows key on most keyboards.
Leave a Comment
Cancel reply