how can I put a button on the desktop to shutdown pc?

5,410
  1. Ctrl+Alt+T - Opens the terminal

  2. touch ~/Desktop/Shutdown.sh && chmod 755 ~/Desktop/Shutdown.sh - Creates Shutdown.sh and sets execute permission

  3. gedit ~/Desktop/Shutdown.sh - Opens the file in gedit.

  4. Copy and Paste the following line in gedit

    pkexec shutdown -P -h now
    
  5. Save the file and close gedit.

  6. As per this Answer, make sure that you can execute executable files.

  7. Now double click on Shutdown.sh file in the desktop. It would show something like this and enter the password.

enter image description here

It should shutdown your machine now.

Share:
5,410

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin about 1 year

    how can I put a button on the desktop to shutdown pc? I use Ubuntu 13.04 with unity. Thank you for a help

    • amc
      amc over 10 years
      Or select shutdown from the top right gear icon?
    • air-dex
      air-dex over 10 years
      You can also use the HUD by writing "Shutdown"'s translation into it and then select the option to do this.
  • Prajwal Dhatwalia
    Prajwal Dhatwalia over 2 years
    Isn't there a way to do this without having to authenticate every time you want to switch off the device?