What Is a Controlling Terminal in Linux?
You may have heard the term “controlling terminal” used in relation to Linux processes. You might be confused about what a controlling terminal is. Fortunately, a controlling terminal is easy to understand.
What Is a Controlling Terminal?
A controlling terminal is a terminal where a Linux process starts. For example, if you run a command from the shell, the terminal window where you entered the command is the controlling terminal.
Processes launched with controlling terminals inherit attributes of the parent terminal. This is due to the way processes are launched in Linux. When you run a command, the shell makes a copy of itself, or “forks,” then replaces itself with the program you wanted to run, or “execs.”

How to See Which Processes Have a Controlling Terminal
It’s easy to see processes that have a controlling terminal in Linux. You can usethe ps commandto see them.
you’re able to see all processes belonging to all users on the system, whether or not they have controlling terminals, by using the“aux”argument:

Because this generates a lot of output on Linux systems, it can be helpful to pipe it into a pager, such as less:
you could also view the first few lines using the head utility:

In the output, you’ll see a column labeled “TTY.” This indicates a process’s controlling terminal, if there is one. A process with a controlling terminal will display “ttyx” where “x” is the terminal number or “pts”, followed by a slash (/) and the pseudoterminal line number.
Since most terminals are actually terminal emulators, they use pseudoterminals or PTYs. The “pts” indicates a terminal emulator rather than a physical terminal orvirtual console.

Processes Without Controlling Terminals
On most Linux systems, the TTY column will display aquestion mark(?) character in many processes. This is because the process does not have a controlling terminal. Why does this happen?
Linux systems run a lot of daemons, or services, in the background. These can be servers, such as a web server, as well as daemons that do lots of basic things like running your network connection. These don’t need to use a terminal, so they just run without one.

If you launch a graphical app from a desktop environment’s menu, that won’t have a controlling terminal either.
Terminal multiplexers like GNU Screen or tmux allow you to detach a process. If you log out but keep your system running, you may find that that process also lacks a controlling terminal.
If you have a process without a controlling terminal that you want to get rid of,you can use the kill utility.
Now You Know About Controlling Terminals
A controlling terminal is a terminal you launched a command from. It’s easy to see which processes do and don’t have a controlling terminal with the ps command. And many Linux programs don’t, either because they’re daemons or you may have detached them with a terminal multiplexer.
Multiplexers like tmux not only make local terminal sessions persist across logins, but they are also powerful tools for remote SSH connections.
Improve your remote access to Linux devices over SSH with Mosh and run multiple sessions with Tmux.
Freeing up vital memory on Windows only takes a moment, and your computer will feel much faster once you’re done.
Don’t let aging hardware force you into buying expensive upgrades.
Small formulas, big time savings.
It saves me hours and keeps my sanity intact.
The key is not to spook your friends with over-the-top shenanigans.