Questions tagged [tty]

A representation of a device that asynchronously transmits and receives serial data.

Filter by
Sorted by
Tagged with
1530 votes
10 answers
472k views

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

I think these terms almost refer to the same thing, when used loosely: terminal shell tty console What exactly does each of these terms refer to?
  • 34.1k
86 votes
4 answers
24k views

What are the responsibilities of each Pseudo-Terminal (PTY) component (software, master side, slave side)?

I am trying to figure out how a tty works1 (the workflow and responsibilities of each element). I have read several interesting articles about it, but there are still some blurry areas. This is what I ...
  • 2,169
173 votes
3 answers
191k views

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

On a Linux system, what is the difference between /dev/console, /dev/tty and /dev/tty0? What is their respective use and how do they compare?
69 votes
7 answers
228k views

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

I have a Unix-like OS installed without a windowing environment; i.e., just a text-mode console and no GUI. Is it possible to change the font used by the console? To be clear, I am not talking about ...
  • 1,119
20 votes
6 answers
11k views

Construct a command by putting a string into a tty

I managed to do this echo -n "command" > /dev/tty1 The letters appear, and the cursor moves, but they are "ghosts" – if you hit Enter, nothing happens (they are not in stdin). Edit: In the ...
  • 6,653
7 votes
1 answer
2k views

^@ spam in tty (but seems to be system-wide)

I recently noticed some weird behavior on my GNU/Linux machine. I've been trying to narrow it down but I am unsure where to go next. My setup uses the following: i3 gdm arch systemd grub2 pulseaudio ...
  • 73
8 votes
2 answers
2k 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 ...
  • 95.9k
60 votes
8 answers
158k views

How can I hook on to one terminal's output from another terminal?

I need to hook onto output of currently running terminal (tty1) from virtual terminal and capture it (running X server).
237 votes
8 answers
313k views

Why do I need a tty to run sudo if I can sudo without a password?

I have configured sudo to run without a password, but when I try to ssh 'sudo Foo', I still get the error message sudo: sorry, you must have a tty to run sudo. Why does this happen and how can I work ...
  • 3,815
20 votes
6 answers
27k views

Show a notification across all running X displays

Using the command line, I'd like show a notification on every running X display. ( and running console ) Something like: notify-send-all 'Warning' 'Nuclear launch in 5 minutes, please evacuate' Is ...
  • 24.4k
148 votes
2 answers
154k views

Difference between pts and tty

Possible Duplicate: What is the exact difference between a 'terminal', a 'shell', a 'tty' and a 'console'? I always see pts and tty when I use the who command but ...
19 votes
1 answer
11k views

In which cases is SIGHUP not sent to a job when you log out?

I read an answer from a user who claimed that running foo 2>&1 >& output.log & would result in foo continuing to run even when they log out. According to this user, this even ...
  • 461
12 votes
4 answers
1k views

ls command operating differently depending on recipient

How does commands like ls know what its stdout is? It seems ls is operating different depending on what the target stdout is. For example if I do: ls /home/matt/tmp the result is: a.txt b.txt c....
7 votes
1 answer
4k views

How do I come by this pty and what can I do with it?

It seems that a simple shell redirect from /dev/ptmx gets me a new pseudo-terminal. $ ls /dev/pts; ls /dev/pts </dev/ptmx 0 1 2 ptmx 0 1 2 3 ptmx It disappears as soon as the process that ...
  • 56.9k
5 votes
1 answer
2k views

ssh with separate stdin, stdout, stderr AND tty

Problem Consider a command like this: <binary_input ssh user@server 'sudo tool' >binary_output 2>error.log where tool is arbitrary and ssh is a wrapper or some ssh-like-contraption that ...
43 votes
4 answers
142k views

How to switch between tty and xorg session

My xorg session is on tty1 and if I want to issue a command from tty (because I cannot do it from xorg session for some reasons), I press Ctrl+Alt+F2, for example, and type a command. But I cannot ...
  • 657
40 votes
1 answer
4k views

What happens when Ctrl + Alt + F<Num> is pressed?

I am looking for an explanation of what happens in Linux when this key combination is pressed to change the current terminal. In particular, what software component intercepts this key combination and ...
  • 547
32 votes
3 answers
24k views

Why does awk do full buffering when reading from a pipe [duplicate]

