Some time if you have a dedicated server or you have access to a server that have Linux as Operating System and you want to restart or reboot or shut down the computer you can do this from putty after you’re connected to that system. Since you are logged in with putty you have access to terminal. Well, connected with putty mean the same thing with terminal so all commands from putty will work on terminal too and vice versa.
How to remotely Reboot/Restart Linux System from Terminal
Firstly you have to know that REBOOT is some thing as RESTART and is different by SHUTDOWN. Well if you want to reboot you can type simple in putty:
reboot and the system will going to reboot.
--help work on any command that you don’t know how to use. For example:
command --help and you will get help for the command such as syntax and how to use..
If you want to know more you can take a look at usage of reboot, you can see that by writing in terminal
reboot --help :
reboot [-n] [-w] [-d] [-f] [-h] [-i]
-n: don't sync before halting the system
-w: only write a wtmp reboot record and exit.
-d: don't write a wtmp record.
-f: force halt/reboot, don't call shutdown.
-h: put harddisks in standby mode.
-i: shut down all network interfaces.
For example if you want to force reboot you can use this command:
How to shut down Linux with terminal/putty
You can simply use:
shutdown -h now or you can take a look at usage for more details and options as you can see bellow:
Usage: shutdown [-option] [-t time]
-a: use /etc/shutdown.allow
-k: don't really shutdown, only warn.
-r: reboot after shutdown.
-h: halt after shutdown.
-P: halt action is to turn off power.
-H: halt action is to just halt.
-f: do a 'fast' reboot (skip fsck).
-F: Force fsck on reboot.
-n: do not go through "init" but go down real fast.
-c: cancel a running shutdown.
-t secs: delay between warning and kill signal.//in seconds
** the "time" argument is mandatory! (try "now") **
Or if you want to show a message before shutdown you may use:
shutdown -h 10 "System is going to shutdown"
How to PowerOFF a System with Linux
You can halt the system, switch off the power. This is called as power off and poweroff command can be used as follows (warning: the following command will immediately shutdown the Linux system):
You know now how to remotely shutdown, reboot, power off a machine with Linux using terminal!
PS: If you want to see history of all shutdowns, reboots or power off you can use this commands:
last -x shutdown
Thant’s all for now!