[Solved]How to make a script/shortcut for shutdown button

nuclear4future

New Member
Joined
Mar 31, 2022
Messages
4
Reaction score
3
Credits
35
Hello all.

Basically the tittle.
When I was on Windows 10 I could make a notepad file with a shutdown instruction and then save it as .bat and then I can execute the shortcut and shutdown my computer from an icon on the desktop.
If this helps:
I have Linux OpenSuse Leap 15.3 KDE and the kernel is that:
5.3.18-150300.59.60-default
I know what is Terminal, I can basically copy and paste a text in Python if this is any help.
Even after many months I still feel like a noob.


If you need additional info or I am missing something please tell me.

Thank you.
 
Last edited:


Ctrl+alt+T
no sudo:
type this in terminal ===== shutdown wait 5 sec and it will shut your pc down
or to cancel shutdown -c
for Debian/ubuntu/mint
Screenshot from 2022-03-31 01-21-53.png
 
you can do everything in terminal the best part about Linux.

If you download anything type in sudo apt update followed by sudo apt full-upgrade
Or you just want to make sure your up to date
 
Save it as example: shutdown.sh
after that use chmod on terminal to make it executable

edit: You can save it on desktop
 
Last edited:
Save it as example: shutdown.sh
after that use chmod on terminal to make it executable

edit: You can save it on desktop
When I run this executable: shutdown.sh it doesn't run it
When I run it under terminal ./shutdown.sh and then asks me about my password
My questions are this:
How can I just click on the shutdown.sh executable and make it run without me running the terminal.
How can I make the executable so it has my password and I don't have to type it every time I would like to shutdown my PC?
That is what is under my .sh now:
sudo shutdown because only with shutdown it say "command not found".
 
You can actually (hopefully) go about that with this little number:


Basically, you're granting regular users the rights to access and shutdown without a password. (Method #1, number 4 should do the trick.)
 
Thank you all for your comments and suggestions!
I got it working and I am happy!
Have a great day!
 
Glad it's sorted and thanks for marking it as solved. The great thing about that is people finding the thread via search will know there's a resolution in this thread.
 

Members online


Top