I'm reading from a serial port connected to a gps device sending nmea strings. A simplified invocation to illustrate my point: $ awk '{ print $0 }' /dev/ttyPSC9 GPGGA,073651.000,6310.1043,N,01436....
64 votes
2 answers
12k views

Can a terminal emulator be as fast as TTY 1-6?

I've been trying various terminal emulators lately, from the built-in gnome-terminal, aterm, xterm, wterm, to rxvt. The test I've been doing is in this order: Open up a tmux window with 2 panes The ...
  • 749
54 votes
1 answer
213k views

How to read/write to tty* device?

I have a device that sends information over USB to my computer. Arch Linux sets up this device by creating a file named ttyUSB0 in /dev/. I have been using GTKterm to receive this incoming information ...
  • 2,441
34 votes
1 answer
27k views

What exactly is scrollback and scrollback buffer?

What are "scrollback" and "scrollback buffer" in programs like bash and screen, and how do they relate to the tty, the programs being run, and stdin/ stdout/ stderr? Here is the only definition of "...
  • 2,260
15 votes
2 answers
5k views

How to get the real name of the controlling terminal?

How can one get the real name of the controlling terminal (if there is one, else an error) as a pathname? By "real name", I mean not /dev/tty, which cannot be used by other arbitrary processes to ...
  • 11.7k
8 votes
2 answers
6k views

What is the TTY major number of your Unix?

I'm currently working on a serial port library which already uses special frameworks to get information about serial ports on the system. Though serial ports are a fundamental design in Unix—as ...
  • 268
5 votes
3 answers
14k views

How to manually run/init/start a Xorg server on a different VT/TTY?

I want to start an Xorg server (which should only feature a minimal xterm terminal emulator from a newly created "pristine" tty). I have thought this to be as simple as issuing a xinit or ...
  • 647
2 votes
2 answers
2k views

What controls the mapping between Ctrl+Alt+F keys, TTYs and X sessions?

On my CentOS system, Ctrl+Alt+F1 shows the X Windows session known as :0, but on other systems Ctrl+Alt+F7 may do the same thing. What determines how Fn keys are mapped to X sessions and TTYs? ...
  • 211
2 votes
2 answers
2k views

Do the output of command `tty` and the file `/dev/tty` both refer to the controlling terminal of the current bash process?

From man tty tty - print the file name of the terminal connected to standard input $ tty /dev/pts/2 From APUE: Historically, the name of the controlling terminal in most versions of the UNIX ...
  • 95.9k
1 vote
2 answers
1k views

force output to input (buffer) like "\033[6n" in a script

I have tried using pipes and redirections to have (C program or scripts) output end up on the input buffer, the way printf "\033[6n" does, but no positive results. Does anyone know how this ...
1 vote
2 answers
2k views

How are long command lines ( > $COLUMNS ) automatically wrapped to a new line?

