{
    "mode": "man",
    "parameter": "vcs",
    "section": "4",
    "url": "https://www.chedong.com/phpMan.php/man/vcs/4/json",
    "generated": "2026-09-20T05:41:03Z",
    "sections": {
        "NAME": {
            "content": "vcs, vcsa - virtual console memory\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "/dev/vcs0  is  a  character  device with major number 7 and minor number 0, usually with mode\n0644 and ownership root:tty.  It refers to the memory of the currently displayed virtual con‐\nsole terminal.\n\n/dev/vcs[1-63] are character devices for virtual console terminals, they have major number  7\nand  minor number 1 to 63, usually mode 0644 and ownership root:tty.  /dev/vcsa[0-63] are the\nsame, but using unsigned shorts (in host byte order) that include  attributes,  and  prefixed\nwith four bytes giving the screen dimensions and cursor position: lines, columns, x, y.  (x =\ny = 0 at the top left corner of the screen.)\n\nWhen  a  512-character  font  is  loaded, the 9th bit position can be fetched by applying the\nioctl(2) VTGETHIFONTMASK operation (available since Linux  2.6.18)  on  /dev/tty[1-63];  the\nvalue is returned in the unsigned short pointed to by the third ioctl(2) argument.\n\nThese  devices  replace the screendump ioctl(2) operations of ioctlconsole(2), so the system\nadministrator can control access using filesystem permissions.\n\nThe devices for the first eight virtual consoles may be created by:\n\nfor x in 0 1 2 3 4 5 6 7 8; do\nmknod -m 644 /dev/vcs$x c 7 $x;\nmknod -m 644 /dev/vcsa$x c 7 $[$x+128];\ndone\nchown root:tty /dev/vcs*\n\nNo ioctl(2) requests are supported.\n",
            "subsections": []
        },
        "FILES": {
            "content": "/dev/vcs[0-63]\n/dev/vcsa[0-63]\n",
            "subsections": []
        },
        "VERSIONS": {
            "content": "Introduced with Linux 1.1.92.\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "You may do a screendump on vt3 by switching to vt1 and typing\n\ncat /dev/vcs3 >foo\n\nNote that the output does not contain newline characters, so some processing may be required,\nlike in\n\nfold -w 81 /dev/vcs3 | lpr\n\nor (horrors)\n\nsetterm -dump 3 -file /proc/self/fd/1\n\nThe /dev/vcsa0 device is used for Braille support.\n\nThis program displays the character and screen attributes under the cursor of the second vir‐\ntual console, then changes the background color there:\n\n#include <unistd.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <fcntl.h>\n#include <sys/ioctl.h>\n#include <linux/vt.h>\n\nint\nmain(void)\n{\nint fd;\nchar *device = \"/dev/vcsa2\";\nchar *console = \"/dev/tty2\";\nstruct {unsigned char lines, cols, x, y;} scrn;\nunsigned short s;\nunsigned short mask;\nunsigned char attrib;\nint ch;\n\nfd = open(console, ORDWR);\nif (fd < 0) {\nperror(console);\nexit(EXITFAILURE);\n}\nif (ioctl(fd, VTGETHIFONTMASK, &mask) < 0) {\nperror(\"VTGETHIFONTMASK\");\nexit(EXITFAILURE);\n}\n(void) close(fd);\nfd = open(device, ORDWR);\nif (fd < 0) {\nperror(device);\nexit(EXITFAILURE);\n}\n(void) read(fd, &scrn, 4);\n(void) lseek(fd, 4 + 2*(scrn.y*scrn.cols + scrn.x), SEEKSET);\n(void) read(fd, &s, 2);\nch = s & 0xff;\nif (s & mask)\nch |= 0x100;\nattrib = ((s & ~mask) >> 8);\nprintf(\"ch=%#03x attrib=%#02x\\n\", ch, attrib);\ns ^= 0x1000;\n(void) lseek(fd, -2, SEEKCUR);\n(void) write(fd, &s, 2);\nexit(EXITSUCCESS);\n}\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "ioctlconsole(2), tty(4), ttyS(4), gpm(8)\n\nLinux man-pages 6.7                          2023-10-31                                       vcs(4)",
            "subsections": []
        }
    },
    "summary": "vcs, vcsa - virtual console memory",
    "flags": [],
    "examples": [
        "You may do a screendump on vt3 by switching to vt1 and typing",
        "cat /dev/vcs3 >foo",
        "Note that the output does not contain newline characters, so some processing may be required,",
        "like in",
        "fold -w 81 /dev/vcs3 | lpr",
        "or (horrors)",
        "setterm -dump 3 -file /proc/self/fd/1",
        "The /dev/vcsa0 device is used for Braille support.",
        "This program displays the character and screen attributes under the cursor of the second vir‐",
        "tual console, then changes the background color there:",
        "#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, ORDWR);",
        "if (fd < 0) {",
        "perror(console);",
        "exit(EXITFAILURE);",
        "if (ioctl(fd, VTGETHIFONTMASK, &mask) < 0) {",
        "perror(\"VTGETHIFONTMASK\");",
        "exit(EXITFAILURE);",
        "(void) close(fd);",
        "fd = open(device, ORDWR);",
        "if (fd < 0) {",
        "perror(device);",
        "exit(EXITFAILURE);",
        "(void) read(fd, &scrn, 4);",
        "(void) lseek(fd, 4 + 2*(scrn.y*scrn.cols + scrn.x), SEEKSET);",
        "(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, SEEKCUR);",
        "(void) write(fd, &s, 2);",
        "exit(EXITSUCCESS);"
    ],
    "see_also": [
        {
            "name": "ioctlconsole",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/ioctlconsole/2/json"
        },
        {
            "name": "tty",
            "section": "4",
            "url": "https://www.chedong.com/phpMan.php/man/tty/4/json"
        },
        {
            "name": "ttyS",
            "section": "4",
            "url": "https://www.chedong.com/phpMan.php/man/ttyS/4/json"
        },
        {
            "name": "gpm",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/gpm/8/json"
        }
    ]
}