linux file descriptor usage

On Linux you can print info about file descriptor (ls -l /proc//fd), and file position reader (cat /proc//fdinfo).


Find mysqld pid (in this example: 1234):

$ ps -ef | grep mysqld

mysql 1234 1 0 feb12 ? 00:00:55 /usr/sbin/mysqld

Find file descriptor number of your loaded file (in this example: 45):

$ sudo ls -l /proc/1234/fd

lr-x—— 1 root root 64 Feb 13 10:56 45 -> /var/lib/mysql/db/Loaded_file.txt

Print info about that file descriptor and check number of bytes already read (in this example: 494927872):

$ cat /proc/1234/fdinfo/45

pos: 494927872

flags: 0100000

You can compare this progress indicator (in bytes) to the actual file size being loaded.