I need a command or small script to find the pid# from the inode #. Can
anyone help?
Tom
Sent via Deja.com http://www.deja.com/
Before you buy.
Do you mean to find out what processes are using a particular file? Get
"lsof".
--
Barry Margolin, bar...@genuity.net
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
> In article <8e2beb$a5q$1...@nnrp1.deja.com>, <ray.t...@pmlmail.com> wrote:
>>I need a command or small script to find the pid# from the inode #. Can
>>anyone help?
> Do you mean to find out what processes are using a particular file? Get
> "lsof".
...or fuser on BSDish systems.
Alex.
Tom
In article <FtKA8...@t.infra.de>,
Your system may have ncheck. It's slow but it works. Otherwise, something like
ls -lRi /path/to/fsroot 2>/dev/null | grep '^ *666'
should do it for inode 666 on filesystem /path/to/fsroot.
Note that even as root you cannot determine the path of an arbitrary inode. The
directory containing a file is not recorded in the inode, and the file may even
exist in multiple directories. The file may also be unlinked from the
filesystem, but only held open by the process that has a descriptor on it. In
general it is necessary to traverse the filesystem to find the path from a file
inode, and even then you may not find it.
If the inode is a directory, your options are better, because of the ".."
entry. But you have to be root and know how to parse the filesystem. (There are
tricks you can use on some operating systems if the object is exported via NFS
and you know how to predict filehandles.)
> Tom
>
> In article <FtKA8...@t.infra.de>,
> Alexander Bochmann <a...@infra.de> wrote:
> > ...on Mon, 24 Apr 2000 22:37:33 GMT, bar...@genuity.net wrote:
> >
> > > In article <8e2beb$a5q$1...@nnrp1.deja.com>,
> <ray.t...@pmlmail.com> wrote:
> > >>I need a command or small script to find the pid# from the inode
> #. Can
> > >>anyone help?
> > > Do you mean to find out what processes are using a particular
> file? Get
> > > "lsof".
> >
> > ...or fuser on BSDish systems.
> >
> > Alex.
--
Jefferson Ogata : Internetworker, Antibozo
smtp: <og...@pobox-u-spam-u-die.com> http://www.antibozo.net/ogata/ ICQ: 19569681
whois: jo...@whois.networksolutions.com finger: og...@pobox-u-spam-u-die.com
> I used fuser to get the inode numbers of the files a
> process is using..My question was is there any easy
> way of getting the file name from inode number. ls -i
> gives you the inode numbers and file names. However,
> that would be a painfull way to get the file name from
> the inode number. Good thing would be to pass inode
> number to a command and get the file name.
> Any ideas?
Generally, no. The only portable way to get a filename from an inode
number is to search the entire fs for a file with that inode. (And
there may be more than one, due to hard links.)
But if you post back with what system you're using, someone may know
special mechanism or hack for it that you can use.
--
Nate Eldredge
neld...@hmc.edu