{
    "content": [
        {
            "type": "text",
            "text": "# clear (man)\n\n## NAME\n\nclear - clear the terminal screen\n\n## SYNOPSIS\n\nclear [-Ttype] [-V] [-x]\n\n## DESCRIPTION\n\nclear  clears  your  screen  if this is possible, including its scrollback buffer (if the ex‐\ntended “E3” capability is defined).  clear looks in the environment  for  the  terminal  type\ngiven by the environment variable TERM, and then in the terminfo database to determine how to\nclear the screen.\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**\n- **DESCRIPTION**\n- **OPTIONS** (3 subsections)\n- **HISTORY**\n- **PORTABILITY**\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 [-Ttype] [-V] [-x]",
        "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": "indicates the type of terminal. Normally this option is unnecessary, because the de‐ fault is taken from the environment variable TERM. If -T is specified, then the shell variables LINES and COLUMNS will also be ignored."
            },
            {
                "flag": "-V",
                "long": null,
                "arg": null,
                "description": "are as follows:"
            },
            {
                "flag": "-x",
                "long": null,
                "arg": null,
                "description": "bility."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "tput",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/tput/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": "DESCRIPTION",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-T",
                        "lines": 4,
                        "flag": "-T"
                    },
                    {
                        "name": "-V",
                        "lines": 2,
                        "flag": "-V"
                    },
                    {
                        "name": "-x",
                        "lines": 2,
                        "flag": "-x"
                    }
                ]
            },
            {
                "name": "HISTORY",
                "lines": 45,
                "subsections": []
            },
            {
                "name": "PORTABILITY",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 7,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "clear - clear the terminal screen\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "clear [-Ttype] [-V] [-x]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "clear  clears  your  screen  if this is possible, including its scrollback buffer (if the ex‐\ntended “E3” capability is defined).  clear looks in the environment  for  the  terminal  type\ngiven by the environment variable TERM, and then in the terminfo database to determine how to\nclear the screen.\n\nclear writes to the standard output.  You can redirect the standard output to a  file  (which\nprevents  clear  from  actually  clearing  the screen), and later cat the file to the screen,\nclearing it at that point.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-T",
                        "content": "indicates the type of terminal.  Normally this option is unnecessary,  because  the  de‐\nfault  is  taken from the environment variable TERM.  If -T is specified, then the shell\nvariables LINES and COLUMNS will also be ignored.\n",
                        "flag": "-T"
                    },
                    {
                        "name": "-V",
                        "content": "are as follows:\n",
                        "flag": "-V"
                    },
                    {
                        "name": "-x",
                        "content": "bility.\n",
                        "flag": "-x"
                    }
                ]
            },
            "HISTORY": {
                "content": "A clear command appeared in 2.79BSD dated February 24, 1979.  Later that was provided in Unix\n8th edition (1985).\n\nAT&T  adapted  a  different BSD program (tset) to make a new command (tput), and used this to\nreplace the clear command with a shell script which calls tput clear, e.g.,\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 the AT&T  tput,\nhe added a shell script for the clear command:\n\nexec tput clear\n\nThe remainder of the script in each case is a copyright notice.\n\nThe ncurses clear command began in 1995 by adapting the original BSD clear command (with ter‐\nminfo, of course).\n\nThe E3 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 using\n\nprintf '\\033[3J'\n\nThis is documented in XTerm Control Sequences as a feature originating with xterm.\n\n•   A few other terminal developers adopted the feature, e.g., 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.  The Linux change, part of the 3.0 release, did  not\nmention xterm, although it was cited in the Red Hat bug report (#683733) which led to the\nchange.\n\n•   Again, a few other terminal developers adopted the feature.  But the next  relevant  step\nwas a change to the clear program in 2013 to incorporate this extension.\n\n•   In  2013,  the  E3 extension was overlooked in tput with the “clear” parameter.  That was\naddressed in 2016 by reorganizing tput to share its logic with clear and tset.\n",
                "subsections": []
            },
            "PORTABILITY": {
                "content": "Neither IEEE Std 1003.1/The Open  Group  Base  Specifications  Issue   7  (POSIX.1-2008)  nor\nX/Open Curses Issue 7 documents tset or reset.\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": []
            },
            "SEE ALSO": {
                "content": "tput(1), terminfo(5)\n\nThis describes ncurses version 6.3 (patch 20211021).\n\n\n\nclear(1)",
                "subsections": []
            }
        }
    }
}