Re: Help in finding a file needed



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?

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.

Rowland.

--
Remove the animal for email address: rowland.mcdonnell@xxxxxxxxxxxxxxx
Sorry - the spam got to me
http://www.mag-uk.org http://www.bmf.co.uk
UK biker? Join MAG and the BMF and stop the Eurocrats banning biking
.



Relevant Pages

  • Re: Help in finding a file needed
    ... 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. ... COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME ...
    (uk.comp.sys.mac)
  • Re: Help in finding a file needed
    ... COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME ... running lsof, but renaming the open file instead will show the new ... TeXShop 216 rowland txt VREG ...
    (uk.comp.sys.mac)
  • Re: OSS device "/dev/dsp" is already in use by another program
    ... Try using lsof (may be installed by running `apt-get install lsof`) on the ... COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME ... You may then use kill to kill the process by pid. ...
    (Debian-User)
  • security question
    ... lsof: WARNING: can't stat() reiserfs file system /dev/.static/dev ... COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME ...
    (Debian-User)
  • Re: Drobo S problem on MacBook Pro
    ... Jolly Roger wrote: ... but the only time I have run into that is when the previous mount ... COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME ...
    (comp.sys.mac.misc)