Skip to main content
added 90 characters in body
Source Link
user313992
user313992

Is there a way to override clear so that it does a Ctrl-L instead of wiping all previous terminal information?

alias clear='tput -x clear'

Yes, Ctrl-L in bash (while in set -o emacs mode) does exactly the same thing.

Or you can just hardwire the escape with alias clear='printf "\033[H\033[2J"' which should work in most terminal emulators, and does not assume that you have ncurses or bash installed.

NB: the clear applet from busybox does NOT wipe off the scrollback buffer, so you don't have to do anything special if you're using some busybox-based system, as most embedded Linux systems are.

Is there a way to override clear so that it does a Ctrl-L instead of wiping all previous terminal information?

alias clear='tput -x clear'

Yes, Ctrl-L in bash (while in set -o emacs mode) does exactly the same thing.

Or you can just hardwire the escape with alias clear='printf "\033[H\033[2J"' which should work in most terminal emulators, and does not assume that you have ncurses installed.

Is there a way to override clear so that it does a Ctrl-L instead of wiping all previous terminal information?

alias clear='tput -x clear'

Yes, Ctrl-L in bash (while in set -o emacs mode) does exactly the same thing.

Or you can just hardwire the escape with alias clear='printf "\033[H\033[2J"' which should work in most terminal emulators, and does not assume that you have ncurses or bash installed.

NB: the clear applet from busybox does NOT wipe off the scrollback buffer, so you don't have to do anything special if you're using some busybox-based system, as most embedded Linux systems are.

Post Made Community Wiki
Source Link
user313992
user313992

Is there a way to override clear so that it does a Ctrl-L instead of wiping all previous terminal information?

alias clear='tput -x clear'

Yes, Ctrl-L in bash (while in set -o emacs mode) does exactly the same thing.

Or you can just hardwire the escape with alias clear='printf "\033[H\033[2J"' which should work in most terminal emulators, and does not assume that you have ncurses installed.