Live data from Hacker News

Clear Your Terminal in Style

adammusciano.com

1–10 of 133 posts

Re: Clear Your Terminal in Style

#3
post #2

It may not be stylish, but I was very happy when I realised that CTRL+L will clear the screen, decent speed up if you're doing a load of demos and want the cursor at the top of the terminal

Unfortunately, Emacs uses CTRL+L to scroll the text buffer so that the caret is in the center. This collision means I often clear terminals by accident.

Re: Clear Your Terminal in Style

#4
Any kind of delay will turn into an annoyance.

If it doesn't, then the randomness will make it a dopamine hit / that somehow makes your brain feel rewarded. Which will lead to more terminal clearing. Not sure if that's the thing you want :-)

I'd stick with CTRL+L instead.

Re: Clear Your Terminal in Style

#6
The square brackets for arithmetic conditionals in bash are deprecated. Rather than:

    [ $[$RANDOM % 10] = 0 ]
...you can use double-parentheses. Therein, you can omit the `$` on variables and, remember, the expression evaluates to true for any non-zero value. Thus, instead:

    (( RANDOM % 10 ))

Re: Clear Your Terminal in Style

#7

I've just used alias c=clear in my .bashrc and never looked back. Not even Ctrl+L feels as convenient as c+Enter

the full monty: alias c='echo -e "\033c" ; stty sane; setterm -reset; reset; tput reset; clear'

doesn't only clear the screen, but also escape any "broken" terminal configuration such as output of a binary on the tty

Re: Clear Your Terminal in Style

#9
I think an ideal clearing style would have the resulting shell prompt as an element of the animation. Let's say you've get the matrix digital rain, which resolves into just the prompt "raining" and then resolving into the regular text. Or just the prompt easing/fading in after the main loop.

But yes, most of the animations are quite a bit too long. I wouldn't mind a quick Star Wars diagonal wipe, though, to be honest.

Post reply on HN