Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Brand new to Linux. I need to turn my box off and put it in my server room. The help here and everywhere seems not to work for me:

http://debianhelp.co.uk/shutdown.htm

I get:

lukepuplett@uktnlx01:~$ poweroff
-bash: poweroff: command not found
lukepuplett@uktnlx01:~$ shutdown
-bash: shutdown: command not found
lukepuplett@uktnlx01:~$ modprobe apm
-bash: modprobe: command not found
lukepuplett@uktnlx01:~$

I also tried halt, reboot, goaway, and pleasejustwork.

share|improve this question
    
I laughed at pleasejustwork. Thanks ;-) –  gniourf_gniourf Dec 2 '12 at 11:00
    
The shutdown command is not accessible to a non-superuser by default as it's in /sbin/ rather than in /bin/ or /usr/bin/. The former is not normally added to the $PATH of a regular user. –  Shadur Feb 27 '13 at 10:59
add comment

2 Answers

up vote 6 down vote accepted

You need to be root (or use sudo):

$ # This halts (shuts down) the computer now
$ sudo shutdown -h now

$ # This reboots the computer now
$ sudo shutdown -r now

Read the manual page for shutdown: man shutdown for more information.

In the link you gave, you just overlooked the sentence

simply run as root:

share|improve this answer
    
Thank you. I will lookup sudo and root permissions. Why does it act like the command doesn't exist? –  Luke Puplett Dec 2 '12 at 17:22
    
@LukePuplett The shutdown command is in the /sbin directory, which is not in your path. It is hence not found by bash when you're calling it while not being root. Compare which shutdown (no output) with sudo which shutdown (output is sbin/shutdown). –  gniourf_gniourf Dec 2 '12 at 17:24
    
Command halt or reboot could be prefered, (at least from version 6 of Debian). As If halt or reboot is called when the system is not in runlevel 0 or 6, in other words when it's running normally, shutdown will be invoked instead (with the -h or -r flag). see man halt. –  F. Hauri Dec 29 '12 at 17:52
    
@F.Hauri In most distributions, halt and reboot are low-level commands, and shutdown is the high-level one. I prefer using the high level one, that takes time to run clean-up scripts, etc... in some distributions (e.g., Debian), but not all, halt and reboot do call shutdown... so what's the point? Anyway, my preference is really for shutdown. –  gniourf_gniourf Dec 29 '12 at 18:11
    
Of course you're right, but as question stand clearly for a Debian Linux box, this could be mentioned (maybe with remark about restricted solution). At all, the test if runlevel == 6 || runlevel == 0 could become a standard in all Linux distrib in a near futur (if not already)... ( I guess ;-) –  F. Hauri Dec 29 '12 at 18:18
add comment

halt run as root or sudo halt if you are on the sudoers list, should do the trck.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.