This recipe shuts down the Linux operating systems so that the Raspberry Pi can be powered off safely.
Before powering down the Raspberry Pi, it is important to first shut down the operating system so that all of the applications and services on the Raspberry Pi have completely finished writing to disk and are ready for the next boot.
External devices, such as hard disks, also need time to shut down and flush their buffers. The
shutdown
command also gives devices attached to the Raspberry Pi an opportunity to clean up and prepare for the next boot.
The following are the ingredients:
The Raspberry Pi should already be powered on and booted before starting with this recipe.
The following are the steps for shutting down the Raspberry Pi:
pi
as the username (the default password is raspberry
).The preceding screenshot shows the process of logging in to the Raspberry Pi with pi
as the username.
shutdown –h now
Shut down and halt the operating system. This command is privileged. Use the prefix sudo
to
run the shutdown
command as a privileged user.
The preceding screenshot shows how to shut down the Raspberry Pi.
Once the Raspberry Pi boots, it prompts for a username and a password. By default, the Raspbian Linux distribution has one user configured, the pi
user. This user's default password is raspberry
. The password for the pi
user can be changed using the raspi-config
command.
After login, the shutdown
command is executed with the –h
option telling the Raspberry Pi to halt the system (power it off) after the operating
system has shut down. The shutdown
command is privileged, so the sudo
command is used as a prefix to temporarily grant privileges.
The shutdown
command can also be used to reboot the system. Use the –r
option. Rebooting the system when logged in as the pi
user can be done with the following command:
sudo shutdown –r now
A number of synonyms exist for the shutdown
command including halt
, poweroff
, 'and reboot
.
http://manpages.debian.net/cgi-bin/man.cgi?query=halt
18.222.115.120