Linux study notes (12) -- login, logout and shutdown

This article takes CentOS7this as an example.

Directory structure of this article

Linux study notes (12) -- login, logout and shutdown.png

1 Login and logout
1.1 Login
  • Linux is a multi-user and multi-tasking operating system, and then use *system administrator** to configure the account to enter the system.
  • When logging in, try to log in with the root account as little as possible to avoid misoperations with excessive permissions.
  • If you need rootpermissions, you can log in as a normal user and then use su- 用户名the command to switch to the system administrator identity.
1.2 Log out user
logout
  • Note: This command is not valid at the graphics run level and is valid at run level 3 .

2 Shut down and restart
2.1 Shut down immediately
shutdown -h  now
Shut down after 2.2 N minutes
shutdown -h [N]  
2.3 Restart the computer immediately
 shutdown -r now 
  • Among them:
    hRepresentative halt
    rRepresentativereboot
2.4 Shutdown
halt    
2.5 Restart the computer immediately
reboot
2.6 Synchronize memory data to hard disk
sync
2.7 Special attention
  • When restarting or shutting down the system, the command is first executed syncto write the memory data to the disk to prevent the loss of important data.

おすすめ

転載: blog.csdn.net/qq_22255311/article/details/126353860