0

I'm comparing two USB devices post-rsync with md5sum /usb1/* /usb2/* | sort such that all the files, which are at the root of the drives, have their md5 sums calculated, then the output is sorted by md5sum. The entire command expands to md5sum /usb1/bigfile1 /usb1/bigfile2 /usb2/bigfile1 /usb2/bigfile2, for example. My impatience has me wondering what the progress is, i.e. which file is it working on right now? Because it's piped into another command, I have no stdout or stderr to see which file it's hashing atm. Is there some sort of command to report on what another command is doing right now?

I have this tagged with "signals", but I don't know much about signals to be comfortable interrupting the md5sum process with one. I recall it was possible to send a signal to dd to make it report progress.

2

You can use progress for this:

progress -p $(pgrep md5sum)

or, if you want to continuously monitor md5sum:

progress -m -p $(pgrep md5sum)

Without using an external tool, you can see what files md5sum is currently accessing on Linux by listing /proc/$(pgrep md5sum)/fd, and find out more information about the file descriptors (including their position, which shows how much md5sum has processed) by looking at the files in /proc/$(pgrep md5sum)/fdinfo.

As you mention, dd will print out a progress report when it receives SIGUSR1, but that’s a feature implemented by dd and not a general signal-mediated feature. By default sending SIGUSR1 to a process will kill it.

  • There is also the pv command, used like pv filename | md5sum – EkriirkE Jul 8 '17 at 10:35
  • @EkriirkE there is indeed, but in the context of this question I think progress is more appropriate since it allows the OP to track progress on a command that’s already running. – Stephen Kitt Jul 8 '17 at 12:12
0

Another command that works like cat is pv. It pumps the file content into stdout which you pipe into another program (md5sum) and the progress indication is output through stderr. Though it's only really good for 1 file at a time. Use like pv /usb1/bigfile1 | md5sum

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.