What it means to freeze a terminal window and lock a screen -- and how to manage these activities on your Linux system. Credit: Sandra Henry-Stocker How you freeze and “thaw out” a screen on a Linux system depends a lot on what you mean by these terms. Sometimes “freezing a screen” might mean freezing a terminal window so that activity within that window comes to a halt. Sometimes it means locking your screen so that no one can walk up to your system when you’re fetching another cup of coffee and type commands on your behalf. In this post, we’ll examine how you can use and control these actions. How to freeze a terminal window on Linux You can freeze a terminal window on a Linux system by typing Ctrl+S (hold control key and press “s”). Think of the “s” as meaning “start the freeze”. If you continue typing commands after doing this, you won’t see the commands you type or the output you would expect to see. In fact, the commands will pile up in a queue and will be run only when you reverse the freeze by typing Ctrl+Q. Think of this as “quit the freeze”. One easy way to view how this works is to use the date command and then type Ctrl+S. Then type the date command again and wait a few minutes before typing Ctrl+Q. You’ll see something like this: $ date Mon 16 Sep 2019 06:47:34 PM EDT $ date Mon 16 Sep 2019 06:49:49 PM EDT The gap between the two times shown will indicate that the second date command wasn’t run until you unfroze your window. Terminal windows can be frozen and unfrozen whether you’re sitting at the computer screen or running remotely using a tool such as PuTTY. And here’s a little trick that can come in handy. If you see that a terminal window appears to be inactive, one possibility is that you or someone else inadvertently typed Ctrl+S. In any case, entering Ctrl+Q just in case this resolves the problem is not a bad idea. How to lock your screen To lock your screen before you leave your desk, either Ctrl+Alt+L or Super+L (i.e., holding down the Windows key and pressing L) should work. Once your screen is locked, you will have to enter your password to log back in. Automatic screen locking on Linux systems While best practice suggests that you lock your screen whenever you are about to leave your desk, Linux systems usually automatically lock after a period of no activity. The timing for “blanking” a screen (making it go dark) and actually locking the screen (requiring a login to use it again) depend on settings that you can set to your personal preferences. To change how long it takes for your screen to go dark when using GNOME screensaver, open your settings window and select Power and then Blank screen. You can choose times between 1 and 15 minutes or never. To select how long after the blanking the screen locks, go to settings, select Privacy and then Blank screen. Settings should include 1, 2, 3, 5 and 30 minutes or one hour. How to lock your screen from the command line If you are using Gnome screensaver, you can also lock the screen from the command line using this command: gnome-screensaver-command -l That’s a lowercase L for “lock”. How to check your lockscreen state You can also use the gnome screensaver command to check whether your screen is locked,. With the –query option, the command tells you whether screen is currently locked (i.e., active). With the –time option, it tells you how long the lock has been in effect. Here’s an sample sctipt: #!/bin/bash gnome-screensaver-command --query gnome-screensaver-command --time Running the script will show output like this: $ ./check_lockscreen The screensaver is active The screensaver has been active for 1013 seconds. Wrap-up Freezing your terminal window is easy if you remember the proper control sequences. For screen locking, how well it works depends on the controls you put in place for yourself or whether you’re comfortable working with the defaults. Related content how-to How to examine files on Linux Linux provides very useful options for viewing file attributes, such as owners and permissions, as well as file content. By Sandra Henry Stocker Oct 24, 2024 6 mins Linux how-to 8 easy ways to reuse commands on Linux Typing the same command again and again can become tiresome. Here are a number of ways you can make repeating commands – or repeating commands but with some changes – a lot easier than you might expect. By Sandra Henry-Stocker Oct 15, 2024 5 mins Linux news SUSE Edge upgrade targets Kubernetes and Linux at the edge SUSE Edge 3.1 includes a new stack validation framework and an image builder tool that are aimed at improving the scalability and manageability of complex Kubernetes and Linux edge-computing deployments. By Sean Michael Kerner Oct 15, 2024 6 mins Edge Computing Linux Network Management Software how-to Lesser-known xargs command is a versatile time saver Boost your Linux command line options and simplify your work with xargs, a handy tool for a number of data manipulation tasks. By Sandra Henry Stocker Oct 11, 2024 6 mins Linux PODCASTS VIDEOS RESOURCES EVENTS NEWSLETTERS Newsletter Promo Module Test Description for newsletter promo module. Please enter a valid email address Subscribe