Reboot machine gracefully from CLI?

There was something about it here: https://discuss.kde.org/t/logout-reboot-and-shutdown-using-the-terminal/743/4