Wednesday, June 18, 2025

X.org (X system) 停止作用

跳到文字介面(console): Ctrl Alt F1 ~ F6 ,登入後輸入 /etc/init.d/lightdm stop 重新啟動 /etc/init.d/lightdm start 或是 service lightdm start 跳回圖形介面(windows): Ctrl Alt F7 ------------------------ To stop the X Window System (and return to the command line), you can use the command sudo systemctl stop display-manager if you are using a systemd-based distribution like Ubuntu or Fedora. Alternatively, on some systems, pressing Ctrl+Alt+Backspace will force-stop the X server. Detailed Explanation: 1. Identifying the Display Manager: Most modern Linux distributions use a display manager (like GDM, LightDM, or SDDM) to start the X server and handle graphical logins. The systemctl command is used to manage system services, including the display manager. 2. Stopping the Display Manager: If your system uses a display manager, you can stop it using sudo systemctl stop display-manager. This will typically log you out of the graphical session and return you to a text-based console. If your system uses a different display manager, replace display-manager with the specific name (e.g., sudo systemctl stop gdm, sudo systemctl stop lightdm). 3. Using the Keyboard Shortcut (Ctrl+Alt+Backspace): On some systems, pressing Ctrl+Alt+Backspace will immediately kill the X server and return you to the console. This is a quick way to exit the graphical interface without logging out or stopping the display manager. This shortcut may be disabled by default on some distributions, and you might need to re-enable it if it's not working. 4. Alternative Method (init levels/runlevels): In the past, systems would use different "runlevels" or "init levels" to start or stop the X server. While less common now, you might see this referred to. For example, sudo init 3 might switch you to a text-based console (though systemd handles this differently in most cases). 5. Checking for Graphical Login: If you're not sure if X is running, you can check if you have a graphical login screen or a graphical desktop environment. If you are already at a text-based console, X is not running, and you don't need to stop it.