Questions tagged [pseudoterminal]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
219 views

Pseudo terminal for comms between two processes

I am writing an executable that uses a 3rd party C library (libmodbus if it matters) to communicate via serial device (in my case, /dev/ttyUSB0 or similar to talk RS-485 via an FTDI chipset based USB-...
Paul Grinberg's user avatar
1 vote
2 answers
271 views

Linux: Is it possible to have TTY messsages in terminal emulator?

I use LinuxMint21, and I go in TTY only when I have an issue with my X session. Today, I went to a TTY, and I saw messages about sysrqd, partially disabled (was not expected), and I have some upgrade ...
Mévatlavé Kraspek's user avatar
2 votes
1 answer
293 views

How to stop program of non-interactive SSH call without pseudo-terminal

Let's say I start a program with a non-interactive SSH call (without pseudo-terminal) and exit the session via CTRLC: $ ssh user@server -- sleep 123 ^C This way, the program, in this case sleep 123 ...
finefoot's user avatar
  • 3,070
2 votes
1 answer
194 views

zsh zpty does not work on macOS, does work on Linux?

zsh module zsh/zpty seems to work perfectly well on my Linux virtual machine running on Apple M1 macOS machine. But the same does not work on macOS (even on the same host machine). I have tried this ...
codepoet's user avatar
  • 586
0 votes
1 answer
2k views

Pseudo Terminal Error :: "mesg: cannot open /dev/pts/2: Permission denied"

On my Ubuntu 20.04.5 machine, I have a Perl script running under userA's account. The script issues this command: sudo su - userB -c "ssh -l userB 10.0.0.1 ls -tr /some/remote/directory" (...
Pete's user avatar
  • 105
0 votes
0 answers
386 views

How can a process use a newly created pseudo-terminal if only root can open it?

I'm currently learning about the TTY system, and I want to create a demo application which opens /dev/pts/ptmx which will create a new terminal, and then have a process create a new session which will ...
YoavKlein's user avatar
  • 332
1 vote
0 answers
32 views

Executing a command passed from another terminal [duplicate]

I try to understand why, when I pass some text to a pseudoterminal by directly doing, for instance : printf "ls" > /dev/pts/3, pressing Enter just after doesn't result in executing the ...
Aramya's user avatar
  • 37
2 votes
1 answer
140 views

Do programs that create pseudoterminals emulate terminals?

The way I understand it, applications that create a pty (a master/slave pair) can be separated into 2 categories: terminal emulators (xterm, urxvt, ...), which supposedly produce graphical output the ...
x-yuri's user avatar
  • 3,373
1 vote
1 answer
534 views

ssh pseudoterminal special character problems

So I have the following situation: I have a host that exhibits unexpected behavior when using ssh -t combined with tmux. If I call ssh -t my-problem-host tmux non-ascii characters (e.g. €) are ...
Joseph Dalton's user avatar
1 vote
0 answers
71 views

Using BRKINT With Pseudo-Terminals

$ screen $ stty -ignbrk brkint $ sleep 10 If I now press Ctrl-A+b to trigger a serial break, why is no SIGINT sent to the foreground process group sleep 10? Are serial breaks not implemented for ...
cadaniluk's user avatar
  • 145
0 votes
1 answer
1k views

How exactly a CTRL^C passes a signal to process

I'm trying to figure out how exactly CTRL^C sends a SIGINT to a process. Let's consider a pseudo-terminal system. I'll write what I know (or think I know lol) and please add/replace where needed: The ...
YoavKlein's user avatar
  • 332
8 votes
1 answer
2k views

What is the relation between tty driver and line discipline

In the famous "The TTY demystified", the following figure is shown: from which it's seemed that the user process is communicating with the "TTY driver", which in turn communicates ...
YoavKlein's user avatar
  • 332
-1 votes
1 answer
221 views

How do terminal emulators receive input from keyboard [closed]

Since terminal emulators are X11 applications, do they receive input from X11Server if we directly type into the corresponding terminal window? In that case why would /dev/pts/N directory exists? Do ...
user446881's user avatar
0 votes
1 answer
166 views

Why pseudo-terminals and X write to different special files

Why pseudo-terminal infers keystrokes from /dev/pts/{number} (and) X-session infers keystrokes from /dev/input/by-id/{keyboard-device-name}? I understand pseudo-terminal are running on-top of X-...
user446659's user avatar
1 vote
0 answers
460 views

Is it possible to exit `podman run -t` if standard input is redirected?

When I run podman run -t "" alpine:3 sh Everything works and is kosher, and I can exit by typing exit, or CONTROL+P, CONTROL+Q. However, if I run podman run -t "" alpine:3 sh <&...
Evan Carroll's user avatar
  • 30.8k
1 vote
2 answers
414 views

Get working directory inside SSH client process from outside process

I have SSH'd into a remote machine. I would like to get the current working directory (and ideally execute commands like ls) on that remote machine, but from outside this process. Here are my ...
falky's user avatar
  • 189
0 votes
1 answer
496 views

Why output from `stty -a < /dev/pts/0` on pts/1 is different than `stty -a` on pts/0? [duplicate]

If I type stty -a on pts/0, it shows icanon among other flags, which is expected. However, if I run stty from a terminal which is not the controlling terminal of the (bash) shell that I am currently ...
QnA's user avatar
  • 555
0 votes
1 answer
582 views

How to stop terminal from getting mouse click input?

I was just reading this forum where I found a curious terminal control escape sequence: "\033[?1000h". Naturally, I've tried it to see what could happens. In accordance with the inspiring comment, my ...
Daniel Bandeira's user avatar
1 vote
1 answer
4k views

How to disable three square dots on CentOS 8 boot screen?

If run in (pseudo?)text mode as observed under a hupervisor KVM either VMWare, CentOS 8 displays three animated square dots at boot screen: How to disable this screen to see normal text output also ...
J. Doe's user avatar
  • 177
1 vote
0 answers
153 views

Write on PTM Master Pseudoterminal

When we use the write() system call function to write on a ptm master, the pty_write() function will be triggered of because /dev/ptmx is a device file. The write() prototype is : ssize_t write(int ...
etchttpd's user avatar
1 vote
1 answer
1k views

How bash sets tty attributes before and after running a command?

Open xterm, run tty and see pseudo terminal slave file (let's say it is /dev/pts/0). Then open another xterm and run $ stty -F /dev/pts/0 speed 38400 baud; line = 0; lnext = <undef>; discard = &...
Igor Liferenko's user avatar
0 votes
2 answers
1k views

How does PTS slave communicate with PTM file descriptor?

The /dev/ptmx is UNIX 98 master clone device Source When a process opens /dev/ptmx, it gets a file descriptor for a pseudoterminal master (PTM), and a pseudoterminal slave (PTS) device is created in ...
etchttpd's user avatar
4 votes
2 answers
918 views

Why a pair of pseudo-terminals?

My question is more about the conception and design of pty than how it works. I read chapter 64 (pseudo-terminals) of "The Linux Programming Interface" book and I can't understand why we use a pair of ...
etchttpd's user avatar
8 votes
1 answer
987 views

Why blocking read() on a pty returns when process on the other end dies?

When slave side of pty is not opened, strace on the process, which does read(master_fd, &byte, 1);, shows this: read(3, So, when nobody is connected to the slave side of pty, read() waits for ...
Igor Liferenko's user avatar
0 votes
1 answer
397 views

Is it possible to use TIOCMBIS with pseudo-terminal?

I have a C program which works with a normal terminal using this code: int dtr_rts = TIOCM_DTR | TIOCM_RTS; /* out-of-band signal */ ... int comfd = open(COM_PORT, O_RDWR); ... ioctl(comfd, TIOCMBIS, ...
Igor Liferenko's user avatar
1 vote
1 answer
958 views

How TTY differs from an ordinary file? [duplicate]

I'm trying to understand ssh's -t option: -t Force pseudo-terminal allocation. This can be used to execute arbitrary screen- based programs on a remote machine, which can be ...
Igor Liferenko's user avatar
2 votes
1 answer
460 views

PTY master missing read function

How can terminal emulator read from ptm device while it missing read function? There is a PTY driver: https://github.com/torvalds/linux/blob/master/drivers/tty/pty.c. I see pty_write function, but can'...
TwITe's user avatar
  • 151
1 vote
0 answers
105 views

Can terminal parameter changes on the slave side be detected on master?

A process (creator) creates a pseudo-terminal master/slave[/dev/pts/1] pair. Another process (consumer) opens /dev/pts/1 and changes the serial terminal parameters with tcsetattr. Is there a way for ...
TheMeaningfulEngineer's user avatar
1 vote
0 answers
220 views

Is it possible to change the process on the master or slave side of a pseudoterminal pair?

Given a pair of pseudoterminal master and slave, and two processes communicating via them, is it possible to change the process on the master side to another process? is it possible to change the ...
Tim's user avatar
  • 102k
0 votes
1 answer
3k views

create pty and connect it to a serial port /dev/ttyUSB0

Problem: I have two Linux machines connected with a serial interface. I use ppp to communicate between them (I have to since it is a project requirement). Communication speed is at 9600 bits/s. I ...
flashburn's user avatar
  • 661
4 votes
1 answer
4k views

Why are `/dev/ptmx` and `/dev/pts/ptmx` not device files?

https://unix.stackexchange.com/a/492304/674 says On Linux, using devpts, there is no master device file. The process on the master end uses a file descriptor, which it gets by opening ptmx, but ...
Tim's user avatar
  • 102k
2 votes
3 answers
3k views

How can we find out the pseudoterminal master and slave from each other?

A pseudoterminal has a pair of master and slave. How can we find out the master device file from a slave device file (e.g. /etc/pts/3)? I only find /dev/ptmx and /dev/pts/ptmx, but they can't be ...
Tim's user avatar
  • 102k
1 vote
1 answer
341 views

When closing a terminal emulator window, is the last file descriptor of a slave side or master side closed?

The Linux Programming Interface says SIGHUP is sent to the controlling process of a terminal When a terminal window is closed on a workstation. This occurs because the last open file descriptor ...
Tim's user avatar
  • 102k
4 votes
2 answers
738 views

Is a virtual console running as a process and implemented based on pseudoterminal?

Linux has 7 virtual consoles, which correspond to 7 device files /dev/tty[n]. Is a virtual console running as a process, just like a terminal emulator? (I am not sure. It seems a virtual console is ...
Tim's user avatar
  • 102k
3 votes
1 answer
1k views

read(2) blocking behaviour changes when pts is closed resulting in read() returning error: -1 (EIO)

I'm trying to figure out how I can reliably loop a read on a pt master I have. I open the ptmx, grant and unlock it as per usual: * ptmx stuff */ /* get the master (ptmx) */ int32_t masterfd = open("/...
Supernovah's user avatar
1 vote
1 answer
6k views

How do I use jpnevulator to capture and log the serial traffic between an application and hardware serial port?

OK, I've been googling for hours so I obviously have not been able to understand the answers to the various questions that have already been asked about this subject. I am hoping that, by asking the ...
AWM's user avatar
  • 31
4 votes
1 answer
1k views

Is pseudo terminals ( unlockpt / TIOCSPTLCK ) a security feature?

After having opened the master part of a pseude-terminal int fd_pseudo_term_master = open("/dev/ptmx",O_RDWR); there is the file /dev/pts/[NUMBER] created, representing the slave part of he ...
humanityANDpeace's user avatar
3 votes
1 answer
2k views

documentation on ptmx and pts [closed]

I am want to stream a linux terminal to my own program, and as far as I understand this is done by opening /dev/ptmx to start a new pts, I have tested this and this does indeed work (it creates a new ...
TT-392's user avatar
  • 147
2 votes
1 answer
584 views

How does a terminal emulator read and write with a physical terminal device?

In a diagram from APUE, Where is a physical terminal device or virtual console for the terminal emulator read and write with? what process open, read and write with some physical terminal device or ...
Tim's user avatar
  • 102k
8 votes
2 answers
3k 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 ...
Tim's user avatar
  • 102k
2 votes
1 answer
125 views

Does pseudoterminal transfer byte stream or message?

From The Linux Programming Interface under "data transfer" under "communication", we have "byte stream", "message" and "pseudoterminal". Does pseudoterminal belong to byte stream instead, just like ...
Tim's user avatar
  • 102k