If you are an Ubuntu user, you might have observed the dialog box that gets displayed when you quickly press and leave the power button. The dialog box contains icons to Lock, Suspend, Restart, and Shutdown the system.
Have you ever found yourself wondering how this box can be launched from the command line? Well, if that's what you want to know (or do), you'll be glad to know that we'll be discussing a solution in this tutorial.
Please note that all the commands and instructions mentioned in this article have been tested on Ubuntu 14.04 LTS.
Yes, gnome-session-quit is a command that lets you do this. All you have to do is to execute the command with the '--power-off' command line option:
Here's the command in action:
There are several other options that the command provides, including --logout and --reboot. For more details, head to the command's man page.