Clear Screen Command for BASH Shell
I am unable to use clear or cls command on bash shell. I have recently installed Cygwin and am using that for practicing unix commands.
I see that I can use Ctrl + L to clear the screen. I created an alias in my .bashrc to do the same as
alias cls='^L'
This is how i defined other aliases e.g.
alias ll='ls -l'
alias la='ls -a'
and they work. Hence I assume cls will work too but this is what I get when I try to give cls on command prompt. Am i missing something? Is there a way to do this?
$ cls
bash: $'\f': command not found
Then someone suggested, You cannot alias keystrokes to commands or vice versa. You could just alias cls to an echo command: echo -en "\x0c"
And I added the following to .bashrc,
alias cls='echo -en "\x0c"'
Sourced the .bashrc file. No errors but cls still does not clear the screen.
Infact when I typed the echo -en "\x0c on command prompt as well, nothing happened.
What does this command do? Could you explain in detail as well.
Last edited by erora; 01-21-2010 at 07:02 PM.
|