Clearing the Terminal Screen in Cygwin

It bugged me that Cygwin didn’t include the ‘clear’ command. This post explains that installing the ‘ncurses’ package will add clear; and also that C:l will clear the screen in bash. Thanks Hafiz!

27 thoughts on “Clearing the Terminal Screen in Cygwin”

  1. You can actually clear the screen with the following command: “cmd /c cls”. It’s kind of crude and a lot to type just to clear the screen, but it does work. It invokes the Windows command console to do its magic.

  2. Do the following…
    cd /bin
    touch clear.exe
    notpad clear.exe
    …In notepad copy…
    cmd /c cls
    …save clear.exe and exit notepad…
    …at the command line type…
    chmod 777 clear.exe
    …problem solved. You should be able to type “clear” anywhere in cygwin now and clear the screen.

  3. Itwarz:
    Literally sitting here with gmail open on one side and cygwin open on the other. Screen is messed up, and I hit C:l and think to myself “That is still a nifty little feature…”. On the left side of my screen I see an email about a comment on this post.
    Synchronicity! 🙂

  4. All it takes is adding this to the end of .bashrc:
    alias clear=’/cygdrive/c/Windows/System32/cmd.exe /c cls’
    Even easier, do it from Cygwin Bash:
    alias echo “clear=’/cygdrive/c/Windows/System32/cmd.exe /c cls'” >> ~/.bashrc

  5. oops – The “easy” part got mixed up, correction:
    echo “alias clear=’/cygdrive/c/Windows/System32/cmd.exe /c cls'” >> ~/.bashrc

  6. Following ITWARZ post,
    if you don’t want to open notepad..
    cd /bin
    touch clear.exe
    echo cmd /c cls > clear.exe
    chmod 777 clear.exe
    cheers~

  7. Albert: The alias works wonderfully well, though I had to substitute double quotes for the single quotes.

  8. During installation of Cygwin, Expand Utils and get down to the “ncurses” files. There, you will click on the skip item, to the left of the ncurses utils. And than start installation along with other packages you want to install. After finishing installation use “clear” command,you will find, now its working.
    Cheers

Leave a Reply to Brajesh Murari Cancel reply

Your email address will not be published. Required fields are marked *