Saturday 5 April 2014

How to Shutdown or Restart from Terminal in Red Hat Linux 6.0

linux tutorial

Linux is all about terminal.Linux user are more comfortable using terminal rather than GUI. So I am. I am so lazy that I hardly use any GUI command,  so every other day I try to find out alternative of gui interaction. This commands I came with as a newbie in linux, when I feel tired of shutting down or restarting my machine.

Suppose you are logged in as a normal user say:

user1@localhost ~]$

Now you need to switch to root user using switch user command
The command is

su -

Shell prompt you to enter rot user password like this

user1@localhost ~]$ su -
password:

Type your password and press enter.

Now you are switched to root user.

root@localhost ~]$ 

Type this command to shutdown

 root@localhost ~]$  init 0

Now to restart machine command is 

 root@localhost ~]$  init 6

There is  another way where you can do the same task without switching to root.. Just need to enter the command as su.

For shutdown 

 root@localhost ~]$ su -c "init 0"
 password:
 Type your password and press enter.



For restart.

 root@localhost ~]$ su -c "init 6"
password:
 Type your password and press enter.
  
Thats all done.

No comments: