[click to continue…]
Q. I’ve just installed Ubuntu Linux on my computer. I’d like to know – how to shutdown Ubuntu box over ssh session?
A. If you are not using GUI, you can run halt or shutdown command to powerdown box.
shutdown arranges for the system to be brought down in a safe way. All logged-in users are notified that the system is going down and, within the last five minutes of TIME, new logins are prevented. The shutdown utility provides an automated shutdown procedure for supersers to nicely notify users when the system is shutting down, saving them from system administrators, hackers, and gurus, who would otherwise not bother with such niceties.
How do I use shutdown command?
The shutdown command can be used to turn off or reboot a computer. Type the command as follows to shutdown server / computer immediately:
$ sudo shutdown -h now
$ sudo shutdown -h 0
How do I shutdown compute at specific time?
To shutdown computer at 6:45pm, enter:
$ sudo shutdown -h 18:45 "Server is going down for maintenance"
At 6:30pm message will go out to all user and 6:45 system will shutdown.
Please note that you can also use halt or poweroff or reboot command for stopping and restarting the system:
$ sudo halt
$ sudo poweroff
How do I reboot computer?
Simply use reboot command:
$ sudo reboot
$ sudo shutdown -r 0
Q. How do I boot my Ubuntu Linux server into Rescue mode to fix system?
A. You can boot Ubuntu Linux into rescue mode when things go wrong, there are several ways to work on fixing them. However, you must understand your system and what to fix in case of emergency.
Use this mode only if your system is unbootable. It is also recommended that you make backup of important data.
=> Start Computer / reboot computer
=> Put your Ubuntu install CD
=> Make sure BIOS is set to boot from CD
=> Now booting will start from Ubuntu install CD
=> You will see various option screen – select Recover a broken system
You will system is booting in to rescue mode; system will ask about Network and other information. This is required to setup rescue environment.
Now you will prompted to select root partition or device.
Next it will try to mount root device and it will notify the same.
Now you will see common rescue mode option such as Reinstall GRUB or open / execute a shell etc.
Now you are in rescue mode and you need to use your own knowledge to rescue the system. When things go wrong, there are several ways to work on fixing them.
Few things to remember….
The rescue-mode CD mounts your root filesystem at /target directory. Open or execute a shell and change directory to /target
# ls /target
# cd /target
If you need to run fsck command use fdisk -l command to find out partition name. Usually they are located at /dev/discs/discX/partY. For example repair 2nd partition (not mounted as /target) you may type command:
# ls -l /dev/discs/disc0
# fsck.ext3 /dev/discs/disc0/part1
To exit type command :
# sync ;sync
As I said earlier in rescue mode, there is no single command that I can recommend to fix problem. You need to use your own knowledge to rescue the system and don’t forget to read command documentation before using any command.