Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: less with subprocess
- X-seq: zsh-users 27192
- From: Dominik Vogt <dominik.vogt@xxxxxx>
- To: Zsh-Users List <zsh-users@xxxxxxx>
- Subject: Re: less with subprocess
- Date: Fri, 1 Oct 2021 00:46:12 +0100
- Archived-at: <https://zsh.org/users/27192>
- In-reply-to: <CAP+y1xCVePc=3zKJeAuY0Z2Q0dO+42D78Jm6DN8dB4cpbnqgSA@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- Mail-followup-to: Zsh-Users List <zsh-users@xxxxxxx>
- References: <20210927233143.GA16620@gmx.de> <CAH+w=7YOFKGfihX5794JVxcXTtS_QrAFpHAmaAotJOAYO7JMzg@mail.gmail.com> <CAH+w=7ZVWU444iL0u_RLfa-ormZTos+7M8iUQo-QqowqioFzCg@mail.gmail.com> <20210928185230.GA7495@gmx.de> <CAH+w=7ZgPGYngBrDEwcGqjrJ8GuLZ0Pn6VO9jDjvWz=_MPTzrw@mail.gmail.com> <20210929130217.GB25513@cventin.lip.ens-lyon.fr> <CAH+w=7an7ATJ51o-67ztFX+ShfEbrf158+Xi7OPtrm0X82vSbg@mail.gmail.com> <20210930191706.GA1641202@zira.vinc17.org> <20210930194800.GA15560@gmx.de> <CAP+y1xCVePc=3zKJeAuY0Z2Q0dO+42D78Jm6DN8dB4cpbnqgSA@mail.gmail.com>
- Reply-to: dominik.vogt@xxxxxx
On Thu, Sep 30, 2021 at 10:59:25PM +0200, Pier Paolo Grassi wrote:
> writing on disk it can eat away all the space I have on my device and make
> other processes that need that disk space to fail. Even if disk is cheap
> doesn't mean it's always plentifully available
If you don't want to consume disk space you could use a
ramdisk/tmpfs for the temporary files. Less will gobble up memory
anyway if it gets tons of input, unless you give it the -b or -B
option.)
On the other hand I wonder what kind of command would generate an
awful lot of output quickly which can still be overlooked manually
in less. I mean, if you're only interested in the first N lines
or M bytes, you can pipe the command's output through "head -n N"
or "head -c M".
cat /dev/zero | head -c 1000000 LF
(With the global alias from an earlier message.)
--
So, what you really want is to put the producing command to sleep
while less is in "view" mode and wake it up when going to "follow"
mode? That somehow contradicts your initial request:
>> I use it like this so I am able to use ctrl-c and +F inside less to move
>> around in the output already received ...
>> ... and receive the new input received in the meantime (with +F)
^^^^^^^ ^^^^^^^^^ ^^^^^^^^^^^^^^^
--
If you *don't* want to put the producing process to sleep, it
sounds a bit like "the command shall keep running and buffer the
output in a magical bag of holding while less is in 'view' mode".
--
If you don't want the output on disk, the only options I see are
* either do not generate new data in the meantime
* or store it somewhere else (memory/ramdisk, other medium)
Ciao
Dominik ^_^ ^_^
--
Dominik Vogt
Messages sorted by:
Reverse Date,
Date,
Thread,
Author