Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
By default, regular users do not have rights to shut down a Linux system. When desktop environments shut down the system from a menu, they assume root's rights to do so.
As root, you can issue this command to shut down the system from the command line.
as a regular user,
using $su -c "shutdown now" can make system shutdown, using root credential
Bringing the system down requires root privileges. For a detailed explanation of the multiple ways to properly shutdown your system (for halt or reboot), see the slackbook: http://www.slackbook.org/html/essent...-shutdown.html
I'll try to make an argument against powering down with sudo (though I also prefer using poweroff as opposed to telinit or shutdown).
A couple of Christmases ago, I went back home to see some family. I left my Arch work/development machine at home, into which I'd SSH every day. I also had the habit of using sudo shutdown -h now and, therefore, it was in my bash history. On Christmas day, due to a storm, we had crazy spotty internet and, when navigating my bash history, I accidentally hit enter when sudo shutdown -h now was to be shown (though it wasn't showing yet). Not having time to cancel it, due to the 'now' and the choppy connection, I spent the rest of the vacation having to put up with my family instead of back in Linux land.
Don't make the same mistake I did: either use HISTIGNORE or, better yet, avoid scary sudo commands when you can; prefer a login shell with separate bash history (and maybe HISTIGNORE on top of that).
I'll try to make an argument against powering down with sudo (though I also prefer using poweroff as opposed to telinit or shutdown).
A couple of Christmases ago, I went back home to see some family. I left my Arch work/development machine at home, into which I'd SSH every day. I also had the habit of using sudo shutdown -h now and, therefore, it was in my bash history. On Christmas day, due to a storm, we had crazy spotty internet and, when navigating my bash history, I accidentally hit enter when sudo shutdown -h now was to be shown (though it wasn't showing yet). Not having time to cancel it, due to the 'now' and the choppy connection, I spent the rest of the vacation having to put up with my family instead of back in Linux land.
Don't make the same mistake I did: either use HISTIGNORE or, better yet, avoid scary sudo commands when you can; prefer a login shell with separate bash history (and maybe HISTIGNORE on top of that).
Doesn't matter WHAT command form you use if you have something like that occur.
No offense, but why'd you even go see them if you wanted to play with your computer the whole time?
Doesn't matter WHAT command form you use if you have something like that occur.
No offense, but why'd you even go see them if you wanted to play with your computer the whole time?
Of course I didn't waste a trip across the country; the jab at spending time with family during the holidays was in jest. Still, it hopefully conveys a lesson well-learned.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.