What is the proper command to shutdown or reboot the system safely? Is there a way to achieve this without invoking
There are a number of options availabe, the easiest I have found for shutdown is
sudo poweroff and for restart is
sudo reboot. In general you will need to root privileges to perform these commands (security control - prevents users from bringing a system down without privilege escalation) although if you really tire of typing sudo every time, you can create aliases
vim ~/.bashrc_aliases and add
alias poweroff="sudo poweroff" and
alias reboot="sudo reboot". You can substitute
vim with your favorite editor.
Edit: It was pointed out to me that the Desktop versions of Ubuntu 16.04 or greater no longer require
sudo to perform these commands, however the Server versions do. Thank you Zanna for pointing that out to me.