If you just need to switch to text mode with no GUI stuff like the X server running, you can use systemctl
to get your machine to the so-called multi-user.target
:
sudo systemctl start multi-user.target
You revert this and get back to the desktop (graphical.target
) by either rebooting or by switching back manually in the same way as above:
sudo systemctl start graphical.target
If you really need a true runlevel change to 3, that can be done using the init
command, as @terdon pointed out in his comment:
sudo init 3
You can verify your current runlevel with the runlevel
command. It will output two letters: the left one is your previous runlevel, whereas the right one represents your current runlevel.
You go back to the desktop by setting the runlevel to 5 again:
sudo init 5
Important general notes for both methods:
Both switching to multi-user.target
or runlevel 3 will terminate the X server and kill all GUI applications and your desktop environment. Make sure you closed all sensible applications and saved your work before you start, otherwise their state will be lost!
Neither systemctrl start ???.target
nor init ?
do switch your active TTY. That means, if you run these commands from a terminal emulator on your desktop (normally on TTY7), you will be at a black screen afterwards (optionally with some debug output).
It's simply because the TTYs 8-12 are not connected to text consoles but reserved for video consoles to display GUIs. Only TTY 1-7 are text consoles.
So to operate in multi-user.target
or on runlevel 3, you have to switch to a text console TTY, e.g. by pressing Ctrl+Alt+F1 for TTY1. You get back to the desktop (TTY7) later after you returned to graphical.target
or runlevel 5 by pressing Ctrl+Alt+F7 respectively.
When you get to such a text console, note that you have to log in again first by typing your username and password as requested.
sudo init 3
work with systemd? – terdon Apr 06 '17 at 22:51