2

I am running Raspbian 9 on my RPi 3 B+ and I have only 6 usable ttys (Ctrl-Alt-F#) while other are blank with blinking cursor. ls /dev lists 64 such ttys. How do I enable/run something on them?

2

You can switch ttys from the command line using

sudo chvt 55

This is handy when you run out of Fn keys.

To create a new virtual terminal and run something on it, use openvt - for example

sudo openvt -c 55 bash

Have a look at man openvt for more details.


Full disclosure: I don't have access to a Pi connected to a monitor at the moment, so this is tested on Ubuntu. I believe it's fairly standard.

  • 1
    Thanks, that's just what I needed! – Misha May 13 at 16:04
-2

Question

How come Rpi3B+ Raspbi9 has 50+ TTYs, but I can only use 6? How can greedy me grab more TTYs?

Answer

Well, "tty", or "TeleTYpe", like TeleVision, in the stone age, the tele-typewriter ("typewriter" in turn, is ancient, belonging to my grandmother days) is just a "terminal" to which user inputs something, then system outputs something (sort of GIGO - garbage in, garbage out! :)

teletype

A terminal can be a real thing, eg, a bank ATM (Automated Teller Machine/Terminal. BTW, real banks and real human tellers are disappering, being replaced by virtual banks/virtual tellers) , where you input some "logic" thing, say, numbers, ATM returns you real money. How nice!

For Windows and Linux, where everything is a "file", TTY can be a simulate/emulate/"process" thing, eg puTTY, which is a software/process thing, emulating a terminal (don't ask me what is the different between "simulation" and emulation - google it! :).

And for greedy newbies wanting more TTYs, I usually recommend to play with real USB TTL adapter/cables. “TTL“ here refers to UART/RS232 in TTL (Transistor Transistor Logic, but those adapters are actually not using TTL, but CMOS). The more real USB/TTY adapters you use, the more fake terminals you have.

How confusing! Go read the references below to clarify your mind. But there is no guarantee that the more your read, the more you become confused! :)

References

Linux tty Command Tutorial for Beginners - HowToForge

Q1. What is tty?

In essence, tty is short for teletype, but it's more popularly known as terminal. It's basically a device (implemented in software nowadays) that allows you to interact with the system by passing on the data (your input) to the system, and displaying the output produced by the system.

ttys can be of different types. For example, graphical consoles that you can access with the Ctrl+Alt+Fn key combination, or terminal emulators like Gnome terminal that run inside an X session. To learn more about tty, head here

Q2. How tty command works?

Usage is pretty straight forward - just run 'tty', and the output will contain name of the terminal connected to standard output (or, in other words, name of the current terminal).

Why are there so many [more than 50!] /dev/tty in Linux? - superuser.com

The ttys are not just input/output devices. They also do a special job of acting as the controlling terminal for a session, like sending signals (Ctrl+C). /dev/ttyNN are virtual consoles, which are full screen displays on the monitor.

/dev/tty0 is a special device, which points to the current terminal. So, irrespective of where you run it from(any virtual console), anything read from/written to tty0 goes to your current terminal.

/dev/tty is at process level, it can be ttyn(tty1, tty2,...), ttySn(ttyS0, ttyS1), pty(pts/0, pts/1), and something else.

/dev/tty0 is a alias of current(foreground) virtual console, so it could be tty1, tty2, and so on. Notice that ttyS0 is not a alias; It's the first serial port.

/dev/console is the system console, it points to /dev/tty0 as a default. It can be ttyn, ttySn, ttyUSBn, lpn, and so on.

Roughly, /dev/tty > /dev/cosole > /dev/tty0

How many serial ports are on the Pi 3?

Options to add 20 UART to RPi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.