I'm running an awk script on a 100G+ file. I have a suspicion that since it never finishes it got into some kind of infinite loop.
I want to see the line that script is currently at to see if there's some problem with the data.
I tried ls -l /proc/<pid>/fd
but it just lists names of opened files.
Is there a way to find the current seek
position of an open file?
Found general solution for Linux (since 2.6.22).
ps
or its equivalent) and the number of the file descriptor of interest (look in /proc/<pid>/fd
);grep pos: /proc/<pid>/fdinfo/<fd>
# pos: 892141568
There is also a useful pv
tool that has a mode for interactively displaying the offset of an already open file:
pv -d <pid>:<fd>
# 1,10GiB 0:00:01 [1,10GiB/s] [=======================> ] 81% ETA 0:05:46
Links:
progress
- another tool showing progress for cp
, mv
, dd
, ...;