4.5 Shutting Down

_Do not just turn off the computer! You risk losing valuable data!_

If you are the only user of your computer, you might want to turn

the computer off when you’re done with it.

To avoid possibly weakening some hardware components, only turn off

the computer when you’re done for the day. Power up and power down

are the two greatest contributors to wear and tear on computer

components. Turning the computer on and off once a day is probably

the best compromise between your electric bill and your computer’s

lifespan.

It’s a bad thing to just press the power switch when you’re done

using the computer. It is also bad to reboot the machine (with the

Reset button) without first taking proper precautions. The Linux

kernel, in order to improve performance, has a disk cache. This

means it temporarily stores information meant for permanent storage

in RAM. Because memory is thousands of times faster than a disk,

this makes many file operations move more quickly. Periodically, the

information Linux has in memory is actually written to the disk.

This is called _syncing_. In order to turn off or reboot the

computer safely, you’ll have to tell the computer to clear

everything out of memory and put it in permanent storage.

To reboot, just type reboot or press Ctrl-Alt-Del (that’s Ctrl, Alt,

and Delete).

To shut down, you’ll have to log in as root. As root, just type the

command shutdown -h now. The sytem will go through the entire

shutdown procedure, including the sync command, which clears the

disk cache as described above. When you see System halted, it’s safe

to turn off the computer. If you have Advanced Power Management

(APM) support in your kernel and BIOS, the computer might shut

itself off and save you the trouble. APM is common in laptops and is

also found in certain desktop mainboards.

Debian GNU/Linux : Guide to Installation and Usage · 第 77 / 193 题