Skip to content

clear

clear()

Clear the terminal

Returns:

Type Description
int

The return code of the command

Source code in systemd_py/utils/terminal/clear.py
def clear() -> int:
    """
    Clear the terminal
    :return: The return code of the command
    :rtype: int
    """

    if os.name == 'posix':
        return subprocess.call('clear', shell=True)
    if os.name == 'nt':
        return subprocess.call('cls', shell=True)

    raise Exception(f'Unknown OS: {os.name}')