Live data from Hacker News

Clear Your Terminal in Style

adammusciano.com

51–60 of 133 posts

Re: Clear Your Terminal in Style

#51

This one should really have a massive "do not try this": [ $[$RANDOM % 6] = 0 ] && sudo rm -rf / || echo "Not today" An awful lot of people just copy and paste things to see what'll happen.

I agree. However, in this case I believe most versions of rm would complain about passing "/" as an argument without also passing "--no-preserve-root", so there's that at least.

Re: Clear Your Terminal in Style

#54
Cool tool, but as someone who actually works in the terminal, I would hate this after one use. Maybe alias it to `explody_clear` for fun use every once in a while.

If I want the terminal cleared, I want it cleared immediately so that I can go about my next task, or wipe sensitive data from my screen. Adding a delay to the task will annoy me immediately.

Re: Clear Your Terminal in Style

#55
post #50
post #42

Earlier quoted context omitted.

> Ctrl+L works when a program is running. Clear does not. I can't see how because ctrl+l is a $SHELL / readline shortcut rather than one defined in the terminal emulator. Once you run a program you're forking STDIN control to another process so you'd have to wait for the $SHELL / readline prompt again just like you would if you typed a command / function / alias into the command prompt.

Is ctrl+c handled; by the terminal emulator? ctrl+l allows to clear when the prompt is non-empty, maybe parent poster meant that

I'm not 100% sure how ctrl+c (and ctrl+z) are handled but I do know they're edge cases because they're managed by the kernel and are not re-definable.

Re: Clear Your Terminal in Style

#56

Earlier quoted context omitted.

I have mapped capslock to ctrl (esc if used without modifiers) which made ctrl+L extremely comfortable for me.

I don’t quite understand why. With one hand or two?

Left pinky for ctrl (capslock) and right ring finger for L. Works incredibly well for my hands (a quality keyboard helps too). The capslock mapping is obviously meant for vim but works great for many shortcuts like this (ideally there would be a second ctrl/esc and other modifiers to operate with right pinky comfortably, starting my first custom build soon...).

Re: Clear Your Terminal in Style

#57
post #3

Earlier quoted context omitted.

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.

All the more reason for you to finally bite the bullet and make the switch to the superior editor /s

... where Control+L means repeat previous find/replace. (-:

Re: Clear Your Terminal in Style

#58
> [ $[$RANDOM % 10] = 0 ] && do_this || do_that

> This gives roughly a 1 in 10 chance of do_this running, and a 9 in 10 chance of do_that running.

`do_that` having a 9 in 10 chance depends on `do_this` having a 0 chance of returning a falsy status.

Re: Clear Your Terminal in Style

#59
post #17

I’d just settle for macOS’ Terminal.app’s ⌘-K, that resets the terminal, and clears all the screen including scroll back window. Something so basic I have it in muscle memory but I haven’t found the equivalent in Linux terminals.

You don't know ctrl+L?

Re: Clear Your Terminal in Style

#60
post #18

Earlier quoted context omitted.

It's also super helpful when you want to run one command which spews out a bunch of errors, and then read the first error. Cmd-K, enter, and fling up the the trackpad. I think I'd have to pipe to less if I don't have cmd-K.

Cmd up and down navigates between prompts, so you don’t even have to scroll

This changes everything!
Post reply on HN