In Linux, While stdout
to command line, I want to update specific area, such as the apt-get
output:
54% [Waiting for headers] [Waiting for headers] 211 kB/s 3s
the percentage, kB/s and second will update each second.
If we use printf
then we will get multiple lines output them. I have tried following printf
:
printf("\e[1;1H\e[2J");
But it cleans all the output.
My question is how to update specific area and keep others stable?