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 find files on Linux There are many options you can use to find files on Linux, including searching by file name (or partial name), age, owner, group, size, type and inode number. By Sandra Henry Stocker Jun 24, 2024 8 mins Linux opinion Linux in your car: Red Hat’s milestone collaboration with exida With contributions from Red Hat and critical collaborators, the safety and security of automotive vehicles has reached a new level of reliability. By Sandra Henry Stocker Jun 17, 2024 5 mins Linux how-to How to print from the Linux command line: double-sided, landscape and more There's a lot more to printing from the Linux command line than the lp command. Check out some of the many available options. By Sandra Henry Stocker Jun 11, 2024 6 mins Linux how-to Converting between uppercase and lowercase on the Linux command line Converting text between uppercase and lowercase can be very tedious, especially when you want to avoid inadvertent misspellings. Fortunately, Linux provides a handful of commands that can make the job very easy. By Sandra Henry Stocker Jun 07, 2024 5 mins Linux PODCASTS VIDEOS RESOURCES EVENTS NEWSLETTERS Newsletter Promo Module Test Description for newsletter promo module. Please enter a valid email address Subscribe