vcs(4)

πŸ’– vcs, vcsa β€” virtual console memory πŸ’–

okay bestie so this is vcs(4), straight out of the Kernel Interfaces Manual, and it's literally about peeking into the memory of your virtual console terminals. it's giving "backstage pass to your own screen" and i'm obsessed. πŸŽ€


✨ NAME ✨

vcs, vcsa β€” virtual console memory. that's the whole vibe. πŸ’…


🌸 DESCRIPTION 🌸

okay so <hotpink>/dev/vcs0 is a character device, right? major number 7, minor number 0, usually mode 0644 and owned by root:tty. and what it refers to is the memory of the virtual console terminal that's currently on display. main character energy, lowkey. πŸ‘‘

then <hotpink>/dev/vcs[1-63] are the character devices for the virtual console terminals β€” major number 7, minor numbers 1 to 63, usually mode 0644, owned by root:tty. same deal.

and <hotpink>/dev/vcsa[0-63]? same thing, but the difference is everything: they use unsigned shorts (in host byte order) that include attributes, and they're prefixed with four bytes giving you the screen dimensions and cursor position: lines, columns, x, y. and just so we're clear, x = y = 0 is the top left corner of the screen. πŸ¦‹

when a 512-character font is loaded, that 9th bit position can be fetched by applying the ioctl(2) VT_GETHIFONTMASK operation (available since Linux 2.6.18) on <hotpink>/dev/tty[1-63]. the value gets returned in the unsigned short pointed to by the third ioctl(2) argument. fr fr, that's where it lives. πŸ’œ

these devices replace the screendump ioctl(2) operations of ioctl_console(2), which means the system administrator can control access using filesystem permissions. iconic behaviour honestly β€” permissions gating is the slay. πŸ”₯

the devices for the first eight virtual consoles may be created by:

for x in 0 1 2 3 4 5 6 7 8; do
    mknod -m 644 /dev/vcs$x c 7 $x;
    mknod -m 644 /dev/vcsa$x c 7 $[$x+128];
done
chown root:tty /dev/vcs*
⚠️ and then the part that's giving absolutely nothing: no ioctl(2) requests are supported. periodt. don't even try it bestie, there's nothing there. πŸ’€

πŸŽ€ FILES πŸŽ€

  • <hotpink>/dev/vcs[0-63]
  • <hotpink>/dev/vcsa[0-63]

🌈 VERSIONS 🌈

introduced with Linux 1.1.92. vintage but make it fierce. ✨


πŸ’… EXAMPLES πŸ’…

okay so you wanna do a screendump on vt3? the move is: switch to vt1 and type

cat /dev/vcs3 >foo
πŸ“ heads up bestie: the output does not contain newline characters, so some processing may be required. it's giving "raw data, no chaser". like in
fold -w 81 /dev/vcs3 | lpr

or (horrors) 😭

setterm -dump 3 -file /proc/self/fd/1

also, <hotpink>/dev/vcsa0 is used for Braille support. accessibility queen. πŸ‘‘

this program displays the character and screen attributes under the cursor of the second virtual console, then changes the background color there. so it reads, it reports, and then it alters reality. main character moment. 🧚

#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/vt.h>

int
main(void)
{
    int fd;
    char *device = "/dev/vcsa2";
    char *console = "/dev/tty2";
    struct {unsigned char lines, cols, x, y;} scrn;
    unsigned short s;
    unsigned short mask;
    unsigned char attrib;
    int ch;

    fd = open(console, O_RDWR);
    if (fd < 0) {
        perror(console);
        exit(EXIT_FAILURE);
    }
    if (ioctl(fd, VT_GETHIFONTMASK, &mask) < 0) {
        perror("VT_GETHIFONTMASK");
        exit(EXIT_FAILURE);
    }
    (void) close(fd);
    fd = open(device, O_RDWR);
    if (fd < 0) {
        perror(device);
        exit(EXIT_FAILURE);
    }
    (void) read(fd, &scrn, 4);
    (void) lseek(fd, 4 + 2*(scrn.y*scrn.cols + scrn.x), SEEK_SET);
    (void) read(fd, &s, 2);
    ch = s & 0xff;
    if (s & mask)
        ch |= 0x100;
    attrib = ((s & ~mask) >> 8);
    printf("ch=%#03x attrib=%#02x\n", ch, attrib);
    s ^= 0x1000;
    (void) lseek(fd, -2, SEEK_CUR);
    (void) write(fd, &s, 2);
    exit(EXIT_SUCCESS);
}

🫢 SEE ALSO 🫢


and that's the whole page bestie, no notes. this one came from Linux man-pages 6.20, dated 2026-02-08 β€” so go forth and screendump responsibly. mwah. πŸ’–βœ¨πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ“œ the page's license: GPL-2.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms