Raspberry Pi_Eng_06.3.2 System Termination in Terminal


Published Book on Amazon


All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1
All of IOT Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2


출판된 한글판 도서


최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상)
최신 라즈베리파이(Raspberry Pi)로 시작하는 사물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하)


Original Book Contents


6.3.2     System Termination in Terminal

 

6.3.2.1       "shutdown" Command

 

The "shutdown" command shutdown the entire system normally.

 

It waits until all tasks that are currently running are terminated, and then terminates the entire operating system when all tasks are terminated. When the system is shut down, all operations on the system are terminated, all network connections are terminated, and the logon users are disconnected.

 

The effect of this termination is applied not only for a specific user, but for all users who use the system. Therefore, if several users logon to the system and they are working, even if the users try to do another operation without interruption, all users' operations are forcibly terminated.

 

[Command Format]

shutdown    [option]  time  [warning-message]

 

[Command Overview]

   This shuts down system normally.

   User privilege          -- Super user.

             

 

[Detail Description]

   When this command is executed, all tasks are stopped, all users are logoffed, all network connections are disconnected, and the system is finally shut down.

 

[Main Option]

-k

don't really shutdown, only warn.

-r

reboot after shutdown.

-h

halt after shutdown.

-f

do a 'fast' reboot (skip fsck).

-c

cancel a running shutdown.

-t secs

delay between warning and kill signal.

time

When to shutdown.

warning message

Message to send to all users.

 

[Used Example] 

Bellow is an example of running the "shutdown" command.

 

pi@raspberrypi ~ $ sudo shutdown now

Broadcast message from root@raspberrypi (pts/0) (Sun Jun 14 11:25:44 2015):

The system is going down to maintenance mode NOW!

 


 

6.3.2.2       "halt" Command

 

The "halt" command essentially shuts down the entire system just like "shutdown". The difference is that "shutdown" normally shuts down the system, but "halt" forcibly shuts down the system.

 

Forcibly terminating the system means that it forcefully terminates all tasks in the current state rather than waiting for them to exit normally when there are currently running tasks. The result of this command is basically the same as "shutdown" except for the difference above.

 

[Command Format]

halt   [option]

 

[Command Overview]

   This forcibly terminates the system

   User privilege          -- Super user.

 

[Detail Description]

   When this command is executed, all tasks are forcibly stopped, all users are logged off, all network connections are disconnected, and the system is finally shut down.

 

[Main Option]

-w

Don't actually reboot or halt but only write the wtmp record (in the /var/log/wtmp file).

-d

Don't write the wtmp record.

-f

Force halt or reboot, don't call shutdown(8).

-i

Shut down all network interfaces just before halt or reboot.

-h

Put all hard drives on the system in stand-by mode just before halt or power-off.

-p

When halting the system, switch off the power. This is the default when halt is called as poweroff.

 

 

[Used Example] 

Below is an example of running the "halt" command

 

pi@raspberrypi ~ $ sudo halt

Broadcast message from root@raspberrypi (pts/0) (Sun Jun 14 11:38:32 2015):

The system is going down for system halt NOW!

 


 

6.3.2.3       "poweroff" Command 

 

This is a combination of halt and power off features of operating system. That is, this shut down the entire operating system with the "halt" command, and power off the system when the system shutdown is complete.

 

Raspberry Pi system does not provide an external power switch in hardware, and there is no device to shut off the power internally. Therefore, even if the operating system is shut down, the power remains in the supplied state, and actually the power off function does not work The execution result of this command is basically the same as "halt" except for the difference above.

 

[Command Format]

poweroff   [option]

 

[Command Overview]    

   This forcibly terminates the system and shut off the power supply.

   User privilege          -- Super user.

 

[Detail Description]

   When this command is executed, all tasks are forcibly stopped, all users are logged off, all network connections are disconnected, and the system is finally shut down.

 

[Main Option]

-w

Don't actually reboot or halt but only write the wtmp record (in the /var/log/wtmp file).

-d

Don't write the wtmp record.

-f

Force halt or reboot, don't call shutdown (8).

-i

Shut down all network interfaces just before halt or reboot.

-h

Put all hard drives on the system in stand-by mode just before halt or power-off.

-p

When halting the system, switch off the power. This is the default when halt is called as poweroff.

 

[Used Example] 

Below is an example of running the "poweroff" command

 

pi@raspberrypi ~ $ sudo poweroff

Broadcast message from root@raspberrypi (pts/0) (Sun Jun 14 11:58:50 2015):

The system is going down for system halt NOW!

 

 


 

6.3.2.4       "reboot" Command 

 

This is a combination of halt and boot capabilities of operating system. This forces the current operating system to shut down and reboot the operating system.

 

When you run this command, the basic effect is the same as above "halt" in the sense that the current system is terminated. However, there is a feature here that the system is completely shut down and then the system is restarted through booting again. The execution result of this command is basically the same as "halt" command except for the difference above.

 

[Command Format]

reboot   [option]

 

[Command Overview]

   This shuts down the currently running system and boots the system again.

   User privilege          -- Super user.

 

[Detail Description]

   When this command is executed, all tasks are forcibly stopped, all users are logged off, all network connections are disconnected, and finally the system is shut down and then booted again.

 

[Main Option]

-w

Don't actually reboot or halt but only write the wtmp record (in the /var/log/wtmp file).

-d

Don't write the wtmp record.

-f

Force halt or reboot, don't call shutdown (8).

-i

Shut down all network interfaces just before halt or reboot.

-h

Put all hard drives on the system in stand-by mode just before halt or power-off.

-p

When halting the system, switch off the power. This is the default when halt is called as poweroff.

 

 

[Used Example] 

Below is an example of running the "reboot" command.

 

pi@raspberrypi ~ $ sudo reboot

Broadcast message from root@raspberrypi (pts/0) (Sun Jun 14 11:58:50 2015):

The system is going down for system halt NOW!

 


 

6.3.2.5       "logout" Command 

 

The "logout" command is to terminate processing for a particular user who is logged on to the system, leaving the entire operating system intact.

 

Therefore, all the jobs that the specified user has been processing are stopped, and when all designated jobs are stopped, all the system resources used by the user are released, and the system is disconnected from the user.

 

The effect of this termination affects that specific logout user only, and not to any other users at all. As a result, other users can continue working without interruption.

 

[Command Format]

logout

 

[Command Overview]

   User privilege          -- Super user.

 

[Detail Description]

   When a specific user logs out like this, according to the connection method, the connection with the system may be broken or the connection may remain in a state where another user can logon.

   If you connect to Shell Terminal from local, returns to the screen befor logon.

   If you connect to the Shell Terminal remotely through the network, the connection program is terminated.

   You can not run logout on the Terminal of the window.