Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: shutdown via command line

  1. #1

    Default shutdown via command line

    uhh..When I type shutdown -r now I get this

    Code:
    -bdmf:~> sudo shutdown -r now
    root's password:
    sudo: shutdown: command not found
    do I need to download a library of commands for bash?

  2. #2
    Join Date
    Jan 2008
    Location
    U.K East Anglia
    Posts
    2,581

    Default Re: shutdown via command line

    try su - should sort that

    Andy
    To be is to do = Immanuel Kant
    To do is to be = Descartes.
    Do be do be do = Frank Sinatra

    SuSE user since 7.0,Linux user since 1994

  3. #3
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: shutdown via command line

    Try

    Code:
    sudo /sbin/shutdown -r now
    When you run sudo you are still using your $PATH which usually doesn't have /sbin in it. On some distros, like Ubuntu, it does, which is why it may work there without the /sbin for you.

    In any case, if you intend to allow this in sudoers, you will need to specify the full path for shutdown.

  4. #4
    Join Date
    Jun 2008
    Location
    United States
    Posts
    423

    Default Re: shutdown via command line

    If that doesn't work, try:

    su -c 'shutdown -r now'
    Simply enter the root password when prompted and that will reboot your system.


    Folding@Home
    Help save lives with Folding@Home

  5. #5

    Default Re: shutdown via command line

    Quote Originally Posted by ken_yap View Post
    Try

    Code:
    sudo /sbin/shutdown -r now
    When you run sudo you are still using your $PATH which usually doesn't have /sbin in it. On some distros, like Ubuntu, it does, which is why it may work there without the /sbin for you.

    In any case, if you intend to allow this in sudoers, you will need to specify the full path for shutdown.
    got it,,thanks guys!

  6. #6
    Shimmey NNTP User

    Default Re: shutdown via command line

    Quote Originally Posted by Unseen-Ghost View Post
    If that doesn't work, try:



    Simply enter the root password when prompted and that will reboot your system.

    I never saw this way to shutdown. Could you say something more about it in detail, please? Thanks!

  7. #7
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: shutdown via command line

    > I never saw this way to shutdown. Could you say something more about it
    > in detail, please? Thanks!


    he said:

    Code:
    --------------------
    su -c 'shutdown -r now'
    --------------------

    which shuts down your computer....the first part

    Code:
    --------------------
    su -c
    --------------------

    is a command used at the user's command line to Switch User (su)
    the command's "-c" specifies that after switching user, the shell
    will THEN run the following command..

    that following command in THIS case is

    Code:
    --------------------
    shutdown -r now
    --------------------

    which is a command root can use to Reboot (-r) or Halt (-h) the
    system now, or at some later time..

    in a terminal, see man shutdown for MORE on that command..

    see man su for more on that command

    SUSE is a pretty OS when run like most folks run Windows[tm], but it
    is AWESOME the way geeks use the CLI (command line interface)

    join the fun.

    --
    DenverD (Linux Counter 282315) via NNTP, Thunderbird 2.0.0.14, KDE
    3.5.7, SUSE Linux 10.3, 2.6.22.18-0.2-default #1 SMP i686 athlon

  8. #8

    Default Re: shutdown via command line

    shutdown -r now -> this is not a shutdown, this restarts the pc, no ?

    To reboot, use the command reboot
    To shutdown the pc, use the command halt

  9. #9
    ab@novell.com NNTP User

    Default Re: shutdown via command line

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    'man reboot'

    halt apparently sends 'shutdown -h'
    reboot apparently sends 'shutdown -r'

    Good luck.





    LRE wrote:
    > shutdown -r now -> this is not a shutdown, this restarts the pc, no ?
    >
    > To reboot, use the command *reboot*
    > To shutdown the pc, use the command *halt*
    >
    >

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.2 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

    iD8DBQFIsG1O3s42bA80+9kRAlYhAJ4oEszwLKK6sGS8SfOnuJY6QzjRkACfR/HF
    /PFIBLCDlnimt1mT3NM9nr0=
    =Y1vj
    -----END PGP SIGNATURE-----

  10. #10

    Default Re: shutdown via command line

    I have always used
    Code:
    "init 0" or "sudo init 0"
    which will shut the pc down. I have only had to use sudo on Ubuntu. but that command has worked for me for 4 different distros

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •