Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to enter CentOS character interface and window mode

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to enter the CentOS character interface and window mode, I hope you will learn something after reading this article, let's discuss it together!

Open the terminal window in the graphic environment to enter the character working mode. Directly enter the character working mode after the system is started. Use remote login (Te lne t or SSH) to enter character working mode.

Virtual console

When the system boots directly into character mode, the system provides multiple (default is 6) virtual consoles. Each virtual console can be used independently and does not affect 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 under the character CentOS interface, you can use C trl+Alt+F1~C trl+Alt+F6 to switch the character virtual terminal and 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 the + shortcut key.

Use ssh to log in to the remote Linux system in the Linux environment. The ssh command under Linux is the client program of O pe nSSH. To log in to a remote Linux system, you must ensure that the O pe nSSH server is started on the remote Linux system.

The format of the command to log in to the remote O pe nSSH server using the ssh command is: $ssh user name on the remote host @ IP address of the remote host or FQDN

Access to the character CentOS interface can be accessed from the system run level

The Linux system runs at a specified run level at any time, and the programs and services of different run levels are different, and the work to be done and the purpose to be achieved are different. Centos sets the runlevels shown in the following table, and the system can switch between these runlevels to do different things. Run level description

0 all processes will be terminated, the machine will stop in an orderly manner, and the system will be at this running level at the time of shutdown

1 single user mode. For system maintenance, only a few processes are running, and all services are not started

2 multi-user mode. Like runlevel 3, except that the Network File system (NFS) service is not started

3Multiuser mode. Allows multiple users to log on to the system, which is the default startup level of the system

4 user-defined run level

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 boot, the default run level of the system is 3; if the system enters the graphical login CentOS interface after startup, the default run level of the system is 5.

two。 If the user has already started the character CentOS interface, you can use the following command to enter the graphical CentOS interface:

$startx &

Run-level viewing and switching

Users can view the runlevel runlevel of the current system by using the following command. Users can switch the runlevel init [0123456Ss] with the following command, that is, follow the init command with a parameter, which is the runlevel code of the runlevel to which you want to switch, such as:

Use the init 0 command to switch to runlevel 0, that is, shutdown

Use the init 1 command to switch to run level 1, that is, to enter single-user run mode

Use the init 6 command to switch to runlevel 6, that is, restart

You can also use the te linit command, which is a symbolic link to the init command in CentOS.

Let's look at an example of using the runle ve l and init commands:

# # display the current running level of the system

# runlevel

N 3

# # the current run level of the system is "3", and there is no last run level (represented 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 run level of the system is "2", and the last run level is "3". The transition to run level is successful.

You can also use the shutdown and restart commands to enter the character CentOS interface.

The shutdown and restart of the system is actually a switch of the run level. The init command can be used for shutdown and restart this time, and the command init is used to shut down or restart immediately, but 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 orders such as shutdown, halt and re boot.

Ling.

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 more secure way, and all users who log on to the system will be notified that the system is going to shut down, and new login operations will be blocked; at the same time, all processes will be notified that the system will be shut down, so that some programs, such as vi, will be able to save user-edited files and exit in time.

The format of the shutdown command is: shutdown [parameters] time [warning-message]

Where: time: set how long to execute the shutdown instruction. You can use the following three formats:

Hh:mm: specify absolute time, hh for hours, and mm for minutes

+ m: specify the relative time, m is a number, and the unit is minutes

Now: do it now, which is equivalent to + 0

Warning-message: used to set warning messages to users

The common parameters for CentOS interface switching are as follows:

-t sec: how many seconds to delay between sending warning messages and deleting messages before notifying init to perform a run-level switch

-k: don't really shut down the system, just send a warning message to each user.

-r: restart the system after shutdown

-h: stop the system after shutdown

-f: do not 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

# # restart the system immediately and force fsck to check the disk after reboot

# shutdown-h-F now

After reading this article, I believe you have some understanding of "how to enter the CentOS character interface and window mode". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report