How to Shutdown your Linux Machine from Terminal

M

Microsuck

Guest
Go into .bashrc and add this:

Code:
quit ()
        {
            poweroff -d
         }

Then in Terminal, you can type:

Code:
sudo quit
 


you can use the commands listed here
tuxthink.blogspot.com/2012/01/different-commands-to-shutdown-or.html
 
I don't understand why you complicate your life with script.
su
halt
or
su
shutdown -h now
 
I usually use sudo shutdown -h now if I can't shut the machine down with the GUI. I don't see why we need a quick command for this.
 
It's best to memorize commands and use programs that you can use on all linux machines.. that way if you're on someone else's machine - or a machine you've never been on.. you can get whatever it is you want done. Also, learn everything from command line.

shutdown: shutdown -r now

editor: vi / vim ;)

(i'll never install emacs on the linux boxes at work.. at least once/week i hear "aww.. isn't emacs on here?")
 
An error has occurred D! You must have 5 posts in order to post links. Your current post count is 4.
WHY WHY WHY!!!!!!!!!!!!!!!!!!!!!!!!
 
An error has occurred D! You must have 5 posts in order to post links. Your current post count is 4.
WHY WHY WHY!!!!!!!!!!!!!!!!!!!!!!!!

This is to try to keep out spambots. They love to post links.
 
Thank you

But I really want to know how make a spam, that's seem very interesting, ah?!
 
I don't understand why you complicate your life with script.
su
halt
or
su
shutdown -h now

Why make a script to do this? There are a couple of reasons that come to mind. First, you may want a script to launch at a certain time. You may not be there to type in the command.

Second, you may make a launcher for the script in case the machine is being stubborn. When I upgraded from Ubuntu 10.10 to 12.04, selecting shutdown only logs me out. Even at the log in screen, I am no longer able to shutdown or restart, it just leaves me at the log in prompt. I could write a short script with a launcher to bypass this problem until I fix it. If I hadn't already made up my mind to switch to Fedora, I would have probably chosen that option rather than opening a terminal each time to type in the commands.
 
If ever needed, i always do sudo shutdown now, or sudo restart now
 
If ever needed, i always do sudo shutdown now, or sudo restart now

same. Most of the time I will just leave my machine running. I'm not that dedicated to that one so I think everything turns out okay and I haven't had many issues.
 
same. Most of the time I will just leave my machine running. I'm not that dedicated to that one so I think everything turns out okay and I haven't had many issues.

I also leave my machine running all the time. It's rare that I do shut it down or restart it, except for updates.
 
Easier methods:

  • sudo shutdown # shuts down system with a delay
  • sudo shutdown -r # restarts system with a delay
  • sudo shutdown now # shuts it down immediately
  • sudo shutdown -r now # restarts immediately
 

Members online


Latest posts

Top