{
    "content": [
        {
            "type": "text",
            "text": "# clear (man)\n\n## NAME\n\nclear - clear the terminal screen\n\n## SYNOPSIS\n\nclear [-x] [-T terminal-type]\n\n## DESCRIPTION\n\nclear  clears  your terminal's screen and its scrollback buffer, if any.  clear retrieves the\nterminal type from the environment variable TERM, then consults the terminfo  terminal  capa‐\nbility database entry for that type to determine how to perform these actions.\n\n## TLDR\n\n> Clears the screen of the terminal.\n\n- Clear the screen:\n  `clear`\n- Clear the screen but keep the terminal's scrollback buffer (equivalent to pressing `<Ctrl l>` in Bash):\n  `clear -x`\n- Indicate the type of terminal to clean (defaults to the value of the environment variable `$TERM`):\n  `clear -T {{type_of_terminal}}`\n- Display the version of `ncurses` used by `clear`:\n  `clear -V`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS** (1 subsections)\n- **DESCRIPTION**\n- **OPTIONS** (3 subsections)\n- **PORTABILITY**\n- **HISTORY**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "clear",
        "section": "",
        "mode": "man",
        "summary": "clear - clear the terminal screen",
        "synopsis": "clear [-x] [-T terminal-type]",
        "tldr_summary": "Clears the screen of the terminal.",
        "tldr_examples": [
            {
                "description": "Clear the screen",
                "command": "clear"
            },
            {
                "description": "Clear the screen but keep the terminal's scrollback buffer (equivalent to pressing `<Ctrl l>` in Bash)",
                "command": "clear -x"
            },
            {
                "description": "Indicate the type of terminal to clean (defaults to the value of the environment variable `$TERM`)",
                "command": "clear -T {{type_of_terminal}}"
            },
            {
                "description": "Display the version of `ncurses` used by `clear`",
                "command": "clear -V"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-T",
                "long": null,
                "arg": null,
                "description": "necessary, because the terminal type is inferred from the environment variable TERM. If this option is specified, clear ignores the environment variables LINES and COLUMNS as well."
            },
            {
                "flag": "-V",
                "long": null,
                "arg": null,
                "description": "cessful status."
            },
            {
                "flag": "-x",
                "long": null,
                "arg": null,
                "description": ""
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "tput",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/tput/1/json"
            },
            {
                "name": "xterm",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/xterm/1/json"
            },
            {
                "name": "terminfo",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/terminfo/5/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": [
                    {
                        "name": "clear -V",
                        "lines": 1
                    }
                ]
            },
            {
                "name": "DESCRIPTION",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 2,
                "subsections": [
                    {
                        "name": "-T _",
                        "lines": 4,
                        "flag": "-T"
                    },
                    {
                        "name": "-V",
                        "lines": 2,
                        "flag": "-V"
                    },
                    {
                        "name": "-x",
                        "lines": 1,
                        "flag": "-x"
                    }
                ]
            },
            {
                "name": "PORTABILITY",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "HISTORY",
                "lines": 43,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "clear - clear the terminal screen\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "clear [-x] [-T terminal-type]\n",
                "subsections": [
                    {
                        "name": "clear -V",
                        "content": ""
                    }
                ]
            },
            "DESCRIPTION": {
                "content": "clear  clears  your terminal's screen and its scrollback buffer, if any.  clear retrieves the\nterminal type from the environment variable TERM, then consults the terminfo  terminal  capa‐\nbility database entry for that type to determine how to perform these actions.\n\nThe  capabilities  to  clear the screen and scrollback buffer are named “clear” and “E3”, re‐\nspectively.  The latter is a user-defined capability, applying an extension mechanism  intro‐\nduced in ncurses 5.0 (1999).\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "clear recognizes the following options.\n",
                "subsections": [
                    {
                        "name": "-T _",
                        "content": "necessary, because the terminal type is inferred from the environment variable TERM.\nIf this option is specified, clear  ignores  the  environment  variables  LINES  and\nCOLUMNS as well.\n",
                        "flag": "-T"
                    },
                    {
                        "name": "-V",
                        "content": "cessful status.\n",
                        "flag": "-V"
                    },
                    {
                        "name": "-x",
                        "content": "",
                        "flag": "-x"
                    }
                ]
            },
            "PORTABILITY": {
                "content": "Neither IEEE Std 1003.1/The Open Group Base Specifications Issue 7 (POSIX.1-2008) nor  X/Open\nCurses Issue 7 documents clear.\n\nThe  latter  documents  tput,  which could be used to replace this utility either via a shell\nscript or by an alias (such as a symbolic link) to run tput as clear.\n",
                "subsections": []
            },
            "HISTORY": {
                "content": "A clear command using the termcap database and library appeared in 2BSD (1979).  Eighth  Edi‐\ntion Unix (1985) later included it.\n\nThe commercial Unix arm of AT&T adapted a different BSD program (tset) to make a new command,\ntput, and replaced the clear program with a shell script that called “tput clear”.\n\n/usr/bin/tput ${1:+-T$1} clear 2> /dev/null\nexit\n\nIn 1989, when Keith Bostic revised the BSD tput command to make it similar to AT&T's tput, he\nadded a clear shell script as well.\n\nexec tput clear\n\nThe remainder of the script in each case is a copyright notice.\n\nIn 1995, ncurses's clear began by adapting BSD's original clear command to use terminfo.  The\nE3 extension came later.\n\n•   In  June  1999, xterm provided an extension to the standard control sequence for clearing\nthe screen.  Rather than clearing just the visible part of the screen using\n\nprintf '\\033[2J'\n\none could clear the scrollback buffer as well by using\n\nprintf '\\033[3J'\n\ninstead.  “XTerm Control Sequences” documents this feature as originating with xterm.\n\n•   A few other terminal emulators adopted it, such as PuTTY in 2006.\n\n•   In April 2011, a Red Hat developer submitted a patch to the Linux kernel,  modifying  its\nconsole  driver  to  do the same thing.  Documentation of this change, appearing in Linux\n3.0, did not mention xterm, although that program was cited in the  Red  Hat  bug  report\n(#683733) motivating the feature.\n\n•   Subsequently,  more  terminal developers adopted the feature.  The next relevant step was\nto change the ncurses clear program in 2013 to incorporate this extension.\n\n•   In 2013, the E3 capability was not exercised by “tput clear”.   That  oversight  was  ad‐\ndressed in 2016 by reorganizing tput to share its logic with clear and tset.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "tput(1), xterm(1), terminfo(5)\n\nncurses 6.4                                  2023-12-16                                     clear(1)",
                "subsections": []
            }
        }
    }
}