How to enter centos command line

Source: Internet
Author: User

In the centos interface switch issue, many people may be used to entering the character work mode for operations. So how do I switch to the character working mode? Below we will introduce three methods to enter the character work mode:

In the graphic environment, enable the terminal window to enter the character working mode. After the system starts, it directly enters the character working mode. Use remote login (Te lne T or SSH) to enter the character working mode.

Virtual console
After you directly enter the character working mode when the system starts, the system provides multiple (6 by default) virtual consoles. Each virtual console can be used independently without affecting each other. You can use Alt + F1 ~ Alt + F6 switch between multiple virtual consoles. If you use the startx command to start the graphical environment on the centos page, you can use c trl + ALT + F1 ~ C TRL + ALT + F6 switch character virtual terminal, use c trl + ALT + F7 to switch to the graphic interface.

Local logon and logout
Login: Enter the user name (such as root) and password (PWD) on the logon terminal. Log out: You can enter the logout command on the current logon terminal or use the + shortcut key.

Log on to a remote Linux System Using SSH in a Linux environment. The SSH command in Linux is the client program of o pe nssh. To log on to the remote Linux system, make sure that the o pe nssh server is started on the remote Linux system. Use SSH
The command format for logging on to the remote o pe nssh server is: $ username on the SSH remote host @ IP address or FQDN of the remote host

Go to the centos page and enter
The Linux system runs on a specified running level at any time, and different running-level programs and services are different. The work to be done and the purpose to be achieved are different. Centos sets the running level as shown in the following table, and the system can switch between these running levels to complete different tasks. Running description
0. All processes will be terminated, and the machine will be stopped in an orderly manner. when the machine is shut down, the system will be in this running level.
1. single-user mode. Used for system maintenance. Only a few processes run and all services are not started.
2-user mode. Like Level 3, the Network File System (NFS) service is not started.
3 multi-user mode. Allows multiple users to log on to the system, which is the default startup level of the system.
4 left to the user's custom running level
5-user mode. After the system is started, run X-window to provide a graphical logon window.
6. All processes are terminated and the system restarts.
1. if you enter the character logon centos page after the system starts, the default running level is 3. If you enter the graphical logon centos page after the system starts, the default running level is 5.
2. If you have enabled the centos page, you can run the following command to access the centos page:
$ Startx &

View and switch at run level
You can use the following command to view the running runlevel of the current system. You can use the following command to switch the running level init [0123456ss], that is, the init command is followed by a parameter, this parameter is the runtime code to switch to, for example:
Use the init 0 command to switch to the running level 0, that is, shutdown
Use the init 1 command to switch to running Level 1, that is, enter the single-user running mode
Use the init 6 command to switch to running Level 6, that is, restart
You can also use the Te linit command. In centos, the Te linit command is the symbolic link of the init command.

Here is an example of using the 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", but the previous running level does not exist (represented by "N)
# Init 2
# After executing the "init 2" command, the system console displays the information about stopping the service.
# Runlevel
3 2
# The current running level of the system is "2", the last running level is "3", and the conversion operation level is successful

You can also use the shutdown and restart command to go to The centos page.
When the system is shut down and restarted, the operation level is switched. You can use the init command to shut down and restart the instance. The init command is used to immediately shut down or restart the instance. However, in a multi-user system, if you want to send a shutdown warning to each user to complete their work and log out, you must use shutdown, halt, and RE boot
.

In a multi-user environment, the shutdown command is usually used to close and restart the system. The shutdown command can shut down the system in a safer way. All users logging on 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 be notified that the system will shut down, so that some programs, such as VI, will be able to save the files edited by the user in time and exit.

The format of the shutdown command is: shutdown [parameter] time [WARNING-message]
Time: Specifies how long the shutdown command will be executed. The following three formats can be used:
Hh: mm: Specifies the absolute time. hh is used to specify the hour, and m is used to specify the minute.
+ M: Specifies the relative time. M is a number in minutes.
Now: it is now in progress, equivalent to + 0
Warning-message: used to set the warning information sent to the user.

Common centos interface parameters are as follows:
-T sec: the number of seconds between sending a warning message and deleting the message before notifying init to execute a Run-level switch.
-K: The system is not really shut down, but a warning message is sent to each user.
-R: Shut down and restart the system.
-H: Shut down and stop the system.
-F: fsck is not required to check the disk after the disk is restarted.
-F: Force fsck to check the disk after restart

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 ."
# Immediately shut down the system
# Shutdown-H now
# Immediately restart the system and force the fsck to check the disk after the restart
# Shutdown-H-F now

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.