This video, we are going to talk about something curious, a blast from the past that is called
virtual terminals.
Now let's get back to the 1990s.
In the 1990s, computing often worked on a centralized supercomputer, where so-called
dump terminals were connected to this one supercomputer, allowing different users to
work simultaneously on the same computer.
Now we don't have dump terminals anymore in current Linux, but we have virtual terminals,
and I would like to tell you about virtual terminals.
So let's remind, a terminal is the environment that runs a shell.
And in the graphical environment, multiple terminals can be used on the same screen.
In a text-based environment, one terminal is started from the console.
If you want to work as different users in the same text-based environment, the virtual
terminal can be used to start additional terminal sessions.
And these terminal sessions are accessible by using the Control-Alt-Function-Key keyboard
sequences, or alternatively, using the chvt command, which can be used to open a different
virtual console.
You do need root privileges to use these virtual terminals.
Now once you are in these virtual terminals, you can use who or w to get an overview of
current users that are active on which terminals.
And you can use chvt to change between the different virtual terminals.
Let me show you.
So to start with, I'm typing the command who.
And the important thing is that we can see user student currently logged in to tty2.
tty2 is the name of the terminal device that you are currently looking at.
So it's your graphical user interface.
Now behind this tty2, there's up to six virtual terminals that can be accessed using chvt tty number.
tty3, for instance.
Let's see how this is working out.
And oh boy, I'm getting couldn't get a file descriptor referring to the console.
That's not very specific, is it?
So let me try to switch to a virtual terminal, chvt 3.
I want to switch to terminal number 3.
And there I'm getting an error message, couldn't get a file descriptor referring to the console.
That's not very specific.
But let's fix it by repeating the last command by using control A to move my mouse cursor
to the front of the command line and putting sudo in front of it.
So here it is prompting for my login name.
So I'm going to log in as user student with my very secret password.
And now if I use W, I can see that there's a user student on tty3 as well.
And you can repeat it.
And that is convenient because if you're in a console only mode, then you can test things
in one virtual terminal and have a log open in another virtual terminal.
And if you have the keyboard controls, you just use control alt function key to toggle
between the different virtual terminals.
In my virtual machine, chvt is the only thing that I can use because virtualization is capturing
the control alt key sequences.
So I'm going to use chvt number 2 to get back to terminal number 2.
And as you can see, now I'm back in my graphical user interface.
But W is still showing that user student is still logged in in tty3.
And this can be a convenient way to get access to different terminals at the same time.