An interactive login session can have a controlling terminal: a terminal device associated with the session and used by the kernel for terminal-generated signals and job control. The TTY field in process listings helps identify that association.
Processes · Lesson 2
Controlling Terminal
Learn how controlling terminals connect sessions to interactive input, signals, and shell job control.
Terminal and Pseudo-Terminal Devices
The name TTY comes from historical teletypes. On modern Linux, terminal interfaces are device abstractions rather than necessarily physical equipment.
A system virtual console can appear under a name such as tty1. Desktop shortcut assignments for switching consoles vary by distribution and should not be assumed. A terminal emulator, remote login, or multiplexer commonly uses a pseudo-terminal pair, with the interactive side shown under a name such as pts/3.
Display the terminal connected to the current command's standard input with:
$ tty
/dev/pts/3
This result is related to, but not identical with, the broader controlling-terminal concept. A process can redirect standard input or output while remaining in a session that has a controlling terminal.
What does a name such as pts/3 usually identify?
Sessions, Process Groups, and Job Control
A controlling terminal belongs to a session, not merely to the command that happened to open a window. Within that session, the terminal tracks a foreground process group. The shell places a foreground pipeline into that group so it can read input and receive terminal-generated signals.
For example, pressing Ctrl-C normally makes the terminal driver send SIGINT to the foreground process group. A background group that tries to read from the terminal can receive SIGTTIN. These rules allow the shell to coordinate foreground and background jobs.
To which processes does a terminal normally direct the signal generated by Ctrl-C?
Reading the `TTY` Column
Request selected process fields explicitly when you want a stable view:
$ ps -o pid,tty,stat,cmd
A terminal name such as pts/3 identifies the controlling terminal recorded for that process. A question mark (?) normally means that the process has no controlling terminal.
Many service processes have no controlling terminal because a service manager starts them independently of an interactive login session. However, a missing TTY does not by itself prove that a process is a daemon, and a background shell job can still have a controlling terminal.
What does ? in the ps TTY column normally mean?
Terminal Closure and Hangups
When a terminal connection disappears, the kernel or terminal/session software can send SIGHUP to associated processes. A process may terminate, catch the signal, ignore it, or already have been arranged to survive it. Shell features such as disown, utilities such as nohup, multiplexers, and service managers all affect lifecycle behavior.
Therefore, closing a terminal does not guarantee that every command started from it will exit. Inspect the process's session, signal handling, redirections, and supervisor when persistence matters.
Why is it inaccurate to say that closing a terminal always terminates every process started there?
The Manage and Monitor Linux Processes lab provides a safe environment for comparing foreground jobs, background jobs, and their TTY fields.
Lesson complete
You finished Controlling Terminal
You can now relate a controlling terminal to interactive process management.
Distinguish virtual terminals from pseudo-terminals.
Connect terminal signals with the foreground process group.
Interpret terminal names and
?inpsoutput.Treat terminal closure as signaling, not guaranteed process termination.
Keep your learning progress
Create a free account to save this lesson and continue learning on any device.
Create a free account