How to turn off the monitor from a terminal

The monitor is the piece of hardware that consumes the most electricity. For that reason, It is good practice to turn off the monitor when you stop using the computer for a while.. To do this, you can use the Power Manager and indicate the number of minutes to wait for the screen to turn off. But, if you set a very low amount of minutes, the monitor will turn off every time the computer is idle; and if you choose a very high amount of minutes, it will take a long time to turn off. In short, even setting a low number of minutes, but not being hyper annoying, the system will take a long time to turn off the monitor. Wouldn't it be better to be able to turn it off when one tells you? This is not a problem on a desktop PC - the solution is to turn off the monitor using the button. But, very few laptops have that button to turn off the monitor. In those cases, one possibility might be to configure the system so that the monitor turns off when the lid is closed. Personally, this solution is very inconvenient for me.

So, what to do? Easy…

The solution

I just opened a terminal and type the following:

xset dpms force off

This command will turn off the monitor and turn it back on when you press a key or move the mouse.

Sure, no one in their right mind is going to bother writing this every time they want to turn off the monitor. The solution?

How to make the execution of this command easier? Easy…

There are several options, the best being 3.

1) Create a launcher on the panel: right click on the top panel and choose the option Add to panel. Then select Custom application launcher. Fill in the fields the way you like the most. In command, paste the above command.

2) Create a launcher on the desktop: right click on the desktop and choose the option Create a launcher. The rest is the same as the previous option.

3) My preference, assign a key combination to execute the command: go to System> Preferences> Shortcut keys. Click the button Add and paste the above command. Then, select the newly created entry and assign it the key combination you like best.

4) Suppose you are a terminal lover, you can create an "alias" for our magic command to run quickly.

I opened a terminal and wrote:

echo "alias chaumon = 'xset dpms force off'" | tee -a ~ / .bashrc> / dev / null

Ready, when you want to turn off the monitor, just type "chaumon" in a terminal. 🙂


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   duckwlmc said

    Thank you, as I always love your post, they are excellent, complete and very useful, keep it up, and congratulations

  2.   santi8686 said

    Excellent!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  3.   Julian arming said

    Very very good command, quite interesting 🙂

  4.   nickd said

    Hi, how do I do if I have two monitors?
    thanks for the input

  5.   nickd said

    xrandr --output VGA-1 --off
    VGA-1
    may vary
    run the xrandr command to see which one is available, if applicable

  6.   Richard Oliveros said

    run the command option 4 and now the terminal closes every time I want to open it. Can you help me fix this?

  7.   Rodrigo R. said

    Hello, "xset" no longer exists, how do I turn off the screen from Console?