Can I shut the computer down via the power button?

anotherwindowsuser

Well-Known Member
Hi,

I have linux ubuntu, the 20.04 version, anyway, I want to be able to use screen lock as a safety feature for when I leave the computer so it locks itself and have the ability to shut the computer down properly using the power button saving me the effort of turning the monitor on, putting in my password, then clicking shutdown.. Can I do this and if so how? Thanks in advance.
 

riserbo

Member
Yes, this should be perfectly safe. Just hold the power button for a few seconds until it turns off. There is a large misconception that doing this is somehow unsafe, but in today's age it is absolutely fine.
 

nmsuk

Windows Forum Admin
Staff member
Premium Supporter
No doing that can lead to corrupted files or filesystem. Dangerous posts like will get you removed.
 

nmsuk

Windows Forum Admin
Staff member
Premium Supporter
Yes, this should be perfectly safe. Just hold the power button for a few seconds until it turns off. There is a large misconception that doing this is somehow unsafe, but in today's age it is absolutely fine.
He wants to cleanly shutdown not just kill the power. Shakes head
 

Mike

Windows Forum Admin
Staff member
Premium Supporter
win10-shutdown.gif
 

riserbo

Member
No doing that can lead to corrupted files or filesystem. Dangerous posts like will get you removed.
Actually, this isn't quite the case anymore. It's true that this practice led to filesystem damage with older computers, and that's because the power button used to cut power directly from the computer's hardware, causing a literal "shutdown". Nowadays, though, pressing the power button will signal your computer to shut-down properly. You can, of course, also set what the power button does manually.

I think what you mean is that using the power button can be inconvenient because it won't give you the option to cancel during the shutdown process (which is unfortunate if you didn't save any files you were working on). The shutdown process typically purges your computer's cache, so anything that wasn't written onto the disk will be gone. This isn't a problem if all open files were saved before pressing the power button, though, and the same cache-purging occurs during manual shutdowns as well.

A power-button shutdown is no less "clean" than a manual shutdown from the system menu. I'd encourage you to do some reading on this topic here. Unless anotherwindowsuser owns a computer from the 90s or earlier, they should be absolutely fine using this method. If you still consider our post dangerous, you're more than welcome to remove us.

Also - Mike, your gif is depicting a Windows shutdown procedure. anotherwindowsuser specifically requested a method for Linux Ubuntu version 20.04. Shakes head.
 

Neemobeer

Cloud Security Engineer
Staff member
Pressing and holding the power button will signal the system to power off immediately, pressing the power button and letting it go will signal the operating system to shut down properly. Most modern operating systems have journaling and can recover from power losses, but it is generally not a good practice to power the system all of the time with the power button (press and hold).
 

bassfisher6522

Essential Member
May I interject here: The very first sentence of the OP thread states that OP is using Linux and posted in the linux forum. The subsequent replies are all for windows.

That said, is there a difference in the shut down procedure for Linux vs Windows. I"m not a Linux user so I don't know. I'm merely pointing out the difference.
 
Actually, this isn't quite the case anymore. It's true that this practice led to filesystem damage with older computers, and that's because the power button used to cut power directly from the computer's hardware, causing a literal "shutdown". Nowadays, though, pressing the power button will signal your computer to shut-down properly. You can, of course, also set what the power button does manually.

I think what you mean is that using the power button can be inconvenient because it won't give you the option to cancel during the shutdown process (which is unfortunate if you didn't save any files you were working on). The shutdown process typically purges your computer's cache, so anything that wasn't written onto the disk will be gone. This isn't a problem if all open files were saved before pressing the power button, though, and the same cache-purging occurs during manual shutdowns as well.

A power-button shutdown is no less "clean" than a manual shutdown from the system menu. I'd encourage you to do some reading on this topic here. Unless anotherwindowsuser owns a computer from the 90s or earlier, they should be absolutely fine using this method. If you still consider our post dangerous, you're more than welcome to remove us.

Also - Mike, your gif is depicting a Windows shutdown procedure. anotherwindowsuser specifically requested a method for Linux Ubuntu version 20.04. Shakes head.

No, this is incorrect and unsafe. To do what you're explaining, the power button only needs to be pressed instantaneous. That will trigger the operating system to shut down the same as through the user interface. Computers aren't mobile phones where the primary shutdown method is long pressing the power button.

If you press it for longer than 4 seconds, the UEFI/BIOS will intervene and force everything off. If you have an SSD, you are asking for catastrophic corruption. SSDs erase and rewrite entire blocks containing existing data when modifying any contents within, storing the blocks in volatile cache while rewriting. If the power is cut while writing to most consumer SSDs, blocks being rewritten will be destroyed. If those blocks contained the mapping tables, the entire SSD can be bricked.

Fortunately, your statement about it being "safe in today's age" is true for HDDs, but only if done sparingly. Newer HDDs have power loss protection, which uses spindle momentum to generate electricity for swinging the actuator arm off the pristine platter before the disk spins down. This can be done around 20,000 times before the HDD wears out, when disks normally tolerate 600,000 cycles. With older HDDs the actuator arm would just jam into the platters in whichever position the actuator was the moment power was cut.
 

anotherwindowsuser

Well-Known Member
May I interject here: The very first sentence of the OP thread states that OP is using Linux and posted in the linux forum. The subsequent replies are all for windows.

That said, is there a difference in the shut down procedure for Linux vs Windows. I"m not a Linux user so I don't know. I'm merely pointing out the difference.


The problem is which perhaps people have also overlooked is that whilst you can cleanly shut down whilst logged into either linux or windows by pressing the power button, pressing the power button does not shut the computer down cleanly if you are not logged in as that requires some kind of privileges.
 
Top