1

When listed down the running processes, I can see several processes like 'chrome', 'notepad', 'intellij', 'sublime editor' etc.. are having "tty = ?"

  1. Then how are they able to read the input from a keyboard?
  2. Is TTY always related to terminals/cli?
0

XWindows applications receive keyboard and mouse input from the X Server, and display things through the X Server. It is unusual for these applications to have a controlling terminal (the tty column) unless they are started from a command line that has a controlling terminal.

There are really only a few XWindows applications that need a controlling terminal or input or output redirection. Amongst them are xclip, xev, xprop, xwininfo, xkill, xlsfonts, xlsclients and xlsatoms. Of those, only one displays a window and three can temporarily change the cursor.

It is actually more common for an XWindows application to host a tty. xterm and every other terminal application provides a tty to the shell or other programs running "inside" it.

Finally, note that the X Server itself usually DOES (at least in Linux) have a terminal associated with it. This is more so that it can fit into the virtual consoles than anything else, but it does allow the keyboard and mouse to be switched between the X server and the other virtual consoles.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.