Questions tagged [tty]

For questions related to terminal drivers and the behaviour of terminals for Unix and related systems.

The tag should be used for questions related to terminal drivers and the behaviour of terminals for Unix and related systems (Linux, BSD, Solaris, AIX, HP-UX, MacOS X, etc). Sometimes, this is related to or or .

Example questions:

972 questions
10
votes
4 answers

What is the difference between writing to STDOUT and a filehandle opened to "/dev/tty"?

What are the differences between this two examples? #!/usr/bin/perl use warnings; use 5.012; my $str = "\x{263a}"; open my $tty, '>:encoding(utf8)', '/dev/tty' or die $!; say $tty $str; close $tty; open $tty, '>:bytes', '/dev/tty' or die $!; say…
sid_com
  • 24,137
  • 26
  • 96
  • 187
10
votes
1 answer

QEMU: /bin/sh: can't access tty; job control turned off

As a development environment for linux kernel, I'm using qemu with setting up initramfs as similar to what is shown here, with few additional executable. Basically, it uses busybox for creating minimal environment and package it up using cpio.…
user148865
  • 326
  • 1
  • 5
  • 19
10
votes
1 answer

PTY/TTY - What Can't You Do With Only Slave FD

Question: If I have a pty or tty master/slave pair, what can I not do with it if I only have the slave node's file descriptor? Or, put another way: what can I only do if I have the master node's file descriptor? My Current Understanding: I grok the…
mtraceur
  • 3,254
  • 24
  • 33
10
votes
8 answers

C write() doesn't send data until close(fd) is called

So I have this test code to send "HELLO" over a USB serial port: int fd; struct termios tty; if((fd = open("/dev/ttyUSB0", O_WRONLY|O_NONBLOCK|O_NOCTTY)) == -1){ err(1, "Cannot open write on /dev/ttyUSB0"); } tcgetattr(fd, &tty); tty.c_iflag =…
Kristina
  • 883
  • 1
  • 9
  • 24
10
votes
2 answers

What mechanism allows ViM to temporarily overwrite the entire console?

When you enter vim, it "clears" the screen. Upon exiting, it "restores" the original contents. I understand one can use \x1b[2J to clear the console and reset the cursor position, but this will overwrite terminal contents. I assume Vim uses ncurses…
Qix - MONICA WAS MISTREATED
  • 14,451
  • 16
  • 82
  • 145
10
votes
1 answer

python curses tty screen blink

I'm writing a python curses game (https://github.com/pankshok/xoinvader). I found a problem: in terminal emulator it works fine, but in tty screen blinks. I tried to use curses.flash(), but it got even worse. for example, screen field: self.screen =…
Pavel Kulyov
  • 328
  • 3
  • 9
10
votes
1 answer

Test a program that uses tty stdin and stdout

I have a software made of two halves: one is python running on a first pc, the other is cpp running on a second one. They communicate through the serial port (tty). I would like to test the python side on my pc, feeding it with the proper data and…
Federico Fissore
  • 712
  • 4
  • 18
10
votes
4 answers

Logging/intercepting every keystroke in Vim

I just started working on a tool to help me increase my productivity with Vim. I want it to log every keystroke to a file and then identify inefficient usage patterns. I would like it to store a timestamp for every keystroke. I've tried using the -w…
9
votes
5 answers

How do I check if a Perl script is running in a terminal?

I'm trying to determine, within a Perl script on Linux, whether it's running in a terminal. That is, I need code that: returns true when simply running on the command-line also returns true when running ./myscript.pl | less or even ./myscript.pl…
mscha
  • 6,509
  • 3
  • 24
  • 40
9
votes
1 answer

Capture output as a tty in python

I have a executable which requires a tty (as stdin and stderr), and want to be able to test it. I want to input stdin, and capture the output of stdout and stderr, here's an example script: # test.py import sys print("stdin:…
Andy Hayden
  • 359,921
  • 101
  • 625
  • 535
9
votes
4 answers

Can't create RFCOMM TTY: Address already in use

I listen for a Bluetooth connection in my server doing: rfcomm listen rfcomm1 1 Then I connect with my Bluetooth client and this message appears: Connection from XX:XX:XX:XX:XX:XX to /dev/rfcomm1 Press CTRL-C for hangup This means that everything…
Sergio
  • 844
  • 2
  • 9
  • 26
9
votes
5 answers

How to tell if running in a linux console versus an ssh session?

I have an application that needs to behave differently if run directly from the linux console. So if a user connects with SSH to run FooBar, or the user walks over to the console and logs in directly to run FooBar, I want it to do something…
Stéphane
  • 19,459
  • 24
  • 95
  • 136
9
votes
3 answers

sudoers NOPASSWD: sudo: no tty present and no askpass program specified

I have added a user like this: $ adduser --system --home /no/home --no-create-home --group --disabled-password --disabled-login testuser Added a user to a group: $ adduser testuser testgroup added lines to sudoers (visudo): testuser ALL=(ALL)…
Tim Mishutin
  • 176
  • 1
  • 2
  • 11
9
votes
9 answers

Unable to create superuser in django due to not working in TTY

I go through first django tutorial from djangoproject.com and at the very beginning of part 2, which is creating superuser when I run "python manage.py createsuperuser" I get the following message back: Superuser creation skipped due to not running…
PJM
  • 91
  • 1
  • 1
  • 2
9
votes
3 answers

Python reading and writing to tty

BACKGROUND: If you want, skip to the problem section I am working on a front end for test equipment. The purpose of the front end is to make it easier to write long test scripts. Pretty much just make them more human readable and writable. The…
user3002273