Sponsored Content
Operating Systems Solaris How to see actual filename that File Descriptor is pointing to for a given processID? Post 302478273 by DGPickett on Tuesday 7th of December 2010 01:22:31 PM
Old 12-07-2010
Oh, you think it is the old */lost+found/* or .nsf* file for the one deleted but still open (an open file only needs an inode not a name)! I'd think lsof would find the real residual file, not pretend it was some directory. The man says sometimes you get the mount point not the path:

Man Page for lsof (Linux Section 8) - The UNIX and Linux Forums

Code:
       NODE      is the node number of a local file;
 
          or the inode number of an NFS file in the server host;
 
          or the Internet protocol type - e. g, ``TCP'';
 
          or ``STR'' for a stream;
 
          or ``CCITT'' for an HP-UX x.25 socket;
 
          or the IRQ or inode number of a Linux AX.25 socket device.
 
       NAME      is  the name of the mount point and file system on which the
          file resides;
 
          or the name of a file specified in the names    option    (after
          any symbolic links have been resolved);
 
          or the name of a character special or block special device;
 
          or  the  local  and  remote  Internet addresses of a network
          file; the local host name or IP  number  is  followed  by  a
          colon  (':'),  the  port,  ``->'',  and  the two-part remote
          address; IP addresses may be reported as numbers  or    names,
          depending  on  the +|-M, -n, and -P options; colon-separated
          IPv6    numbers  are  enclosed    in   square   brackets;   IPv4
          INADDR_ANY  and  IPv6 IN6_IS_ADDR_UNSPECIFIED addresses, and
          zero port numbers are represented by an  asterisk  ('*');  a
          UDP  destination  address  may  be followed by the amount of
          time elapsed since the last packet was sent to the  destina-
          tion;  TCP, UDP and UDPLITE remote addresses may be followed
          by  TCP/TPI  information  in    parentheses  -    state    (e.g.,
          ``(ESTABLISHED)'',  ``(Unbound)''),  queue sizes, and window
          sizes (not all dialects) - in a fashion similar to what net-
          stat(1)  reports;  see  the  -T  option  description    or the
          description of the TCP/TPI field in OUTPUT  FOR  OTHER  PRO-
          GRAMS  for more information on state, queue size, and window
          size;
 
          or the address or name of a  UNIX  domain  socket,  possibly
          including a stream clone device name, a file system object's
          path name, local and foreign kernel addresses,  socket  pair
          information, and a bound vnode address;
 
          or the local and remote mount point names of an NFS file;
 
          or ``STR'', followed by the stream name;
 
          or  a  stream  character device name, followed by ``->'' and
          the stream name or a list of stream module names,  separated
          by ``->'';
 
          or ``STR:'' followed by the SCO OpenServer stream device and
          module names, separated by ``->'';
 
          or system directory name, `` -- '', and as  many  components
          of the path name as lsof can find in the kernel's name cache
          for selected dialects (See the KERNEL NAME CACHE section for
          more information.);
 
          or ``PIPE->'', followed by a Solaris kernel pipe destination
          address;
 
          or ``COMMON:'', followed by  the  vnode  device  information
          structure's device name, for a Solaris common vnode;
 
          or  the  address family, followed by a slash (`/'), followed
          by fourteen comma-separated  bytes  of  a  non-Internet  raw
          socket address;
 
          or  the  HP-UX  x.25    local address, followed by the virtual
          connection number (if any), followed by the  remote  address
          (if any);
 
          or ``(dead)'' for disassociated Tru64 UNIX files - typically
          terminal files that have been  flagged  with    the  TIOCNOTTY
          ioctl and closed by daemons;
 
          or ``rd=<offset>'' and ``wr=<offset>'' for the values of the
          read and write offsets of a FIFO;
 
          or ``clone n:/dev/event'' for SCO OpenServer file clones  of
          the /dev/event device, where n is the minor device number of
          the file;
 
          or ``(socketpair: n)'' for a Solaris 2.6, 8, 9  or  10  UNIX
          domain  socket,  created by the socketpair(3N) network func-
          tion;
 
          or ``no PCB'' for socket files that do not have  a  protocol
          block  associated  with  them,  optionally  followed    by ``,
          CANTSENDMORE'' if sending on the socket has  been  disabled,
          or  ``,  CANTRCVMORE''  if  receiving on the socket has been
          disabled (e.g., by the shutdown(2) function);
 
          or the local and remote addresses of a Linux IPX socket file
          in  the  form <net>:[<node>:]<port>, followed in parentheses
          by the transmit and receive queue sizes, and the  connection
          state;
 
          or  ``dgram''  or ``stream'' for the type UnixWare 7.1.1 and
          above in-kernel UNIX domain sockets,    followed  by  a  colon
          (':')  and  the  local path name when available, followed by
          ``->'' and the remote path name or kernel socket address  in
          hexadecimal when available

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

file activity (open/closed) file descriptor info using KORN shell scripting

I am trying to find a way to check the current status of a file. Such as some cron job processes are dependent on the completion of others. if a file is currently being accessed / modified or simply open state I will wait until it is done being processed before attempting the next process on that... (3 Replies)
Discussion started by: Gary Dunn
3 Replies

2. UNIX for Dummies Questions & Answers

File Descriptor Help

What is a file descriptor in Unix?? How to find a file descriptor of a file in Unix?? Does it have anything to do with the Inode numbers?? (3 Replies)
Discussion started by: rahulrathod
3 Replies

3. Shell Programming and Scripting

File Descriptor

Hello All, Im opening a file desciptor in perl and sending data using print CMD "$xyz". is there a limit to the length of the string that I can give to this CMD at a time. (3 Replies)
Discussion started by: rimser9
3 Replies

4. UNIX for Dummies Questions & Answers

File Descriptor

Hi What the below path contains? /proc/<pid>/fd (1 Reply)
Discussion started by: siba.s.nayak
1 Replies

5. Shell Programming and Scripting

How to create a user interface pointing to a file?

I have to create a user interface in which user can easily update ,delete or insert a new record which is pointing to a file in AIX Server? Using awk,sed ican update ,modify the file. how to create a link to userlike GUI(without using Tomcat,IIS) (3 Replies)
Discussion started by: laknar
3 Replies

6. Shell Programming and Scripting

Open the file and replace the variable with actual value

Hi, i have a sql file named sample.sql. The query is given below. select count(*) from $TABLE_NAME In the main script, i am sourcing this sql. I need to replace the $TABLE_NAME with actual value, before running the query. How can i achieve that? The logic i tried is given below:... (3 Replies)
Discussion started by: bharathappriyan
3 Replies

7. Solaris

Before I delete any file in Unix, How can I check no open file handle is pointing to that file?

I know how to check if any file has a unix process using a file by looking at 'lsof <fullpath/filename>' command. I think using lsof is very expensive. Also to make it accurate we need to inlcude fullpath of the file. Is there another command that can tell if a file has a truely active... (12 Replies)
Discussion started by: kchinnam
12 Replies

8. Shell Programming and Scripting

Unlink and copy actual file

Hello, I have a set of directories, which has inside them, symbolic links to some files. What i would like to do is to covert the links into actual files, i.e. remove the link and copy the actual file here... I tried to see unlink command but i think all it does is delete the link, is... (2 Replies)
Discussion started by: prasbala
2 Replies

9. Shell Programming and Scripting

redirecting with file descriptor

hello, Someone can help me with redirectors? I am writing this script in bash enviroment on Fedora: exec 4<> /dev/tcp/10.10.11.30/5000 #open socket in input/output strings<&4 >file.txt & I send file descriptor 4 to string command to purge data stream from special char while come from... (3 Replies)
Discussion started by: rattoeur
3 Replies

10. Shell Programming and Scripting

Actual SQL instead of using a file from within a shell script

I am very noobish to UNIX, our guy is on vacation so I am trying to take up some slack while he is away. Typically when we use sql from within a shell script, we do so from a file containing the sql. Example: $ORACLE_HOME/bin/sqlplus $ORA_DBCU/$ORA_DBCP @${cron_dir}/${report_file}.sql ... (10 Replies)
Discussion started by: biobill
10 Replies
All times are GMT -4. The time now is 10:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy