Ubuntu Virtual terminals

Posted on 7:10 PM by Bharathvn

When Ubuntu boots in multi-user mode (runlevel 2, 3, or 5), six virtual consoles (known as tty1 through tty6) are created with text-based logins. If an X Window System desktop is running, X is probably running in virtual console 7. If X isn’t running, chances are you’re looking at virtual console 1. From X, you can switch to another virtual console with Ctrl+Alt+F1, Ctrl+Alt+F2, and so on up to 6. From a text virtual console, you can switch using Alt+F1, Alt+F2, and so on. Press Alt+F7 to return to the X GUI. Each console allows you to log in using different user accounts. Switching to look at another console doesn’t affect running processes
in any of them. When you switch to virtual terminal one through six, you see a login
prompt similar to the following:

Ubuntu 7.04 localhost tty2
localhost login:
Separate getty processes manage each virtual terminal. Type this command to see
what getty processes look like before you log in to any virtual terminals:

$ ps awx | grep -v grep | grep getty
4366 tty4 Ss+ 0:00 /sbin/getty 38400 tty4
4367 tty5 Ss+ 0:00 /sbin/getty 38400 tty5
4372 tty2 Ss+ 0:00 /sbin/getty 38400 tty2
4373 tty3 Ss+ 0:00 /sbin/getty 38400 tty3
4374 tty1 Ss+ 0:00 /sbin/getty 38400 tty1
4375 tty6 Ss+ 0:00 /sbin/getty 38400 tty6

After I log in on the first console, getty handles my login, and then fires up a bash shell:

$ ps awx | grep -v grep | grep tty
4366 tty4 Ss+ 0:00 /sbin/getty 38400 tty4
4367 tty5 Ss+ 0:00 /sbin/getty 38400 tty5
4372 tty2 Ss 0:00 /bin/login --
4373 tty3 Ss+ 0:00 /sbin/getty 38400 tty3
4374 tty1 Ss+ 0:00 /sbin/getty 38400 tty1
4375 tty6 Ss+ 0:00 /sbin/getty 38400 tty6
7214 tty2 S+ 0:00 -bash

Virtual consoles are configured in the /etc/event.d directory. A script appears for each virtual console, such as tty1 for the tty1 console, tty2 for the tty2 console, and so on.