โ† Back to list

๐Ÿš€ TTY vs PTY in Linux: Explained with SSH, and VM

Introduction

sunera sudaraka konara ยท 2026-04-08 20:47 ยท 0 claps ยท 1.8 min read
#tty #tty-vs-pty-in-linux
Open on Medium โ†—
Wiki topics: ๐Ÿ”“ ยท Open Source

๐Ÿš€ TTY vs PTY in Linux: Explained with SSH, and VM

Introduction

If youโ€™ve ever used Linux, Docker, or SSH, youโ€™ve probably interacted with a terminal. But behind that simple interface are two important concepts that many developers donโ€™t fully understand: TTY and PTY.

These concepts are fundamental in Linux systems and are widely used in real-world DevOps environments. Understanding them will help you work better with containers, remote servers, and virtual machines.

What is TTY in Linux?

A TTY (Teletypewriter) is a terminal interface that allows users to interact directly with the system.

In modern Linux systems, TTY refers to virtual consoles that provide direct access to the operating system.

๐Ÿ–ฅ๏ธ TTY Example (Linux Console)๐Ÿ–ฅ๏ธ TTY Example (Linux Console)

  • Accessed using: Ctrl + Alt + F6 (in linux)
  • No graphical interface (CLI only)
  • Direct interaction with the OS
  • Devices like: /dev/tty1

๐Ÿ‘‰ This is the closest thing to a โ€œreal terminalโ€ in Linux.

What is PTY in Linux?

A PTY (Pseudo Terminal) is a virtual terminal created by software.

It behaves like a real terminal but exists entirely in software, making it ideal for modern environments.

๐Ÿ’ป PTY Example (Terminal / SSH / Docker)

Used in:

  • Terminal applications (Ubuntu Terminal, VS Code)
  • SSH connections
  • Docker containers

โš™๏ธ TTY vs PTY (Key Differences)

| Feature       | TTY                    | PTY                          |
|---------------|------------------------|------------------------------|
| Type          | Physical terminal      | Virtual terminal             |
| Usage         | Direct input/output    | Used by SSH, Docker          |
| Interaction   | Hardware-based         | Software-based               |
| Example       | Keyboard + Monitor     | Terminal emulator            |

๐Ÿ”„ How PTY Works

User โ†’ Terminal App โ†’ PTY โ†’ Shell (bash) โ†’ Output โ†’ User

User โ†’ Terminal App โ†’ PTY โ†’ Shell (bash) โ†’ Output โ†’ User

Real-world Scenarios

1. Virtual Machine (VM Console)

When you open a VM (VirtualBox, VMware):

  • You interact directly with the OS
  • This is a TTY

2. SSH Connections

ssh user@server
  • Create a remote terminal sessions
  • This is a PTY

TTY and PTY are fundamental concepts in Linux that enable user interaction with the system.

  • TTY โ†’ Direct system console
  • PTY โ†’ Virtual terminal used in modern environments

In real-world DevOps scenarios:

  • VM console โ†’ TTY
  • SSH / Docker โ†’ PTY

Understanding this helps you work more effectively with Linux, containers, and cloud systems.


๋ฉ”ํƒ€๋ฐ์ดํ„ฐ
post_id
b89fe9fefb68
slug
tty-vs-pty-in-linux-explained-with-ssh-and-vm-b89fe9fefb68
url
https://medium.com/@SuneraKonara/tty-vs-pty-in-linux-explained-with-ssh-and-vm-b89fe9fefb68
canonical_url
https://medium.com/@SuneraKonara/tty-vs-pty-in-linux-explained-with-ssh-and-vm-b89fe9fefb68
author_url
https://medium.com/@SuneraKonara
status
ok
fetched_at
2026-06-21 19:25:17