Re: Help in finding a file needed



On 2008-02-05 19:36:35 +0000, real-address-in-sig@xxxxxxxxxxxxxxx (Rowland McDonnell) said:

Chris Ridd <chrisridd@xxxxxxx> wrote:

(Rowland McDonnell) said:

It's like this. I've got a file on disc called:

mdwtab.pdf

It's a TeX-related file.

I'd like to find where it is on disc. I've got the file open using:

texdoc mdwtab

The lsof program will tell you this information, as it asks the kernel
and the kernel absolutely knows what programs have what files and
network connections open.

Righto.

With a file "mysterious.pdf" open in Preview - I don't have texdoc -
just grep for the filename in lsof's output. (The ^COMMAND stuff is to
match the column headers on the first line of output.)

Yur.

^ for `start of line', | for `or', yes?

Exactly so.

lsof | egrep '^COMMAND|mysterious.pdf'
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Preview 41412 cjr txt REG 14,2 574303 9029878
/path/to/mysterious.pdf

Voila. Interestingly, you get the same output if you rm the file before
running lsof, but renaming the open file instead will show the new
name. I guess the filename printed is the last valid one.

Aha!

What I see is this:

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
TeXShop 216 rowland txt VREG
stat(/private/tmp/TeXShop_Output/mdwtab.pdf): No such file or directory

Which is a pretty clear explanation of the state of things - if not the
reason for that state.

Tiger's lsof obviously behaves a little differently from Leopard's, but at least you've got a bit more info now.

Cheers,

Chris

.