Home > Article > System Tutorial > How to use character interface and window mode in CentOS
In the CentOS interface switching problem, many people may be accustomed to entering the character working mode to operate. So how do you switch to character working? Below we will introduce 3 methods to enter the character working mode: Let’s take a look!
Open a terminal window in a graphical environment to enter character working mode. Enter character working mode directly after system startup. Use remote login mode (Te lnet or SSH) to enter character working mode.
Virtual Console
When the system starts up and enters the character working mode directly, the system provides multiple (default is 6) virtual consoles. Each virtual console can be used independently without affecting each other. You can use Alt F1 ~ Alt F6 to switch between multiple virtual consoles. If the user uses the startx command to start the graphical environment in the character CentOS interface, then you can use C trl Alt F1 ~ C trl Alt F6 to switch to the character virtual terminal, and use C trl Alt F7 to switch to the graphical interface.
Local login and logout
Login: Enter the user name (such as root) and password (pwd) on the login terminal. Logout: The user can enter the logout command on the current login terminal or use shortcut keys.
Use ssh to log in to the remote Linux system in the Linux environment. The ssh command under Linux is the client program of OpenSSH. To log in to a remote Linux system, you must ensure that the OpenSSH server is started on the remote Linux system.
The command format to use the ssh command to log in to the remote O pe nSSH server is: $ ssh username on the remote host@IP address or FQDN of the remote host
Entering the character CentOS interface can be entered from the system run level
Linux system runs on a designated run level at any time, and the programs and services of different run levels are different, and the work to be completed and the purpose to be achieved are different. Centos has set up run levels as shown in the following table, and the system can switch between these run levels to complete different tasks. Run level description
0 All processes will be terminated, the machine will stop in an orderly manner, and the system will be at this run level when shutting down
1 Single user mode. For system maintenance, only a few processes are running, and all services are not started
2 Multi-user mode. Same as run level 3, except that the Network File System (NFS) service is not started
3 Multi-user mode. Allows multiple users to log in to the system, which is the default startup level of the system
4 Leave it to user-defined runlevels
5 Multi-user mode, and run X-Window after the system starts, giving a graphical login window
6 All processes are terminated and the system is restarted
1. If the system enters the character login CentOS interface after startup, it means that the system's default run level is 3; if the system enters the graphical login CentOS interface after startup, it means the system's default run level is 5.
2. If the user has started the character CentOS interface and wants to enter the graphical CentOS interface, he can use the following command:
$ startx &
Run-level viewing and switching
Users can use the following command to view the runlevel runlevel of the current system. Users can use the following command to switch the runlevel init [0123456Ss]. That is, the init command is followed by a parameter. This parameter is the runlevel code of the runlevel to be switched to. ,like:
Use the init 0 command to switch to run level 0, that is, shut down
Use the init 1 command to switch to run level 1, that is, enter single-user running mode
Use the init 6 command to switch to run level 6, that is, restart
You can also use the te linit command. In CentOS, the te linit command is a symbolic link to the init command.
Let’s look at an example of using runle ve l and init commands:
# # Display the current running level of the system
# runlevel
N 3
# # The current running level of the system is "3" and there is no previous running level (indicated by "N")
# init 2
# # After executing the "init 2" command, the corresponding stop and start service information will be displayed in the system console
# runlevel
3 2
# # The current running level of the system is "2", the last running level was "3", the running level conversion was successful
You can also use the shutdown and restart commands to enter the character CentOS interface
The shutdown and restart of the system are actually switching the run level. This time you can use the init command to shut down and restart. The init command is used to shut down or restart immediately. However, in a multi-user system, if you want to send a shutdown warning message to users so that each user can complete their work and log out, you must use shutdown. , halt and reboot commands
make.
In a multi-user environment, the shutdown command is usually used to shut down and restart the system. The shutdown command can shut down the system in a relatively safe way. All users logged in to the system will be notified that the system will be shut down, and new login operations will be blocked; at the same time, all processes will also be notified that the system will be shut down, so Some programs, such as vi, will be able to save user-edited files and exit immediately.
The format of the shutdown command is: shutdown [parameter] time [warning-message]
Among them: time: Set how long it takes to execute the shutdown command. You can use the following three formats:
hh:mm: Specify the absolute time, hh is used to specify the hour, m m is used to specify the minute
m: Specify the relative time, m is a number, the unit is minutes
now: Do it immediately, equivalent to 0
warning-message: used to set warning messages sent to users
Commonly used parameters for CentOS interface switching are as follows:
-t sec: How many seconds to delay between sending warning information and deleting information before notifying init to perform run-level switching
-k: Does not actually shut down the system, just sends a warning message to each user
-r: Restart the system after shutting down
-h: Stop the system after shutdown
-f: No need to check the disk with fsck after reboot
-F: Force fsck to check the disk after reboot
For example:
# # Warn all users that the system will restart in 5 minutes
# shutdown –r 5 “System will be reboot in 5 minites, Please save your work.”
# # Shut down the system immediately
# shutdown –h now
# # Reboot the system immediately and force fsck to check the disk after reboot
# shutdown –h -F now
The above is the detailed content of How to use character interface and window mode in CentOS. For more information, please follow other related articles on the PHP Chinese website!