Skip to content

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!

18 Comments

  1. Bob wrote:

    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.

    Thursday, April 22, 2010 at 12:14 pm | Permalink
  2. sandy wrote:

    ctrl + l does the samething

    Monday, September 20, 2010 at 1:02 am | Permalink
  3. sandy wrote:

    ctrl + l does the samething if you are using bash

    Monday, September 20, 2010 at 1:14 am | Permalink
  4. Grant wrote:

    Sandy:

    Thank you, I only had the abbreviation in there.

    Monday, September 20, 2010 at 7:44 am | Permalink
  5. ITWARZ wrote:

    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.

    Friday, December 17, 2010 at 9:56 am | Permalink
  6. ITWARZ wrote:

    PS- “notpad” clear.exe should be “notepad” clear.exe. Sorry. itwarz

    Friday, December 17, 2010 at 10:00 am | Permalink
  7. Grant wrote:

    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! :)

    Friday, December 17, 2010 at 10:07 am | Permalink
  8. Albert wrote:

    alias clear=’echo -n ^[[2J’
    (where \^[\ is CTRL+V followed by ESQ key). So, keys separated by comas:
    ^[[2J = CTRL+V;ESC;[;2;J

    Other ways: http://cygwin.com/ml/cygwin/1997-07/msg00011.html

    It’s not polite use windows cls.exe in cygwin, is it? xD

    Regards.

    Friday, January 21, 2011 at 6:28 am | Permalink
  9. JP wrote:

    Thanx a lot ITWARZ, with clear.exe notepad installed, Clear command works…THANX again

    Saturday, February 12, 2011 at 2:06 pm | Permalink
  10. Will Grasmick wrote:

    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

    Monday, May 23, 2011 at 12:06 pm | Permalink
  11. Will Grasmick wrote:

    oops – The “easy” part got mixed up, correction:

    echo “alias clear=’/cygdrive/c/Windows/System32/cmd.exe /c cls’” >> ~/.bashrc

    Monday, May 23, 2011 at 12:07 pm | Permalink
  12. Gene wrote:

    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~

    Wednesday, June 22, 2011 at 2:01 am | Permalink
  13. Chris wrote:

    Install ncurses… It includes the clear command

    Tuesday, March 20, 2012 at 9:58 pm | Permalink
  14. Grant wrote:

    Chris:

    Thanks.

    Wednesday, March 21, 2012 at 6:43 am | Permalink
  15. somguyinbaltimore wrote:

    Sandy, Ctrl+L worked for me.

    Tuesday, July 17, 2012 at 9:39 pm | Permalink
  16. Jimmy C wrote:

    @ITWARZ : You rock. You are amazing. All praise to you!

    Monday, November 19, 2012 at 9:11 pm | Permalink
  17. Dave D wrote:

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

    Friday, December 14, 2012 at 1:02 pm | Permalink
  18. Mungo wrote:

    If you right click on the terminal one of the menu options is reset…the keyboard shortcut is Alt+F8.

    Tuesday, April 23, 2013 at 6:56 pm | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*