Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [tty]

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

1165
votes
9answers
305k 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?
55
votes
4answers
13k 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 work-flow and responsibilities of each elements). I have read several interesting articles about it, but there are still some blurry areas. This is ...
125
votes
3answers
121k 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?
13
votes
4answers
4k 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
votes
1answer
1k 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 ...
33
votes
5answers
130k views

Can I change the font of terminal?

I have a Unix-like OS installed without desktop. Is it possible to change the font of the terminal?
11
votes
4answers
801 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
1answer
319 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 ...
101
votes
2answers
105k 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 ...
5
votes
1answer
3k 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 ...
38
votes
1answer
2k 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 ...
14
votes
6answers
15k 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 ...
220
votes
7answers
262k 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 ...
10
votes
1answer
5k 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 ...
58
votes
2answers
9k 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 ...
43
votes
8answers
85k 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).
25
votes
1answer
126k 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 ...
23
votes
3answers
64k 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 ...
1
vote
2answers
341 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 ...
23
votes
1answer
12k 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 "...
1
vote
1answer
716 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 '...
11
votes
2answers
3k 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 ...
5
votes
2answers
5k 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 ...
3
votes
1answer
1k 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: <<...
6
votes
2answers
3k 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 ...
5
votes
5answers
4k 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
vote
1answer
2k views

Fresh Arch Installation - Terminal text completely unreadable just after boot

My laptop is a Toshiba CB35-B3340. Also called a Chromebook 2, with part number PLM02U-009008. I had a working installation of Arch on it yesterday, but accidentally destroyed it while moving ...
79
votes
14answers
365k 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 ...
30
votes
2answers
14k 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)? ...
21
votes
8answers
32k 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.
14
votes
4answers
59k 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). ...
8
votes
2answers
7k views

How Linux uses /dev/tty and /dev/tty0

I can see the difference between /dev/tty and /dev/tty0 by testing the provided method from this question. But I really wonder about the practical usage of those devices (like situations they will be ...
9
votes
1answer
38k 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 ...
16
votes
1answer
2k 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. ...
6
votes
2answers
16k 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.
11
votes
2answers
4k 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 ...
10
votes
1answer
10k views

Read what is written to /dev/tty*

How can I read what is written to /dev/tty*(* = 0 - number of tty)? I tried sudo tail -f /dev/tty1 on one terminal(X) and then sudo cp .emacs /dev/tty1 from another. X didn't show the the content of ....
9
votes
1answer
5k 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 ...
6
votes
3answers
904 views

What are TTYs >12 used for?

Related to TTY numbers, it looks like there are 64 TTYs (find /dev -name 'tty[0-9]*' | cut -c 9- | sort -n | tail -n 1 and documentation). tty0 is the current virtual console, Ctrl+Meta+F1 reports ...
3
votes
1answer
629 views

How to restore from a scrambled screen?

My screen is scrambled while reading some unexpected chars, It happens in a local tty, so logging out won't help. Any ideas? Hopefully I don't have to reboot
2
votes
1answer
82 views

Are all the slaves paired with the same master?

In bash in lxterminal $ tty /dev/pts/2 $ ls /dev/ptmx -l crw-rw-rw- 1 root tty 5, 2 May 26 09:38 /dev/ptmx On Ubuntu, is there only one master for all the processes, and all the slaves are paired ...
17
votes
7answers
18k views

How can I run `watch` as a background job?

When I run: watch 'cmd >> output.txt' & the job gets suspended by the system: 3569 Stopped (tty output) Is there a workaround?
10
votes
1answer
7k views

bash: no job control in this shell

I have a minimal Linux system. init is /bin/bash, only bare minimum of libraries in /lib/, /dev/ is populated statically, no daemons running (no udev, ..) When bash starts, I get following error: ...
5
votes
1answer
170 views

How do I ensure that a terminal remains scrollable?

On my tty terminals (1-6), I lose text when I move away from it and back (i.e. pressing ShiftPg Up doesn't reveal any scrolled-off text). How can I recover this text?
4
votes
1answer
484 views

Why does showconsolefont have different output in tmux?

I'm running an arch linux system with no window manager or desktop environment (right now). I use tmux when I need multiple terminals. When I run sudo showconsolefont on my tty (no tmux), I see the ...
3
votes
1answer
1k views

How can I live-change the TTY rows and columns?

This is a question about Linux running on a Compulab device named Utilite Pro, but I think it is worth the price to ask this question here to get it solved for any platform (if possible). I use ...
3
votes
1answer
178 views

The effect of `stty --file=<terminal> <flag>` is only temporary for consoles in bash. Why?

Open two consoles / X terminals. From one, which is attached to say /dev/tty1 (Linux console) or /dev/pts/0 (X terminal), run $ stty -echo. (Now echoing to keyboad is turned off.) Then from the other, ...
2
votes
1answer
236 views

Why does `last` show '{' and '|' in the TTY field?

We recently set up a new FreeBSD 7.2 machine on March 11. When looking at last, we noticed some funny characters for the TTY field. What do these characters mean? Note that at this time, the ...
2
votes
0answers
198 views

How to use secondary VGA device for TTYs

I have a machine (a virtual XEN DomU, but I don't think it matters) with two video cards. I would like to display the TTYs on the monitor connected to the secondary video card (i.e., not the display ...
2
votes
0answers
158 views

Data loss over ttyACM* when 'cat' command is used for data transfer

I have a development board which will have 3 ACM interfaces when connected to Ubuntu host and i want to transfer data from Host to Device over ttyACM3. I have followed the following procedure for ...