Skip to main content
81 votes
Accepted

zshrc export GPG_TTY=$(tty) says not a tty

tty command requires that stdin is attached to a terminal. When using Powerlevel10k, stdin is redirected from /dev/null when Instant Prompt is activated and until Zsh is fully initialized. This is ...
Roman Perepelitsa's user avatar
50 votes

Linux: Difference between /dev/console, /dev/tty and /dev/tty0

/dev/console https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/serial-console.rst On Linux, the kernel console can be configured using the console= boot option. Kernel code ...
sourcejedi's user avatar
  • 53.5k
35 votes

How is cursor blinking implemented in GUI terminal emulators?

Your question mixes up two concepts: blinking cursor and blinking text. GNOME Terminal (VTE) had supported blinking cursor for a very long time, and I added blinking text support 5 years ago. Let me ...
egmont's user avatar
  • 6,518
32 votes
Accepted

How is cursor blinking implemented in GUI terminal emulators?

I've strace'd gnome-terminal-server, which is the actual process of GNOME Terminal. When otherwise idle, just blinking the cursor, it resides in a poll(..., 598) or similar kernel call, i.e. a poll() ...
egmont's user avatar
  • 6,518
31 votes

How to connect to a serial port as simple as using SSH?

Try http://tio.github.io "tio" is a simple TTY terminal application which features a straightforward commandline interface to easily connect to TTY devices for basic input/output. Typical use is ...
Martin's user avatar
  • 411
30 votes
Accepted

What is `/dev/console` used for?

/dev/console exists primarily to expose the kernel’s console to userspace. The Linux kernel’s documentation on devices now says The console device, /dev/console, is the device to which system ...
Stephen Kitt's user avatar
24 votes
Accepted

Bash attempts to write two shell prompts?

The <ESC>]0; sequence (shown as \33]0; by strace) is the escape sequence to set the terminal window title. It's terminated with the BEL character (\7), so the first write sets the window title. ...
ilkkachu's user avatar
  • 148k
23 votes
Accepted

How do interactive CLIs work?

vim and other semi-graphical (the capability to display semi-graphic characters such as corners, full crosses…) applications control the terminal (manage the position of the cursor, the position of ...
MC68020's user avatar
  • 8,617
20 votes
Accepted

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

TL,DR: script -c myprogram /dev/null </dev/null >/dev/null You can't “redirect” /dev/tty in the same sense that you can redirect standard output. Standard output is defined as a file descriptor. ...
Gilles 'SO- stop being evil''s user avatar
18 votes
Accepted

How to get pinentry-curses to start on the correct tty?

As per the upstream bug against openssh, the proper way to this is adding the following to your ~/.ssh/config: Match host * exec "gpg-connect-agent UPDATESTARTUPTTY /bye" This has worked for me ...
smaslennikov's user avatar
17 votes

Can I change the font of the text-mode console?

/etc/default/console-setup et al. have been superseded on systemd operating systems, although you will find that some operating systems such as Debian try to maintain the older configuration system. ...
JdeBP's user avatar
  • 71.9k
16 votes
Accepted

How to copy/paste between a console and an X session?

The "best" way to achieve that sort of thing is almost probably opinion based. The way I prefer uses the backlog of the native terminal. Knowing that the backlog of tty[N] can be accessed ...
MC68020's user avatar
  • 8,617
15 votes
Accepted

How to get the current terminal ID

Use \l, it gives the basename of the shell’s terminal device name: PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u\l@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' This is similar to the \...
Stephen Kitt's user avatar
14 votes
Accepted

/dev/ttyUSB0 is available but after try to call it's gone

I have the exact same issue with a USB→serial converter. Worked fine on 20.04 (even 21.10), and with 22.04 I see the device appearing for a short time, then 1 or 2 seconds later, disappears. dmesg ...
Kris's user avatar
  • 156
13 votes

What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?

Apart from the accepted answer and The TTY demystified article, I really loved reading these articles: This one is based on NetBSD. Back in the stone ages of Unix, computer systems consisted of a ...
Nishant's user avatar
  • 673
13 votes
Accepted

Getting PuTTY to work properly with FreeBSD

There are so many knobs to twist and turn. And much advice on the Internet people follow blindly. As always many ways to Rome but when you know how things are connected they are very simple. The ...
Claus Andersen's user avatar
13 votes
Accepted

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

The tty manpage in section 4 claims the following: The file /dev/tty is a character file with major number 5 and minor number 0, usually of mode 0666 and owner.group root.tty. It is a ...
Stephen Kitt's user avatar
13 votes

extra \x0D appended when echo \0x0A

If you want bytes to be transmitted as-is across a serial connection both ways, you need to tell the system it's not to be used as a terminal device, either by detaching the tty line discipline from ...
Stéphane Chazelas's user avatar
13 votes
Accepted

job control doesn't work when I try to set up getty over serial

It's not the commands but the environment in which they run that is the difference. Normally getty is spawned directly from the system service manager (init) – both with systemd where it is a .service,...
grawity's user avatar
  • 15.2k
12 votes

Can I change the font of the text-mode console?

Using Ubuntu 16.04 (probably works in all supported versions), I edited ~/.bashrc and just before terminal splash at end of file, inserted the setfont command: # Set font when running in console /bin/...
WinEunuuchs2Unix's user avatar
12 votes

What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'?

I will use Unix and Linux more or less synonymously in this. If I'm referring to something historical that predates the existence of Linux, I will usually write "Unix", and if I'm talking ...
Omnifarious's user avatar
  • 1,412
12 votes

Is there a way to reptyr a make process or any process with subprocesses?

reptyr version 0.6 introduced -T option for "tty-stealing" mode, which works on processes with children. See https://blog.nelhage.com/2014/08/new-reptyr-feature-tty-stealing/ for more details.
chipiik's user avatar
  • 221
12 votes

What is `/dev/console` used for?

"What is /dev/console?" is answered in the previous answer. Perhaps that answer is more clear when you know the answers to the other two questions. Q1. "What is the device file representing the ...
sourcejedi's user avatar
  • 53.5k
12 votes

Error: Cannot perform an interactive login from a non TTY device

Try adding winpty before the docker ... command. It enables TTY on Windows. Useful for GitBash, Putty and MobaXTerm. $ winpty docker login $ACR_REGISTRY Username: appacr Password: Login Succeeded
David Peleg's user avatar
12 votes

How does piping affect stdin?

A pipe is a buffer allocated in the kernel with file descriptors associated with the read and write ends. When you run cat file.txt | grep -v match: The shell creates a pipe (using the pipe() system ...
Andy Dalton's user avatar
  • 14.7k
12 votes
Accepted

extra \x0D appended when echo \0x0A

You need to disable newline conversion: stty -F /dev/ttyS2 -onlcr or, for strict POSIX stty: stty -onlcr < /dev/ttyS2
Stephen Kitt's user avatar
11 votes

How to stop cursor from blinking

This hides completely the cursor. tput civis To restore: tput cnorm
NVRM's user avatar
  • 426
11 votes

Can I change the font of the text-mode console?

A dead-simple, if inflexible, solution is to run setfont -d, which doubles the size of the current font. Running it twice won't quadruple the size, though (or at least not on my system).
Jeffrey Benjamin Brown's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible