Ubuntu – How many tty and pts are running on the pc

guitty

I found that more pts can be created this way.

  1. To reboot into text mode-tty1

  2. to input startx to jump into gui mode.
    To enter terminal in the gui mode started from tty1 to inupt.

      tty    
      /dev/pts/0  
    

this gui is pts/0

  1. to input ctrl+alt+f2 to jump into
    another text mode-tty2
  2. to input startx to jump into gui mode, this gui is pts/1.

To enter terminal in the gui mode started from tty2 to inupt

    tty
    /dev/pts/1  

Now two gui modes can be created.
How to know how many tty and pts are running at the same time on my pc?

Every gui program–include virtual terminal in gui is the client(or say slave) of x-server(or say x window system) ,so it was called pesudo terminal slave.

Muru give me many new knowledge,maybe there is a wrong expression in muru's explaination.
something about pts from other view

In my opinion,the proper sentence would be that:
but that's an application program in X server started from the tty1, but also a pts.

Please see the discuss here on what is pts/0 and (:0.0) in linux when typing who am i

quoting from an answer

From the knowledge,i draw my conclusion.

It not only an X server started from the tty1, but also a pts.

Best Answer

this gui is pts/0

Um, nope. I'm not sure where you got pts/0 from, but that's an X server started from the tty1, it isn't pts/0. See this U&L post for more.

At any given time, by default, there are 6 TTYs with getty running on them (so that you can login there) - TTYs 1-6, which you can access using CtrlAltF1-F6. TTY 7 has the GUI started by default. On 16.04 and above, you can start more getty instances using:

systemctl start getty@ttyN

Replacing N with an appropriate number.

To find the number of pseudoterminals currently open, you can do:

ps -eo tty= | sort -u

ps -e lists all processes, and -o tty= lists the process TTYs without a header line. sort and get unique entries with -u. For example:

$ ps -eo tty= | sort -u
?
pts/0
pts/1
pts/2
tty1
ttyS0
Related Question