reboot Command in Linux with Examples

This tutorial explains Linux “reboot” command, options and its usage with examples.

reboot command is used to stop the system and then reboot it.(requires root privileges)

Synopsis :

reboot [-n] [-w] [-d] [-f] [-i]

OPTIONS:
-n
Prevent the sync before reboot or halt.
-w
Don’t actually reboot or halt but only write the wtmp record (in the /var/log/wtmp file).
-d
Don’t write the wtmp record. The -n flag implies -d.
-f
Force halt or reboot, don’t call shutdown.
-i
Shut down all network interfaces just before halt or reboot.

If reboot is called when the system is not in runlevel 6, in other words when it’s running normally, shutdown will be invoked instead (with the -r flag).

Hence immediate reboot can also be used as

advertisement
advertisement
$ shutdown -r now

Once system processes have been killed and filesystems have been unmounted, the system reboots automatically. This is done using the reboot command, which syncs changes to disks and then performs the actual reboot.

On Linux, if reboot is run when the system has not already started the shutdown process, it will invoke the shutdown command automatically rather than directly performing its intended action. However, on systems such as FreeBSD, these commands first log the action in wtmp and then will immediately perform the halt/reboot themselves, without first killing processes or unmounting filesystems.

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

For example :

$ reboot

This is an immediate reboot.

advertisement

OR

To reboot it with a custom, 30 minute advance warning:

$ shutdown -r +30 "Planned Reboot"

Sanfoundry Global Education & Learning Series – 1000 Linux Tutorials.

advertisement
If you wish to look at all Linux commands and their usage examples, go to Linux Commands Tutorial.

If you find any mistake above, kindly email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.