Sometimes I would like to shut down in a hurry. By hurry I mean 5 to 10 seconds. Assume I can run any script with root privileges in tty which I've prepared beforehand, and after 5 or 10 seconds the power will go out. What's the best way to minimize the damage (like maybe unmounting all devices, or closing all open files)?
Anyway you can shutdown from terminal using the command,
sudo shutdown -h now
Afterwards you need to put your sudo password. Here is an answer describes how you can shutdown from terminal without entering password. To do so,
sudo visudo from terminal and add the following line:
%user_name ALL=(ALL) NOPASSWD: /sbin/poweroff, /sbin/shutdown
This allows you to run the above commands, using
sudo, however with no password.
sudo poweroff or
sudo shutdown -h now will now result in a password less shutdown.
If you want a step further ahead you can make a alias named
stopnow or whatever,
alias stopnow='sudo poweroff'
That would enable you to shutdown the system by only running
stopnow in terminal.
Alt+Print Screen+R,E,I,S,U. Then Power Button to shut down.
Will quickly and safely shut down a computer running Linux (Ubuntu). It is talking directly to the kernel, and can be used at anytime.
This is a modified version of REISUB. Since we don't want a restart, B is replaced with just shutting the computer down.