Live data from Hacker News

Progress – A Tool to Monitor Progress for Commands in Linux (2016)

tecmint.com

1–10 of 42 posts

Re: Progress – A Tool to Monitor Progress for Commands in Linux (2016)

#6
I know what I am about to say is an absolutely ugly hack, but...

If you cannot install non-standard software (example: customer owner, company operated RHEL boxes) you can get an idea of the current progress of cp/tar and similar programs by inspecting file-descriptor files in /proc.

Assuming that you have a process (like cp) with pid 1234, then in /proc/1234/fd you will find files with a number (corresponding to the file descriptor number in the context of the process) that are either symbolic links to the actual file or to socket connection (or other data structures). Let's assume that source file has fd 3 (you get this information via ls -l /proc/1234/fd )

Then, after you can cat /proc/1234/fdinfo/3 and look at the pos value: that's the position of the cursor in the file.

It's ugly and unpractical, but it should work on every Linux systems featuring basic tools.

Re: Progress – A Tool to Monitor Progress for Commands in Linux (2016)

#7
post #6

I know what I am about to say is an absolutely ugly hack, but... If you cannot install non-standard software (example: customer owner, company operated RHEL boxes) you can get an idea of the current progress of cp/tar and similar programs by inspecting file-descriptor files in /proc. Assuming that you have a process (like cp) with pid 1234, then in /proc/1234/fd you will find files with a number (corresponding to the…

This is pretty intense, but applicable to many enterprise setups!

Re: Progress – A Tool to Monitor Progress for Commands in Linux (2016)

#9
post #4

On macOS you can monitor the progress of many commands with Ctrl-T. With cp for example: $ cp Test Test2 ^T load: 3.42 cmd: cp 86526 running 0.01u 4.36s Test -> Test2 6%

Courtesy of FreeBSD’s SIGIFO https://www.freebsd.org/cgi/man.cgi?query=siginfo&sektion=3&...

Re: Progress – A Tool to Monitor Progress for Commands in Linux (2016)

#10

Usually I have used pv. https://linux.die.net/man/1/pv cp pv source > target tar tar czf images.tar.gz image1 image2 image3 | pv > target gzip pv source | gzip > target.gz # or gzip

I've just recently learned about the usefulness of PV, here is an excellent quick demonstration:

https://youtu.be/ui4DFIfqH_U

Post reply on HN