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!
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.
ctrl + l does the samething
ctrl + l does the samething if you are using bash
Thank you, I only had the abbreviation in there.
Do the following…
…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.
PS- “notpad” clear.exe should be “notepad” clear.exe. Sorry. 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.
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
Thanx a lot ITWARZ, with clear.exe notepad installed, Clear command works…THANX again
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
oops – The “easy” part got mixed up, correction:
echo “alias clear=’/cygdrive/c/Windows/System32/cmd.exe /c cls’” >> ~/.bashrc
Following ITWARZ post,
if you don’t want to open notepad..
echo cmd /c cls > clear.exe
chmod 777 clear.exe
Install ncurses… It includes the clear command
Sandy, Ctrl+L worked for me.
@ITWARZ : You rock. You are amazing. All praise to you!
Albert: The alias works wonderfully well, though I had to substitute double quotes for the single quotes.
If you right click on the terminal one of the menu options is reset…the keyboard shortcut is Alt+F8.
Notify me of followup comments via e-mail