There are several points where I/O is passed through, some of which (to my knowledge) are the shell, pty, tty, termios, terminal emulator application. In most terminal emulators, long command lines (...
  • 295
136 votes
16 answers
593k views

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

Is there a way to connect to a serial terminal just as you would do with SSH? There must be a simpler way than tools such as Minicom, like this $ serial /dev/ttyS0 I know I can cat the output from ...
43 votes
5 answers
75k views

Start a process on a different tty

After about an hour of Googling this, I can't believe nobody has actually asked this question before... So I've got a script running on TTY1. How do I make that script launch some arbitrary program ...
29 votes
11 answers
54k views

How to stop cursor from blinking

How do I make the cursor stop blinking when in a TTY? (or anywhere else). BONUS Points for one universal setting that stops the cursor blinking almost everywhere.
  • 24.4k
13 votes
1 answer
13k views

256 colors in console (tty)

Suppose, I have a system without X server. I can only log in from the console. It seems, by default linux console supports only 8 colors: # tput colors 8 Is it possible to use 256 colors in the ...
7 votes
2 answers
5k views

Take text "screenshot" of current terminal contents

I would like to, every 30 seconds or so, copy all text of a certain terminal or terminal emulator to a file, and display it in conky. I'm not talking about simple redirection (command > file), ...
  • 551
7 votes
5 answers
6k views

Multiple terminals at once without an X server

There is a way to visualize multiple terminals at the same time without running a Xorg session ? I have a really low profile machine that could be great for some basic stuff but has an horrible ...
  • 1,363
5 votes
2 answers
7k views

256 color in Linux console

I have in my .bashrc export TERM=xterm-256color but this cause blinking all colored text (ls --color, in vim etc.) in a Linux console (Ctrl+Alt+F1). So is there any possibility to recognize in ...
  • 307
3 votes
2 answers
2k views

agetty login program arguments

First post here. I'm trying to run some tests against a CentOS 6 machine, but my tests disable networking so I communicate over serial ports. I created an upstart job that sets up ttyS1 such that it ...
  • 131
3 votes
1 answer
2k views

NixOS no login prompt in virtual terminals

I have NixOS built using 15.09 channel, session manager is sddm, display manager is KDE 5. Switching to virtual ttys from 1 to 6 gives me no login prompt, I see same piece of log everywhere: <<...
1 vote
1 answer
1k views

How are virtual consoles related to traditional computer terminals?

This is extracted (with some rewording) from Computer terminal and virtual console, which has been closed with a hatnote linking to What is the exact difference between a 'terminal', a '...
  • 1,918
36 votes
2 answers
20k views

How does a Linux terminal work?

If you fire up a terminal and call an executable (assuming one that's line oriented for simplicity) you get a reply to the command from the executable. How does this get printed to you (the user)? ...
  • 463
31 votes
2 answers
70k views

What is the difference between ttyS0, ttyUSB0 and ttyAMA0 in Linux?

I want to know the difference between ttyS0, ttyUSB0 and ttyAMA0 on Linux.
28 votes
5 answers
15k views

Get ssh to forward signals

I want to be able to send signals (SIGINT is the most important) through ssh. This command: ssh server "sleep 1000;echo f" > foo will start sleep on server and after 1000 seconds it will put 'f\...
  • 32.7k
27 votes
5 answers
23k views

Rebinding/disabling CTRL+ALT+F# Virtual Terminal/Console Switching

I have an application that binds CTRL+ALT+F7, but my linux machine seems to catch the keystroke. Is there a way to rebind/disable this key? A recompile of the kernel is an acceptable answer. The ...
  • 461
25 votes
1 answer
7k views

Make program in a pipe think it has tty [duplicate]

Test environment: $ mkdir testdir $ cd testdir $ echo | tee "file name" Now, ls will print file?name (under Ubuntu GNU bash, at least), while ls | cat will print file and name in separate lines. ...
  • 1,256
19 votes
2 answers
13k views

What is `/dev/console` used for?

From this answer to Linux: Difference between /dev/console , /dev/tty and /dev/tty0 From the documentation: /dev/tty Current TTY device /dev/console System console /dev/tty0 Current ...
  • 95.9k
19 votes
1 answer
9k views

TTY On External Monitor

When using my laptop at home, I usually use an external monitor, keyboard, and mouse with my laptop's screen as a second monitor. This is all easily configured using a nice GNOME utility that I ...
  • 44.7k
18 votes
4 answers
71k views

Pseudo-terminal will not be allocated because stdin is not a terminal

I'm trying to set up automatic SSH hopping through a server which doesn't have nc. This works from the command line: ssh -A gateway ssh steve@target (I have added my public key to the SSH agent). ...
15 votes
2 answers
7k views

Why are there so many virtual terminal devices?

I've been reading the Advanced Linux Programming book and it mentions about virtual terminals which, if I understood it correctly, it is a Linux-specific feature (not in Unix) to allow multiple login ...
  • 315
14 votes
1 answer
51k views

Change the number of rows and columns in the TTY [duplicate]

I want to resize the terminal which comes up when you press CtrlAltF1 (or F2,F3,...). 25x80 is small for a 24" screen. Tried using stty, but the commands stty columns 200 and stty rows 50 does not ...
  • 521
11 votes
1 answer
6k views

How can I make a psf font for the console from a otf one?

I want to use the Inconsolata font in the tty console, but I need to generate a psf font for that. I found that there are two tools that should work, otf2bdf and bdf2psf, but every time I try to use ...
  • 251
11 votes
4 answers
3k views

Are there any linux terminals which can handle all key combinations?

I like to use emacs in terminal mode (-nw), but it seems most (all?) terminals can't handle some key combinations - for example, C-<RET> or C-M-%. I know this is because most terminals emulate a ...
  • 222