Linux common commands (i) Linux switch, restart, and text interface and graphical interface interchange

Source: Internet
Author: User

1. Switch Machine reboot restart:

shutdown [-effhknr][-t seconds] [TIME] [warning message] Shutdown:
Shutdown [-effhknr][-t number of seconds] Time [Warning message] Shutdown:-C When executing"shutdown-h 12:50"command, just press +key to interrupt the shutdown instruction. -f do not perform fsck when restarting. -F perform fsck on restart. -h shut down the system. -K just sends out information to all users, but does not actually shut down. -N does not call the INIT program to shut down, but by shutdown itself. -r shutdown after reboot. -t< Number of seconds >How many seconds to delay between sending the warning message and deleting the message. [TIME] Set how long after the shutdown instruction is executed. [Warning message] information to be transmitted to all logged-in users. Such as: The system will shut down after 2 minutes and restart immediately, and send a message "Shutdowninch2m later ... "To all login users shutdown–r-T5+2Shutdowninch2m later

After 2 minutes, the system restarts automatically:

Such as: The system will shut down after 2 minutes and do not restart, and send the message "shutdown in 2m later ..." to all login users

Shutdown–h +2 in 2m later ...

After 2 minutes, the machine shuts down automatically and does not restart:

Close the machine now:

Shutdown-h now

2. Graphical interface and text interface switch:

A. Default toggle: Modify the Initdefault parameter in the/etc/inittab file to modify the default startup graphical interface or the text interface, 3 is the default entry text
Interface, 5 is the default to enter the graphical interface:

Vim Inittab:

Can see now is id:3, command mode, to switch the graphical interface, only need to change to 5:

After the modification, save and exit, so that the next time you restart the default will automatically enter the graphical interface:
Reboot (this time I found that the virtual machine does not have a graphical interface of the suite, so can not enter the GUI, for their own installation with the graphical interface suite
CentOS to use it)

After repeating the above operation, reboot: "There is a problem here, the CentOS 7 start-up is managed by SYSTEMD."

Cat /etc/inittab:


This needs to be modified as follows:

rm /etc/systemd/system/default.target First delete the file , ln -sf/lib/systemd/system/ graphical.target/etc/systemd/system/default.target Create a soft link and then reboot:

To switch to command mode again:

rm -rf/etc/systemd/system/default.targetln -sf/lib/systemd/system/multi-user.target/ etc/systemd/system/Default.targetb. Real-time switching: Systemctl isolate multi-user.target (or) Systemctl isolate Runlevel3.targetsystemctl isolate Graphical.target (or) Systemctl isolate Runlevel5.target "can also be directly startx"

Linux common commands (i) Linux switch, restart, and text interface and graphical interface interchange

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.