CLS (command)
In the realm of computing, the CLS command—short for clear screen—is utilized by command-line interpreters such as COMMAND.COM and cmd.exe across operating systems including DOS, Digital Research FlexOS, IBM OS/2, Microsoft Windows, and ReactOS. Its primary function is to clear the console display by removing previously entered commands and their output, while leaving the user's command history intact.
This command is also implemented within the DEC RT-11 operating system, the open-source MS-DOS emulator DOSBox, and the Unified Extensible Firmware Interface (EFI) shell environment. On Linux and Unix platforms, a similar role is fulfilled by the clear command.
History
The introduction of the CLS command dates back to MS-DOS version 2, released in 1983. Its roots likely extend further, originating from embedded ROM BASIC variants crafted by Microsoft for early 8-bit microcomputers such as the TRS-80 Color BASIC. This command is also found in Microsoft's MS-DOS BASIC dialects like BASICA and GW-BASIC, alongside other BASIC languages including Sinclair BASIC (1980) and BBC BASIC (1981). Within Windows-based BASIC environments, CLS generally clears text printed on forms rather than wiping entire window contents.
Thanks to its extensive recognition stemming from MS-DOS usage, CLS has become a conventional clear screen instruction adopted by numerous BASIC dialects and command-line interpreters.
The PC-MOS operating system from The Software Link features an implementation of CLS licensed under GPL v3. Likewise, DR DOS integrates the CLS command as part of its user interface toolkit.