Jump to content

CLS (OS/2 command)

From Alfawiki
Adapted from the English Wikipedia article CLS (OS/2 command), available under CC BY-SA 4.0Updated 9 August 2025

In the realm of computing, the CLS (clear screen) command is utilized by command-line interpreters such as COMMAND.COM and cmd.exe across various operating systems including DOS, Digital Research FlexOS, IBM OS/2, Microsoft Windows, and ReactOS. Its primary function is to remove all visible commands and output from the console window, while retaining the history of commands entered by the user.

This command is also implemented in the DEC RT-11 operating system, the open-source MS-DOS emulator known as DOSBox, and within the Unified Extensible Firmware Interface (EFI) shell environment. On Unix-like platforms, a comparable role is fulfilled by the clear command.

History

Since MS-DOS version 2 (released in 1983), the CLS instruction has been part of its command set. Its use, however, extends back further than MS-DOS, originating in Microsoft's embedded ROM BASIC variants designed for early 8-bit microcomputers like TRS-80 Color BASIC, where it performed an identical clearing function. Microsoft’s BASIC dialects for MS-DOS, such as BASICA and GW-BASIC, also incorporate CLS as a reserved keyword. Moreover, other BASIC variants including Sinclair BASIC and BBC BASIC adopt this command. Within Windows-based BASIC environments, CLS generally clears only text displayed on forms rather than wiping the entire application window.

Owing to its extensive recognition stemming from MS-DOS usage, CLS has become a conventional clear screen command integrated into numerous BASIC dialects and command-line interfaces.

The PC-MOS operating system by The Software Link features its own version of CLS, distributed under the terms of the GPL v3. Likewise, DR DOS offers an implementation of this command tailored to its environment.

See also

Further reading

External links