Find out how to reboot and shut down the system, if you ever need to.
- [Instructor] Usually, your system should not need to be rebooted or shutdown, but now and then it's necessary. Some software updates still require rebooting, and if you need to change hardware, of course you'll need to shutdown your computer to do so. Rebooting the system and shutting down a system differ from just holding down the power button or pulling the cable out of the wall, in that they involve processes that the system goes through to make a clean shutdown. Among other things, a proper shutdown procedure notifies processes to finish their operations in an organized way. This can mean that data from buffers and caches gets written to disk instead of just being lost like it might be with an abrupt lack of power.
Shutting down tells the system to notify processes to finish up their work and exit, and then bring the system down and turn off. Rebooting does all of this, but instructs the system to start back up, or boot, after the shutdown process has completed. To restart the system, I can write sudo shutdown -r, and as I can see here, that has scheduled a shutdown for a minute from now, and notified all the users on the system that the system will be going down. I can cancel that with sudo shutdown -c if I want to not continue.
If you're working on a multi-user system, it's polite to let people know that you're taking the system down, and provide a grace period for users to save their work. If you want to set a time, you can add a number after the command, representing minutes, or you can give the command in a 24 hour notation like 17:00, if you want the system to shutdown at 5 p.m. That looks like this. Sudo shutdown -r, and 17:00. This will restart the system at 5 p.m. local time, but I'll cancel that.
If you know that no one else is logged in or you need to take the system down immediately, you can add now to the end of the command to remove any waiting period between issuing the command and the system going through the shutdown procedure. There's also a command called reboot, but it's considered legacy so you should use shutdown instead, just like this. Sudo shutdown -r now.
Now with my system back up and running, let's take a look at shutting down instead. Rather than using -r for reboot, I'll use -h for halt. It used to be that halt and shutdown were different options, but now halt is just a synonym for shutdown. With -h, I can specify the same options, with the number of minutes to wait, a time, or just now. So let's shut this system down now. I'll write sudo shutdown -h now.
- Exploring a system
- Exploring load and uptime
- Auditing security access, groups, and users
- Checking memory and process status
- Checking free disk space and disk status
- Interrupting and exploring the GRUB boot loader
- Gaining root access
- Exploring recovery options
- Upgrading software
- Freeing disk space
- Adding a disk
- Setting up a logging server
- Building a summary script