How to reset the terminal under Cygwin

cygwin;resetterminal

Under Linux, I can clear terminal output with a simple reset from the command line. Under Cygwin, it appears reset does not work:

enter image description here

I also tried reset 0 and reset 1 with no joy. And I even tried the native Windows' cls command with no joy.

Cygwin appears to lack any useful documentation:

$ man -k reset
reset: nothing appropriate.

$ man -k terminal
terminal: nothing appropriate.

$ man reset 1
No manual entry for reset
No manual entry for 1
(Alternatively, what manual page do you want from section 1?)

How do I reset the terminal from the command line when using Cygwin? What is missing from the command above?


A bug report was filed with Cygwin for this issue: Bug 19195: The Cygwin terminal does not respond to either 'reset' or 'cls'.

Best Answer

Under Cygwin, it appears reset does not work

  • You are running a non Cygwin version of reset.

  • You can confirm this by running where reset in a command prompt.

Notes:

  • c:\windows\system32\reset.exe is Remote Desktop Services Reset Utility

    enter image description here

  • The output you show in your question looks like it is from this version of reset (and not the Cygwin version).


Cygwin PATH setup

If you have installed the ncurses package (see below) then you need to make sure your Cygwin PATH has the Cygwin elements before the Windows elements (this should happen automatically when Cygwin is installed).

Example cygwin path:

DavidPostill@Hal /f/test
$ echo $PATH
.:/home/DavidPostill/bin:/usr/local/bin:/usr/bin:/c/ProgramData/Oracle/Java/javapath:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/apps/Calibre

Cygwin reset

The Cygwin reset is part of the ncurses package and is linked to tset.

Parameters to tset are optional.

You can determine this is on your system using:

which reset

On my system:

DavidPostill@Hal ~
$ which reset
/usr/bin/reset

DavidPostill@Hal ~
$ ll /usr/bin/reset
lrwxrwxrwx 1 DavidPostill None 8 Jul  1 08:14 /usr/bin/reset -> tset.exe

Cygwin clear is also part of ncurses. I have cls aliased as follows:

alias cls='clear'

Notes:

  • You can always find out what packages contain particular cygwin commands using Search Packages.

  • clear and reset have slightly different behaviour:

    • clear clears the visible part of the mintty display. The scrollback buffer remains as is.

    • reset sends the terminal initialization string. In the case of mintty this clears the visible part of the display and removes the scrollback buffer.


How do I check if ncurses is installed?

To see if a package is installed use cygcheck -l ncurses.

  • -l package - list contents of package (or all packages if none given)
DavidPostill@Hal /f/test
$ cygcheck -l ncurses
/usr/bin/captoinfo
/usr/bin/clear.exe
/usr/bin/infocmp.exe
/usr/bin/infotocap
/usr/bin/reset
/usr/bin/tabs.exe
/usr/bin/tic.exe
/usr/bin/toe.exe
/usr/bin/tput.exe
/usr/bin/tset.exe
/usr/share/doc/ncurses/ANNOUNCE
/usr/share/doc/ncurses/AUTHORS
/usr/share/doc/ncurses/COPYING
/usr/share/doc/ncurses/NEWS
/usr/share/doc/ncurses/README
/usr/share/man/man1/captoinfo.1m.gz
/usr/share/man/man1/clear.1.gz
/usr/share/man/man1/infocmp.1m.gz
/usr/share/man/man1/infotocap.1m.gz
/usr/share/man/man1/reset.1.gz
/usr/share/man/man1/tabs.1.gz
/usr/share/man/man1/tic.1m.gz
/usr/share/man/man1/toe.1m.gz
/usr/share/man/man1/tput.1.gz
/usr/share/man/man1/tset.1.gz

What is included in the ncurses package?

2015-05-18 21:00           0 usr/bin/
2015-05-18 20:58           0 usr/bin/captoinfo -> tic.exe
2015-05-18 21:00        9747 usr/bin/clear.exe
2015-05-18 21:00       52755 usr/bin/infocmp.exe
2015-05-18 20:58           0 usr/bin/infotocap -> tic.exe
2015-05-18 20:58           0 usr/bin/reset -> tset.exe
2015-05-18 21:00       14355 usr/bin/tabs.exe
2015-05-18 21:00       67091 usr/bin/tic.exe
2015-05-18 21:00       15379 usr/bin/toe.exe
2015-05-18 21:00       15379 usr/bin/tput.exe
2015-05-18 21:00       19475 usr/bin/tset.exe
2015-05-18 20:58           0 usr/share/doc/
2015-05-18 20:58           0 usr/share/doc/ncurses/
2015-05-18 20:58       13750 usr/share/doc/ncurses/ANNOUNCE
2015-05-18 20:58        2529 usr/share/doc/ncurses/AUTHORS
2015-05-18 20:58        1408 usr/share/doc/ncurses/COPYING
2015-05-18 20:58      549943 usr/share/doc/ncurses/NEWS
2015-05-18 20:58       10212 usr/share/doc/ncurses/README
2015-05-18 20:59           0 usr/share/man/man1/
2015-05-18 20:57        2919 usr/share/man/man1/captoinfo.1m.gz
2015-05-18 20:57        1201 usr/share/man/man1/clear.1.gz
2015-05-18 20:57        6976 usr/share/man/man1/infocmp.1m.gz
2015-05-18 20:57        1594 usr/share/man/man1/infotocap.1m.gz
2015-05-18 20:59          39 usr/share/man/man1/reset.1.gz
2015-05-18 20:57        2288 usr/share/man/man1/tabs.1.gz
2015-05-18 20:57        5995 usr/share/man/man1/tic.1m.gz
2015-05-18 20:57        1883 usr/share/man/man1/toe.1m.gz
2015-05-18 20:57        4540 usr/share/man/man1/tput.1.gz
2015-05-18 20:57        4971 usr/share/man/man1/tset.1.gz

Source ncurses: Terminal display utilities (installed binaries and support files)

Related Question