How to Shutdown your Linux Machine from Terminal

Discussion in 'General Linux' started by Microsuck, May 27, 2012.

  1. Microsuck

    Microsuck New Member

    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    Go into .bashrc and add this:

    Code:
    quit ()
            {
                poweroff -d
             }
    Then in Terminal, you can type:


    Code:
    sudo quit
  2. tux.think

    tux.think New Member

    Messages:
    4
    Likes Received:
    2
    Trophy Points:
    0
    you can use the commands listed here
    tuxthink.blogspot.com/2012/01/different-commands-to-shutdown-or.html
  3. oldslackware

    oldslackware New Member

    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    I don't understand why you complicate your life with script.
    su
    halt
    or
    su
    shutdown -h now
  4. emma11

    emma11 New Member

    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
  5. lucasbytegenius

    lucasbytegenius New Member

    Messages:
    207
    Likes Received:
    8
    Trophy Points:
    0
    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.
  6. Rob

    Rob Administrator Staff Member

    Messages:
    573
    Likes Received:
    187
    Trophy Points:
    43
    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?")
  7. designer

    designer New Member

    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    An error has occurred D! You must have 5 posts in order to post links. Your current post count is 4.
    WHY WHY WHY!!!!!!!!!!!!!!!!!!!!!!!!
  8. Bill

    Bill New Member

    Messages:
    127
    Likes Received:
    5
    Trophy Points:
    0
    This is to try to keep out spambots. They love to post links.
  9. pane-free

    pane-free Active Member

    Messages:
    353
    Likes Received:
    83
    Trophy Points:
    28
    why not
    PHP:
    init 0
    ?
  10. designer

    designer New Member

    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    Thank you

    But I really want to know how make a spam, that's seem very interesting, ah?!
  11. Bill

    Bill New Member

    Messages:
    127
    Likes Received:
    5
    Trophy Points:
    0
    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.
  12. Bill

    Bill New Member

    Messages:
    127
    Likes Received:
    5
    Trophy Points:
    0
    It's a secret recipe. I could tell you, but...well, you know what would happen.
  13. Akendo

    Akendo New Member

    Messages:
    136
    Likes Received:
    7
    Trophy Points:
    0
    Shutdown? I don't shutdown a Linux!
  14. ntaloventi

    ntaloventi New Member

    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    on arch just type on terminal :
    $ sudo poweroff
  15. nubbix

    nubbix New Member

    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    0
    If ever needed, i always do sudo shutdown now, or sudo restart now
  16. lucasbytegenius

    lucasbytegenius New Member

    Messages:
    207
    Likes Received:
    8
    Trophy Points:
    0
    Um, I'm not sure you'd want to do that, the consequences are usually very bad.
  17. mudrock

    mudrock New Member

    Messages:
    18
    Likes Received:
    1
    Trophy Points:
    0
    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.
  18. invincible123

    invincible123 New Member

    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
  19. lucasbytegenius

    lucasbytegenius New Member

    Messages:
    207
    Likes Received:
    8
    Trophy Points:
    0
    I also leave my machine running all the time. It's rare that I do shut it down or restart it, except for updates.
  20. flotwig

    flotwig New Member

    Messages:
    23
    Likes Received:
    1
    Trophy Points:
    0
    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

Share This Page