M
M
mkone1122021-02-19 15:36:11
linux
mkone112, 2021-02-19 15:36:11

How to always show only the last line of the output?

I want to see in the terminal only the current disk loading. The utilities that I found show the log by time like this:
602fb0390feec060373356.png
How can I make it always show only the last, most recent line?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
M
mkone112, 2021-02-19
@mkone112

So far, only such crutches:

dstat --disk-util -D sda > /tmp/dst.txt &
watch -t "tail -1 /tmp/dst.txt"

I would be glad if someone offers a better solution.

D
Dmitry, 2021-02-19
@Tabletko

man tail

S
Saboteur, 2021-02-19
@saboteur_kiev

to make dstat friends with watch, you need to read man to the end:
watch -c dstat --disk-util -D sda 1 1
Well, or you can use your hands:

clear ;while true; do tput cup 0 0; dstat --disk-util -D sda 1 1;sleep 1;done

R
Ruslan Fedoseev, 2021-02-19
@martin74ua

man watch

H
hint000, 2021-02-19
@hint000

man dstat :)
dstat -D sda 1000000

R
rPman, 2021-02-19
@rPman

atop

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question