From owner-freebsd-questions Wed Feb 10 11:47:59 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA10033 for freebsd-questions-outgoing; Wed, 10 Feb 1999 11:47:59 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from alpha.comkey.com.au (alpha.comkey.com.au [203.9.152.215]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id LAA09983 for ; Wed, 10 Feb 1999 11:47:47 -0800 (PST) (envelope-from gjb@comkey.com.au) Received: (qmail 23068 invoked by uid 1001); 10 Feb 1999 19:22:46 -0000 Message-ID: <19990210192246.23067.qmail@alpha.comkey.com.au> X-Posted-By: GBA-Post 1.04 06-Feb-1999 X-PGP-Fingerprint: 5A91 6942 8CEA 9DAB B95B C249 1CE1 493B 2B5A CE30 Date: Thu, 11 Feb 1999 05:22:46 +1000 From: Greg Black To: cjclark@home.com Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Get Filename from Inode References: <199902101732.MAA16082@cc942873-a.ewndsr1.nj.home.com> In-reply-to: <199902101732.MAA16082@cc942873-a.ewndsr1.nj.home.com> of Wed, 10 Feb 1999 12:32:14 EST Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > I have some error messages reporting problems with files by their > inode numbers. However, I have been unable to figure out how to locate > the files. Despite my best efforts with man and apropos, I cannot find > a command to do the 'reverse-lookup' of a filename from an inode. I > have not even found a C function for it to write my own > quick-n-dirty executable. > > Some quick help? The canonical answer is to use find(1), which has a "-inum n" expression. You need to know which file system your target file is in or you may get confusing results -- inode numbers are only unique on a single filesystem. If you know which directory the files are in, a simpler way is with the "-i" option to ls(1). You don't need it for this exercise, since find can certainly do what you want, but if you ever decide that you need to write code yourself to walk the file system, the man page to start with is fts(3) which describes the routines used by find and ls. > PS: 'man inode' refers to a , but I have no > /usr/include/sys/inode/.h file. Is this normal? Or manpage not > up-to-date? Of course you don't have "/usr/include/sys/inode/.h" -- the expression "" refers to "/usr/include/sys/inode.h" which you may or may not have -- it doesn't exist on 2.2.8, but then the 2.2.8 man page refers to "" and 2.2.8 does have "/usr/include/ufs/ufs/inode.h", as you would expect. Not that any of these files will tell you what you want to know. -- Greg Black To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message