On Linux, how can I see how far through a file a process is?
You can use pv to do this e.g.
pv file | processor_application
As pv passes it's stdin directly to it's stdout you don't need to use cat.
Edit
As your program is already running then find the PID of the cat
process and then look at the contents of
/proc/<PID>/io
which will tell you how many bytes it has written - wchar.
Absolutely! Pipe Viewer does exactlty that. Just insert it in your pipeline:
cat myfile | pv | processor_application
You can optimize away the cat
in the above example:
pv myfile | processor_application
Which has the advantage of providing an actual progress indicator, since pv can determine the size of the input directly. If you do use pv in the middle of a pipeline, you need to supply the file size yourself to get accurate progress:
input_process | pv -s 100M -p | processor_application
Check the website for more options to customize pv.
If the process is already running lsof has a size/offset
column which may be helpful to you -- find the PID of the cat process you want to inspect and then lsof -o -p [PID]
.
If the process is not running yet, pv
as others suggested is a good option (assuming your system has that utility).