From discussions on Wednesday night’s TechNet and emails with Bob (WA7YNU), it appears that the difference between a virtual console and a virtual terminal deserves more discussion. While both allow you to enter commands, they are different.
If you were to boot your Linux box in text mode, you would be presented with a virtual console window. The current virtual console is where the kernel sends its messages. openSUSE is an exception to this rule, it that it sends the kernel messages to virtual console 10. So, how many virtual consoles are there? It all depends on the system configuration. Fedora and openSUSE use the traditional Unix method of defining the terminals in the /etc/inittab file. You can display the available terminals by running the following command:
grep mingetty /etc/inittab
Debian based systems use the /etc/event.d directory in place of the /etc/inittab file. To see what virtual terminals are available, you can run the following command:
ls -d /etc/event.d/tty*
On most systems, you will see that there are six virtual consoles. When you boot the system in the text mode, you are automatically presented a login prompt for tty1 (the first virtual console). You can switch virtual consoles by simply pressing the CTRL+ALT+Fn keys, where Fn ranges from F1 to F6. You can log into all six virtual consoles, and run separate applications in each console. When you boot the system in text mode, you cannot run graphical applications as this run level does not start a graphical display manager.
Many users boot their system in a graphical mode. In the graphical mode, you can start a virtual terminal application that opens a terminal window. Since this is a graphical window, the kernel does not directly send any messages to this window. This is important when trying to debug drivers. Each desktop environment has its own virtual terminal application:
- Gnome — terminal
- KDE – konsole or yakuake (my favorite)
- Xfce – terminal (not the same as the gnome terminal application)
These virtual terminal applications allow you to create a number of tabs, which are separate instances of the shell. You can also open multiple instance of the virtual terminal application, it self. The only limit is memory and the per user process limit.
From the graphical environment, you can still access the virtual consoles by entering CTRL+ALT+Fn, as describe previously. You will have to log into an account, as switching to a virtual console is like logging in as another user. To return to your graphical environment, you need to press the CTRL+ALT+F7 keys at the same time. If I mess up my graphical screen, I switch to a virtual console, and then back to the graphical environment. It usually works.
If you boot the system in text mode, you cannot run graphical applications. If you boot in the graphical mode and switch to a virtual console (or, open a virtual terminal), you can run graphical applications from the command line, by simply entering the name of the command. For example, you can run the cwcp command (see the last article on cw applications) by just entering:
at the shell prompt. I prefer to add the & at the end of the command, so that I get the shell prompt back. The one big advantage of starting graphical applications from the command line is that you get to see any error messages. Again, a great way to debug any application problems.
So you booted the system in the text mode, and want to run graphical applications. All is not lost. You can log into an account, and start the graphical mode by entering the following command:
This command will start the default graphical environment for the account. Of course, this only works if you installed a graphical environment. Even though I may only run the system in the text mode, I will do a graphical install to insure that the graphical environment is available. Installing a graphical environment after the fact is not a lot of fun, and requires a good understanding of what packages are required.
So you are in a virtual console or a virtual terminal, how do you get out? The commands are as follows:
- CTRL+D – You just told the shell that there is no more input, which closes the shell.
- exit – A shell command that causes the shell to terminate execution.
- logout – This command only works in a virtual console, as you are closing the login shell.
In addition, a virtual terminal can be closed like any other graphical application. This method essentially sends a kill signal to the shell.