Questions tagged [controlling-terminal]

The "controlling terminal" is an attribute of a process that identifies the terminal device that affects it with regards to "job control". It typically affects processes that run inside a terminal or open a terminal device.

Filter by
Sorted by
Tagged with
1 vote
1 answer
171 views

Why can't bash map ^C to intr signal if invoked as init?

If I make the bash as the first process invoked (i.e as init), as a result it will display the following: init: cannot set terminal process group (-1): Inappropriate ioctl for device init: no job ...
user avatar
10 votes
2 answers
2k views

How can I redirect the output of a C program from /dev/tty to /dev/null?

Consider this sample C program which writes to /dev/tty and doesn't have command line options to make it not do so. #include <stdio.h> int main (void) { FILE* fout = fopen("/dev/tty&...
user avatar
3 votes
0 answers
446 views

Controlling terminal of a display server

When I login on a Fedora 31 workstation and run the ps command, I see the below output; for an X session: PID TT CMD ... 1 ? /usr/lib/systemd/systemd --switched-root --system --deserialize ...
user avatar
  • 33
0 votes
1 answer
471 views

For a non-controlling process, is `ioctl(fd, TIOCNOTTY)` the same as `close(fd)`?

Assume a session has a controlling terminal. If a process in the session that is not the session leader, calls ioctl(fd, TIOCNOTTY), is it correct that it only closes the fd for itself? Is it the ...
user avatar
  • 90.6k
1 vote
2 answers
166 views

Can a (non-)controlling process detach its controlling terminal by closing its file descriptor?

In a process session with a controlling terminal, if the controlling process closes the file descriptor of the controlling terminal, does the process session become detached from the controlling ...
user avatar
  • 90.6k
-2 votes
1 answer
252 views

Does an X client process always have one or more GUI window(s)?

Does an X client process always have one or more GUI window(s)? Conversely, if a process has one or more GUI window(s), is it an X client process? Does an X client never have a controlling terminal?...
user avatar
  • 90.6k
8 votes
2 answers
2k views

what relations are between my current controlling terminal and `/dev/tty`?

On Lubuntu 18.04, I run a shell in lxterminal. Its controlling terminal is the current pseudoterminal slave: $ tty /dev/pts/2 I would like to know what relations are between my current controlling ...
user avatar
  • 90.6k
0 votes
1 answer
313 views

When a session leader acquires a controlling terminal, how would the other existing processes in the session also acquire the controlling terminal?

Suppose there is a session with multiple processes in it and without a controlling terminal. When the session leader creates a connection to a controlling terminal, how would the other processes ...
user avatar
  • 90.6k
-3 votes
1 answer
276 views

Does a shell automatically connect file descriptors 0, 1 and 2 to its controlling terminal?

From The Linux Programming Interface In an interactive shell, these three file descriptors 0, 1 and 2 normally refer to the terminal under which the shell is running. Does "the terminal ...
user avatar
  • 90.6k
8 votes
3 answers
2k views

Background, zombie, daemon and without ctty - are these concepts connected?

How these process concepts are related together - background, zombie, daemon and without controlling terminal? I feel that they are somehow close, especially through the concept of controlling ...
user avatar
2 votes
0 answers
51 views

Is `controlling terminal` solely for user control?

I can kill processes and send signals to them with kill, so I don't need controlling terminal (or ctty) for that. So.. is the purpose of controlling terminal is solely for reacting to nudges from user?...
user avatar
4 votes
1 answer
1k views

Process without a controlling terminal

What happens with process when it is run without a controlling terminal? How is that process different from a standard processes? What features does it lose and what does it acquire? UPDATE #1 The ...
user avatar
3 votes
1 answer
2k views

Does keyboard input always go through a controlling terminal?

Am I right that all input typed from the keyboard goes through a controlling terminal? That means that if a program is run without a controlling terminal, it won't be able to receive any user input. ...
user avatar
3 votes
0 answers
203 views

List all processes without controlling terminal (only)?

Is there a portable way to do this? On Linux, I can use ps a -N but this option isn't available on other (POSIX) systems. Of course I can use grep '^?' with, say, -o tty,... but is there something ...
user avatar
  • 31
13 votes
2 answers
5k views

How to get the real name of the controlling terminal?

How can one get the real name of the controlling terminal (if there is one, else an error) as a pathname? By "real name", I mean not /dev/tty, which cannot be used by other arbitrary processes to ...
user avatar
  • 11.3k
2 votes
0 answers
409 views

How do I assign the controlling terminal to other process?

I use TIOCSCTTY to forcibly take over the controlling terminal in other "remote" application. But after the application finishes running, controlling terminal gets orphaned and bash stops reacting to ...
user avatar
  • 5,156
10 votes
3 answers
8k views

Invoke a command/script disconnected from the controlling terminal?

I'm investigating the behaviour of a script that is normally run as an automated process (e.g. cron, Jenkins). The script can (eventually) invoke commands that behave differently (seeking user input) ...
user avatar
  • 245
23 votes
4 answers
137k views

Please explain this output of ps -ef command?

A part of the output from the ps -ef command is given below : UID PID PPID C STIME TTY TIME CMD root 1 0 0 2012 ? 00:00:01 init [3] root 2 ...
user avatar
  • 6,148
20 votes
2 answers
6k views

Concept of controlling terminal in Unix

Can some one please explain in an easy to understand way the concept of controlling terminal in unix and unix like systems ? Is it related to a session ? If yes, then how ?
user avatar
  • 6,148