Skip to main content

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.

Filter by
Sorted by
Tagged with
5 votes
1 answer
557 views

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 ...
jptrzy's user avatar
  • 51
2 votes
1 answer
279 views

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 ...
CarloC's user avatar
  • 385
2 votes
2 answers
87 views

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:/$ ...
Vesta Tian's user avatar
0 votes
0 answers
50 views

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 ...
Klaus's user avatar
  • 538
0 votes
1 answer
215 views

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, ...
Yakog's user avatar
  • 517
0 votes
1 answer
189 views

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 ...
Alex028502's user avatar
0 votes
2 answers
208 views

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 ...
Alex028502's user avatar
1 vote
1 answer
173 views

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 ...
Alex028502's user avatar
0 votes
1 answer
158 views

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 ...
Michael Quad's user avatar
1 vote
1 answer
351 views

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. ...
xnl2d's user avatar
  • 27
2 votes
0 answers
978 views

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 ...
Sebastian Carlos's user avatar
0 votes
0 answers
282 views

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 &...
grayhatter's user avatar
0 votes
1 answer
350 views

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/...
Alex028502's user avatar
0 votes
1 answer
186 views

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 ...
Alex028502's user avatar
2 votes
1 answer
3k views

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 ...
Alex028502's user avatar
0 votes
1 answer
704 views

Loginctl lists a lot of sessions, and I want programmatically to know which one is a graphical session (e.g. GNOME desktop). In the example below, I have a GNome desktop session open, an ssh ...
Eric Stdlib's user avatar
0 votes
1 answer
808 views

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
934 views

