Currently our Linux operating system boots to this login screen.
Now,
tens of programs need to be loaded some of them in a
very specific order so that we can get to this screen.
Now, how does Linux know how to do this
with the help of what are called systemd targets?
When the operating system boots up,
it takes a look at what the default systemd target is
and we can check for ourselves what target
is currently set as default with this command
system CTL get default.
The name graphical dot target suggests that the operating
system is configured to boot into a graphical environment.
The file,
graphical dot target contains instructions about what
needs to happen to arrive at this target
by reading this. The operating system knows what programs it needs to launch
in what order to boot this target booting
into a graphical target is pretty demanding.
If we don't need our operating system to load up a graphical user interface,
we can change the default boot target,
multiuser dot target also turns on network services.
So the machine will have access to the internet and the local network.
Let's reboot the machine and see what happens
now that we've changed the default boot target.
OK?
Now we get the text based login console
instead of the previous graphical login screen.
Let's log in
and we're here and this is an entire text based interface.
Now imagine we want to get back to our graphical desktop.
Maybe we need to use a 3D modeling application for an hour
instead of changing the default boot target and then rebooting,
we can immediately switch into a different target without rebooting.
And we can switch back to the graphical target with this command.
This will load up all the graphical applications and
we get access to our graphical user interface.
Now it's important to note that this does not change our default boot target.
If we reboot this machine, we'll be dropped into a text based console again
because our multiuser target that we previously set is the default.
This is just to temporarily boot up the graphical user interface.
Other targets that might be useful are emergency dot target and rescue dot target.
Now emergency dot target will load up as few programs as possible.
And this can be useful for debugging in case the programs
that are loaded by other targets are making the system unstable.
If you boot into this target, the root file system will be mounted as read only
in rescue dot target.
A few essential services are loaded and you're
dropped into what's called a root shell.
Simply put a few more programs are loaded than emergency target,
but fewer than are loaded in multiuser target.
In this root shell,
you can type commands as the system administrator create database backups while
the database is not online fix settings and things like that.
It's important to note that to be able to use these targets,
you must have a password set for the root user.
If the root user has no password,
then you cannot use these targets as long as you log in as root.
And that concludes this demo.