Home / Alt manpages / proc_tty(5)

  • proc_tty(5)
  • File format
  • linux

Inspect Linux TTY Drivers and Line Disciplines in /proc/tty

You will finish with a small, repeatable inspection of the TTY drivers and line disciplines exposed by the running Linux kernel. The guide uses only read operations, so it will not change terminal settings, load a driver or restart a service.

Allow about ten minutes. You need a shell on Linux and access to /proc, which is normally mounted automatically. The examples were checked against the proc_tty(5) page from the Debian manpages package, version 6.7-2, whose page identifies itself as Linux man-pages 6.7. The contents of /proc/tty belong to the kernel you are actually running, so your names and numbers will differ.

1. Confirm that the virtual filesystem is present

Check the directory before interpreting any output. This is an ordinary, read-only command and does not need elevated privileges:

$ test -d /proc/tty && echo "/proc/tty is present"
/proc/tty is present

If the test prints nothing, inspect the mount first:

$ findmnt /proc

A missing /proc mount is an environment problem, not evidence that the kernel has no TTY support. Do not create a replacement directory under /proc. A system administrator should restore the normal proc filesystem mount using the host's established boot or container configuration.

2. List the TTY area without changing it

The manual describes /proc/tty/ as the directory containing pseudo-files and subdirectories for TTY drivers and line disciplines. List its immediate entries:

$ find /proc/tty -maxdepth 1 -mindepth 1 -printf '%f\n' | sort
driver
drivers
ldisc
ldiscs

The exact list is kernel and environment dependent. A container, restricted service account or older kernel may expose less. Treat a changed list as an observation to investigate, not as a reason to write into the directory.

Checkpoint

You should now know whether the proc interface exists and which top-level entries are visible to your account.

3. Read the registered driver summary

Read /proc/tty/drivers as text:

$ sed -n '1,80p' /proc/tty/drivers
/dev/tty             /dev/tty        5       0 system:/dev/tty
/dev/console         /dev/console    5       1 system:console
/dev/ptmx            /dev/ptmx       5       2 system
pty_slave            /dev/pts      136 0-1048575 pty:slave

Your output will contain more or fewer rows. The columns describe the registered device name, its device-node pattern, major number, minor-number range and driver type or name. Use the values as a diagnostic snapshot. They are not a command line to paste into mknod, and reading this file does not prove that every possible device node exists in /dev.

Compare a row with the device nodes that the host has actually created:

$ ls -l /dev/tty /dev/console /dev/ptmx /dev/pts
crw-rw-rw- ... /dev/console
crw-rw-rw- ... /dev/ptmx
crw-rw-rw- ... /dev/tty
... /dev/pts

Permissions, ownership and the exact listing are host-specific. If a device is absent, do not manufacture it from the proc output. Check the host's device manager and deployment policy first.

4. Read the active line disciplines

Line disciplines sit between a TTY driver and a terminal-facing application. The proc interface exposes a compact list in /proc/tty/ldiscs:

$ cat /proc/tty/ldiscs
n_tty       0
n_null     27

The names and numeric identifiers describe what the running kernel has registered. They are not a persistent configuration file. A different kernel build, module set or boot state can produce different rows. This command is read-only and normally unprivileged.

For a single, reproducible check, record both the names and the exit status:

$ awk '{print $1, $2}' /proc/tty/ldiscs
n_tty 0
n_null 27
$ printf 'read status: %s\n' "$?"
read status: 0

Do not confuse this list with the line discipline currently attached to your own terminal. It is a registry-style view, not a per-process report.

5. Handle restricted driver details safely

The /proc/tty/driver subdirectory contains driver-specific entries, but access can be restricted. On this host the directory is readable only by root, so an unprivileged inspection may fail:

$ find /proc/tty/driver -maxdepth 1 -type f -print
find: '/proc/tty/driver': Permission denied

That failure is a permission result, not a missing driver. If you are authorised to inspect host diagnostics, repeat only the read operation with elevated privileges:

# find /proc/tty/driver -maxdepth 1 -type f -print
# sed -n '1,80p' /proc/tty/driver/FILE_NAME

Replace FILE_NAME with a name returned by the first command. Do not guess the path, and do not copy driver-specific output into a ticket without checking for host identifiers. Reading a proc file should not require changing its permissions.

6. Diagnose a surprising result

Capture a small, timestamped snapshot when comparing hosts. This creates a file in the current directory, so choose a location where you are happy to keep it:

$ {
    date --iso-8601=seconds
    printf '%s\n' '--- drivers'
    cat /proc/tty/drivers
    printf '%s\n' '--- line disciplines'
    cat /proc/tty/ldiscs
  } > tty-proc-snapshot.txt
$ test -s tty-proc-snapshot.txt && echo 'snapshot written'
snapshot written

This changes only the new local snapshot. Remove it later with rm -- tty-proc-snapshot.txt if it contains nothing you need; that deletion is irreversible. The proc entries themselves remain untouched.

If a proc file disappears between listing and reading, or its contents change, remember that these entries describe live kernel state. Check again during the same workload, then compare kernel versions, loaded modules and container permissions. Avoid treating a single snapshot as a durable inventory.

Done means

  • /proc/tty is present and you know whether proc is mounted normally.
  • You recorded the visible TTY driver summary from /proc/tty/drivers.
  • You read the registered line disciplines from /proc/tty/ldiscs.
  • You can distinguish restricted driver details from an absent TTY interface.
  • You did not write to proc, create device nodes, alter a line discipline or restart a service.