Questions tagged [pty]
Pseudoterminals (also spelled “pseudotty” or “PTY”) are pseudo-devices used with ttys whose emulators run in userspace. Use the [tty] tag for broad (text terminal)-related questions, and the [console] tag for terminal devices pertaining to the system console.
129 questions
6 votes
1 answer
685 views
Fool a program it has a pty of specific size
I use nethack with ttyrec to archive my funny deaths. My only issue is that nethack uses as much screen space as possible to print log massages. I would like to limit it to only work with 80x24 ...
2 votes
1 answer
299 views
TTY line discipline echoing feature
I'm confused from the actual meaning of the echoing feature implemented in Linux TTY driver. As far as I know, a pseudo-terminal pair (PTY pair) consists of a PTY master, a PTY slave and a line ...
2 votes
2 answers
101 views
Unable to write to self in graphical terminal session?
Essentially, I noticed I am unable to write to my user who is using gnome-terminal. tty returns /dev/pts/1, but I am unable to write there as root. Instead, it returns as follows: myuser@pegasus:/$ ...
0 votes
0 answers
54 views
using ptys from shell
In earlier times I was able to open a pair of pseudo terminals /dev/ttyp9 and /dev/ptyp9. It was easy to do something like: $ cat /dev/ptyp9 and in another shell $ echo Hallo > /dev/ttyp9 But on my ...
0 votes
1 answer
253 views
Where is the tty line discipline exactly "logically" located?
I recently started learning about Operating Systems and the linux kernel. I was interested in terminals, so I started there, however, I quickly ran into a problem. I wrote a slightly longer question, ...
0 votes
1 answer
206 views
xterm seems to change its "home" key behaviour for emacs
In xterm, when I press the HOME key on my keyboard, it normally sends ^[[H but when I open emacs -nw, it changes to ^[OH; those are home and khome respectively. I figured out while trying to build my ...
0 votes
2 answers
225 views
How can I connect a bash process to a tty _without_ using getty
I would have two serial usb devices connected to each other, /dev/ttyUSB1 and /dev/ttyUSB2. I would like to run /bin/bash connected to one end, so that I can attach to the other end using picocom and ...
1 vote
1 answer
191 views
job control doesn't work when I create my own pty pair with socat
I am experimenting with understanding terminal emulators by looking at the different pieces of the puzzle. I am trying to start a pty pair and shell process with socat, and then connect to it with ...
0 votes
1 answer
171 views
how to get file descriptors of PTY inside of a child?
https://man7.org/linux/man-pages/man7/pty.7.html in the "UNIX 98 pseudoterminals" it is said that ptsname can be used (and then open), but this function accepts file descriptor. i tried to ...
1 vote
1 answer
371 views
Pseudo-terminals control each other, how to get the return display
The problem is: my pseudo-terminal is /dev/pts/0, the target pseudo-terminal is /dev/pts/4, and I'm trying to get the target pseudo-terminal to print text using the echo text > /dev/pts/4 command. ...
2 votes
0 answers
998 views
How to suppress "Failed to set controlling terminal" warning in GDB when setting program to run on another terminal?
I'm using GDB to debug a program, and I want to direct its output to a different terminal than the one where GDB is running. Here's what I've been doing: Open a second terminal, check its device name ...
0 votes
0 answers
298 views
How to reown a process?
when i run this script with a shortcut(sxhkd): #!/bin/sh MUSIC_DIR="$HOME/music" songs=$(ls "$MUSIC_DIR") filename=$( echo -e "random\n$songs" | dmenu -l 30 -i -p &...
0 votes
1 answer
364 views
how can I make socat simulate unplugging a serial device
I have this test program import sys for line in sys.stdin: print(line.strip()) print("DONE") if I get it to print out lines from a real device (an FTDI) python3 demo.py < /dev/...
0 votes
1 answer
202 views
Can I set up a serial terminal (RS-232) without a pty?
I have two computers that both have a RS-232 port on /dev/ttyS0 connect together with a null modem. I am trying to understand bit by bit how an external terminal worked in the old days, and how that ...
2 votes
1 answer
3k views
trying to make my own shell handle ctrl+c properly
I am trying to understand how shells are set up so that the programs they are running receive the SIGINT when you press ctrl C but the shell doesn't, because when you are running bash, and run another ...