Making clear work the way I think it should
For some reason the clear
command clears the terminal but not the scrollback
buffer. Here's how to fix that. Consider placing this in your
.zshrc
/.bashrc
/etc so that it's always available.
clear() {
# Invoke the original clear command
command clear
# Clear the scrollback buffer
printf '\e[3J'
}
If you enjoyed this post, please let me know on Twitter or Bluesky.
Posted November 19, 2023.