2.9 KiB
GUI-or-CLI - Interfacce GUI e CLI per Linux
1. Switch between GUI and CLI
To switch to text mode (also known as command-line interface or CLI) in systemd-based systems, you can use systemctl set-default multi-user.target
to permanently change the default boot target. Alternatively, you can temporarily switch to text mode using systemctl isolate multi-user.target
.
Here’s a breakdown of how to switch to text mode:
1.1. 1. Checking the Current Default Target*
First, it’s helpful to know what your current default target is. You can check this with:
systemctl get-default
This command will display the current default target, which is likely graphical.target
if you’re currently in a graphical environment.
1.2. 2. Permanently Switching to Text Mode (Multi-User Target)
To make text mode the default target on boot, use the following command:
sudo systemctl set-default multi-user.target
After running this command, you will need to reboot your system for the change to take effect:
sudo systemctl reboot
Now, when your system starts, it will boot directly into text mode.
###3. Temporarily Switching to Text Mode (Using isolate) If you want to switch to text mode without changing the default, you can use the isolate command:
sudo systemctl isolate multi-user.target
This command will immediately switch your system to text mode without requiring a reboot. However, the next time you boot, it will revert to the default target (which you can set using set-default as described above).
1.3. 4. Switching Back to Graphical Mode
To switch back to graphical mode, you can use the following command (if you previously used set-default):
sudo systemctl set-default graphical.target
And then reboot:
sudo systemctl reboot
Or, if you used isolate, you can switch back with:
sudo systemctl isolate graphical.target
2. Important Notes
2.1. multi-user.target
This target represents a system with networking enabled but without a graphical interface (X server or Wayland).
2.2. graphical.target
This target represents a system with a graphical interface.
2.3. Reboot
When changing the default target, a reboot is necessary for the change to be applied.
2.4. Temporary changes
Using isolate provides a temporary change that is not persistent across reboots.
2.5. Closing Applications
Switching to text mode will terminate any running graphical applications. Make sure to save your work before switching.
Celestino Amoroso
celestino . amoroso @ gmail . com