I often use tee /proc/self/fd/2 to show something both to stdout and stderr, capture stdout, while still keep all output to stderr. E.g., I have a do.sh: STD_OUT_STR=$(CMD ARGS ... 2>&1 | tee /...
osexp2000's user avatar
  • 632
1 vote
1 answer
277 views

How can I run a program that expects to be executing in a terminal in such a way that it's STDIO can be arbitrarily connected-to remotely? Specifically, I want to be able to launch gdb on one host and ...
Billy's user avatar
  • 111
1 vote
1 answer
1k views

I am creating a fake serial device like this: socat -d -d pty,raw,echo=0 pty,raw,echo=0 This creates devices with new numbers each time. Let's call them /dev/pty/6 and /dev/pty/7 To simulate a ...
Alex028502's user avatar
2 votes
1 answer
423 views

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
  • 636
4 votes
1 answer
16k views

Added: After reading suggested as duplicate Which of proc, sys etc. should be bind-mounted (or not) when chrooting into a "replacement" distribution? : How I know: it is customary to invoke ...
Alex Martian's user avatar
  • 1,319
8 votes
1 answer
6k views

As a rule in the Debian 10 hardening guide, and various other audit guides of the Center for Internet Security (CIS), setting the use_pty sudoers option is recommended for the following rationale: ...
Flo's user avatar
  • 83
3 votes
1 answer
269 views

I am currently learning about the pseudo-terminal functionalities in C. I am able to create the master, slave end of the pty, after fork, I have set the stdin, stdout, stderr to fd slave , after exec ...
chellathurai's user avatar
0 votes
1 answer
1k views

To show output in both terminal and to a file, tee can be used like below ls --color=auto | tee opfile But now, there is no color in the terminal. If I force colors, opfile also has colors which ...
balki's user avatar
  • 4,737
2 votes
1 answer
3k views

This is still related to my yesterday thread, so there's alert or maybe it's just log that displayed on my terminal on /dev/tty1. Ofcourse it's annoying because it's displayed in my bash prompt, so ...
Muhammad Ikhwan Perwira's user avatar
2 votes
1 answer
220 views

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,623
0 votes
1 answer
274 views

Situation I'm running a program on Linux, which produces a lot of verbose logs to stdout. The program itself is put into background by using systemd.service facilities. Until now, I have configured ...
Daniel's user avatar
  • 418
1 vote
1 answer
2k views

When the connection is slow, I connect to remote computers using SSH without allocating a pseudo-terminal (e.g. ssh -T [email protected] or ssh [email protected] bash). Although I am able to use the ...
Flux's user avatar
  • 3,318
4 votes
1 answer
2k views

I'm trying to understand this topic but, apparently, for my brain it is too hard. Terminal device entries normally reside in two directories: /dev and /dev/pts. The /dev directory contains entries ...
vittorioc98's user avatar
0 votes
0 answers
203 views

I'm using Linux console for years, but currently started thinking of how it actually works. Typing a command as a string and pressing Enter returns its output in the same terminal window. Opening a ...
Some Name's user avatar
  • 297
3 votes
1 answer
9k views

Ubuntu 20.04 both on host and guest. I'm new to QEMU and trying to set up guest-host communication via serial port. The QEMU documentation says that -serial dev option: Redirect the virtual serial ...
Some Name's user avatar
  • 297
-1 votes
2 answers
1k views

I noticed that the terminal cursor starts at the top of the terminal and slowly moves down as more commands are executed, until ultimately settling on the bottom regardless of the number of commands. ...
Stephen Wood's user avatar
1 vote
3 answers
455 views

For example, in PuTTY's configuration I set terminal type to xterm-256color but after SSH login I change it with export TERM=linux in the shell. I know it works quite well for most time. Just want to ...
UNIX.root's user avatar
  • 194
1 vote
2 answers
627 views

Background: I'm using expect to connect between AMCE.sh and a managed network switch. I can connect to the switch via SSH, log in and issue commands but because of the way the switch manages SSL ...
RobbG's user avatar
  • 175
-1 votes
1 answer
634 views

I read that pts is a pseudo-terminal (that we get through ssh or xterm) and tty is the native terminal. I didn't connect to my PC through ssh or xterm, but I am still getting pts/0 and pts/1 when I ...
Gaurav Purswani's user avatar
1 vote
0 answers
217 views

I want to design a terminal multiplexer like tmux, but not that complex, something minimal, that works remote, using ncurses. On the server side, the workflow is as follows: The server process ...
rel0adedd's user avatar
0 votes
1 answer
156 views

Please stop marking this question as a duplicate, it's not a duplicate. Thanks. Consider the sequence of a, followed by \x1b[D ("cursor back"), followed by b. This would produce an output of ...
Steven Lu's user avatar
  • 2,432
3 votes
1 answer
3k views

Can anyone explain what this means: SHELL=/bin/bash script -q /dev/null It is used to upgrade a shell in a CTF in HTB: SHELL=/bin/bash script -q /dev/null Ctrl-Z stty raw -echo fg reset xterm ...
Matthias Altmann's user avatar
0 votes
1 answer
271 views

edit: I was in EternalTerminal session, and that was the source of the difference. In a regular ssh, it works. I need to get commands in a pipe to believe they are in a PTY and emit colorized output. ...
Victor Sergienko's user avatar
0 votes
0 answers
3k views

I have a "regular character device" - not sure of the proper naming - that doesn't support ioctl on an embedded device (/dev/appvcom). I need to connect to it with an application that uses some ioctl ...
toster-cx's user avatar
  • 101
0 votes
2 answers
387 views

Lets say I have top or some ncurses program running in a graphical terminal, and from outside this terminal I'd like to execute a command, that would replace top with another program of my choosing. ...
Alex Stragies's user avatar
1 vote
1 answer
956 views

Alternative to "openvt"...but for pseudo terminal(pts)... Exists? Openvrt operate only tty...but not pts. (Example: lauch comand in specific pts and with user of shell pts destination) Command <...
user avatar
1 vote
1 answer
2k views

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
4 votes
1 answer
4k views

To be specific, let's speak in pseudo-terminal terms. Suppose we have file descriptors master and slave for a pseudo-terminal pair (suppose it is a controlling tty). Disabling IXON on master (or slave,...
Igor Liferenko's user avatar
0 votes
1 answer
721 views

I am using the tty subsystem of Linux to emulate serial ports. The emulated serial ports are used by an application that expects a physical serial port. In my case, the application is running under ...
millinon's user avatar
  • 353
0 votes
0 answers
615 views

A bit ago, I found it necessary to set my home directory to my One Drive in WSL. Thanks to this post I was even able to get my permissions working correctly within WSL (Ubuntu 16.04 LTS). However, ...
leeand00's user avatar
  • 4,971
1 vote
0 answers
1k views

Some context for my question: I am working on a pty NodeJS server running in docker where I want to provide users connecting to the shell an isolated environment where they can play around with ...
Joakim Hansson's user avatar
10 votes
1 answer
1k views

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
1 vote
1 answer
1k views

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