What it means to freeze terminal Windows and lock screens – and how to manage these activities on Linux systems.

How you freeze and “unfreeze” screens on a Linux system depends largely on what these terms mean. Sometimes “freezing the screen” may mean freezing a terminal window so that the activity within that window stops. Sometimes it means locking the screen so no one can walk up to your system and type a command for you when you go to get a cup of coffee.

In this article, we will examine how to use and control these operations.

How do I freeze terminal Windows on Linux

You can freeze the terminal window on Linux by typing Ctrl+S (holding down the Ctrl and S keys). Imagine s as “start the freeze”. If you continue typing the command after this, you will not see the entered command or the output you expected. In fact, commands are stacked in a queue and run only when unfrozen by typing Ctrl+Q. Think of it as “quit the freeze.”

An easy way to see it in action is to use the date command and type Ctrl+S. Then type date again and wait a few minutes and type Ctrl+Q again. 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
Copy the code

The difference between the two time displays means that the second date command does not run until you unfreeze the window.

Terminal Windows can be frozen and unfrozen whether you’re sitting in front of a computer screen or running remotely using a tool like PuTTY.

Here’s a trick that can come in handy. If you notice that the terminal window appears to be inactive, you or someone else may have accidentally typed Ctrl+S. Well, it might be a good idea to try Ctrl+Q.

How to Lock the screen

To lock the screen before leaving your desk, hold Ctrl+Alt+L or Super+L (that is, hold the Windows key and L key). After the screen is locked, you must enter a password to log in again.

Automatic screen lock on Linux

While best practice suggests locking the screen when you are about to leave your desk, Linux systems typically lock automatically after a period of inactivity. The amount of time you spend “blanking” the screen (darkening it) and actually locking it (requiring login to use it again) depends on the Settings in your personal preferences.

To change the amount of time it takes for the screen to darken when using the GNOME screensaver, open the Settings window and select ‘Power’ then ‘Blank Screen’. You can choose from 1 to 15 minutes or from constant darkness. To select how long it will take to lock after the screen is dark, go to Settings, select “Privacy” and then “Blank Screen”. Settings should include 1, 2, 3, 5 and 30 minutes or an hour.

How do I lock the screen from the command line

If you’re using the GNOME screensaver, you can also lock the screen from the command line using the following command:

gnome-screensaver-command -l
Copy the code

Here’s the lowercase L, which stands for locked.

How do I check the screen lock status

You can also check if the screen is locked using the gnome-screensaver command. Using the –query option, this command tells you if the screen is currently locked (that is, active). Use the –time option, which tells you when the lock takes effect. Here is a sample script:

#! /bin/bash
gnome-screensaver-command --query
gnome-screensaver-command --time
Copy the code

Running the script will print:

$ ./check_lockscreen
The screensaver is active
The screensaver has been active for 1013 seconds.
Copy the code

conclusion

Locking terminal Windows is easy if you remember the correct controls. For screen locking, how well it works depends on your own Settings, or whether you’re comfortable with the default Settings.


Via: www.networkworld.com/article/343…

Author: Sandra henry-stocker lujun9972

This article is originally compiled by LCTT and released in Linux China