how to turn off your screen regardless of what you do on the keyboard or mouse
Well, for several reasons.
- Because you want to practice your typing skills.
- Because you need to type important things in a crowed space and you don't want others to see what you’re typing.
- Because you’re taking notes of your dreams at night and you don’t want the light of the screen to wake you further.
- Because you like testing crazy things.
First you have to install vbetool.
Find it on the Ubuntu Software Center or type the following on the command line:
Now what?Code:sudo apt-get install vbetool
Now you have to do several things. First, vbetool can only be run as root. So you have to add the command to the sudoers as a no password command.
From here (credit to whom the credit is due) we learn how to
So, in this case, you need to run on the terminalUse the NOPASSWD directive
You can use the NOPASSWD directive in your /etc/sudoers file.
If your user is called user and your host is called host you could add these lines to /etc/sudoers:
This will allow the user user to run the desired commands on host without entering a password. All other sudoed commands will still require a password.Code:user host = (root) NOPASSWD: /sbin/shutdown user host = (root) NOPASSWD: /sbin/reboot
Note! Use the command visudo to edit the sudoers file to make sure you do not lock yourself out of the system – just in case you accidentally write something incorrect to the sudoers file.
Using /etc/sudoers.d instead of modifying /etc/sudoers
As an alternative to editing the /etc/sudoers file, you could add the two lines to a new file in /etc/sudoers.d
This is an elegant way of separating different changes to the sudo rights and also leaves the original sudoers file untouched for easier upgrades.Code:/etc/sudoers.d/shutdown.
Note! Again, you should use the command visudo to edit the file to make sure you do not lock yourself out of the system:
This also automatically ensures that the owner and permissions of the new file is set correctly.Code:sudo visudo -f /etc/sudoers.d/shutdown
And we add thereCode:sudo visudo -f /etc/sudoers.d/vbetool
save the file. If everything is ok, we’re almost done.Code:your_user your_host = (root) NOPASSWD: /usr/sbin/vbetool
So now what?
Just add this 2 commands as 2 separate keyboard shortcuts. You can test the commands without that, but once you blank your screen, you will feel lost and won't know how to turn it back on. There’s a trick though, don’t worry.
To add keyboard shortcuts refer to your favorite Ubuntu flavor how to do it. I’m on Lubuntu, so I have to edit a file by hand. I’ll not enter on details about that here, there are other howtos here on how to achieve that.
As for the commands, to turn off add as shortcut:
And to turn it back on:Code:sudo vbetool dpms off
But hey, I know you’re like me and you want to try the commands without the shortcuts. Go on and blank the screen. HOW DO I TURN IT BACK ON?!? (c'mon, don't do it)Code:sudo vbetool dpms on
If you have a keyboard shortcut to suspend your computer, suspend the computer. Then wake him up. The screen will be back on again.
Enjoy your your new blind typing machine and write your dreams with the new found pen of your imagination.