Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

pv -d $(pidof xz):1 is great for when you realize too late that something is slow enough that you want a progress indication, and definitely do not want to restart from scratch.


Another good option for that, which works in a number of other useful circumstances too, is progress: https://github.com/Xfennec/progress


How `pv -d` work ? Does it use perf probes or attach to the target PID ?


It finds the file using /proc/<pid>/fd/<num> and watches its size grow. It doesn't work with pipes, devices, a file being overwritten (not appended to), or anything whose size doesn't grow.


It does, even for reading (cat /dev/nvme0n1 > /dev/null). As per changelog:

1.5.2 - 10 February 2014 allow --watchfd to look at block devices

You can see the position in /proc/<pid>/fdinfo/<num>


It appears to monitor the contents of /proc/‹pid›/fdinfo/‹fd›




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: