24

My desktop system is:

$ uname -a
Linux xmachine 3.0.0-13-generic #22-Ubuntu SMP Wed Nov 2 13:25:36 UTC 2011 i686 i686 i386 GNU/Linux

By running ps a | grep getty, I get this output:

  900 tty4     Ss+    0:00 /sbin/getty -8 38400 tty4
  906 tty5     Ss+    0:00 /sbin/getty -8 38400 tty5
  915 tty2     Ss+    0:00 /sbin/getty -8 38400 tty2
  917 tty3     Ss+    0:00 /sbin/getty -8 38400 tty3
  923 tty6     Ss+    0:00 /sbin/getty -8 38400 tty6
  1280 tty1     Ss+    0:00 /sbin/getty -8 38400 tty1
  5412 pts/1    S+     0:00 grep --color=auto getty

I think ttyX processes is for input/ouput devices but I am not quite sure. Based on this I am wondering that why there are 6 ttyX processes running? I have only one input devices(keyboard) actually.

xanpeng
  • 5,725

2 Answers2

26

This shows because one getty process is running on each virtual console (VC) between tty1 and tty6. You can access them by changing your active virtual console using Alt-F1 through Alt-F6 (Ctrl-Alt-F1 and Ctrl-Alt-F6 respectively if you are currently within X).

For more information on what a TTY is, see this question, and for information on virtual consoles, see this Wikipedia article.

Chris Down
  • 125,559
  • 25
  • 270
  • 266
6

A Linux machine (running with SystemV) defines a special file, /etc/inittab that declares (but not only) how many *getty processes will run and their corresponding terminals. E.g. this is an excerpt of inittab on my Gentoo Linux machine:

# TERMINALS
c1:12345:respawn:/sbin/agetty --noclear 38400 tty1 linux
c2:2345:respawn:/sbin/agetty 38400 tty2 linux
c3:2345:respawn:/sbin/agetty 38400 tty3 linux
c4:2345:respawn:/sbin/agetty 38400 tty4 linux
# Wanting only four terminals!
#c5:2345:respawn:/sbin/agetty 38400 tty5 linux
#c6:2345:respawn:/sbin/agetty 38400 tty6 linux

What makes agetty appear on the first terminal, for example, is the tty1 argument that is passed to agetty. you can limit the number of consoles on which you can type your login by commenting out the corresponding lines in inittab, i.e put a hash (#) sign on the beginning of the lines.

On my machine I have reduced it to only 4 consoles on which I can login. It is best to at least have one of these active, just in case something goes wrong with the graphic login manager (if you have one).