3 ms·
I have a similar but different need, wonder if anyone has the same frustrations and knows a solution: I often press enter key a few times to produce a noticeab
by n144q 2y ago
I have a similar but different need, wonder if anyone has the same frustrations and knows a solution:
I often press enter key a few times to produce a noticeable gap between different runs of the same command. Yes, in theory, the shell prompt is enough to separate the runs, and I could customize the color, font etc, but that's still not as good as a few (almost) blank lines.
The workflow is like this: often I need to run a command that produces a decent amount of output and repeat that a few times. Not 3 lines, not 1k lines, but something like 40-100 lines -- not short enough that I can easily see both the beginning and the end, not long enough that I have to log it to a file. I want to be able to scroll to the top of the output and read it.
The "multiple enter key" approach works well enough, but is a bit repetitive and sometimes I forget to do that (then can't find where the output begins). I could also append printf "\n\n\n" but apparently it's annoying. I wonder if there is something simpler and works well. The tool in this article doesn't exactly match my need, as it prints a spacer immediately after output pauses, not after a command finishes.
- ninkendo 2y agomacOS’s built-in Terminal.app has a feature I love for this, which I haven’t seen anything else replicate, which is that pressing Cmd-Up just scrolls up to the last command prompt in your scroll buffer. Just press it as many times as you want to find the beginning of previous commands you typed. I’m not sure how it’s implemented… maybe they take note of what your prompt looks like and generate a regex for it? Or maybe they take note of when the last time it was that your shell process had no child processes and read from stdin… but it works quite reliably.
- asdff 2y agoSometimes its nice to use something like tmux for this. Open a new pane for such a run and all output will be in the scroll buffer of that one pane.
- Izkata 2y agoYou could temporarily change your prompt: export PS1="\n\n\n\n\n\n$PS1" Or if the repeated prompt is part of your visual pattern matching: export PS1="$PS1\n$PS1\n$PS1\n$PS1"
- hnlmorg 2y agoI’m writing a terminal emulator that solves this (and many other) common problems with the CLI. For example, one of its features is it highlights command output so you can easily see where each commands output is. You can also collapse output too https://github.com/lmorg/mxtty https://github.com/lmorg/mxtty
- atombender 2y agoiTerm on macOS does this. It calls them "marks", and you can set them anywhere, but by default it creates a mark for each prompt. You can then jump between them with cmd-arrow. iTerm also suppers showing the timestamp of each line, and it visualizes this in a nice way where lines emitted around the same time have their timestamps replaced with a vertical line.
- kps 2y agoPersonally, I have a command called `--` that prints a terminal-wide horizontal red line using ‘━’ (U+2501 if HN eats it). So I run things like $ --; make noisy-build Then I can see the start easily when scrolling back.
- nuancebydefault 2y agoAs a windows user, the fact that hitting a button immediately would reflect inside a running output stream, feels strange. But its benefit is clearly shown here.