Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command for checking opened files?

Status
Not open for further replies.

new2unix

Programmer
Feb 5, 2001
143
0
0
US
Hi,

Is there an AIX command used to check for the total number of file (or filehandle?) currently opened? And is there a limit set some where in the OS to limit the number of file that can be opened?

Thanks,

Mike
 
man lsof [at least under Solaris] Vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
Vlad,

I checked for this command and it's not available on my AIX server.

Thanks,

Mike
 
The following works on HP-UX and Solaris in a sh shell.

To get the current system or process limits try
ulimit -a
and check for the line:
nofiles (descriptors)

This show you the soft limits. To see the hard limits (the ones you can excess) try:
ulimit -Ha

You can always lower a limit. With sufficient privilege you can raise a limit.
For example:
ulimit -Sn 256
set the S(oft) n(ofiles) limit to 256.

The change of limit is valid for the shell and each of its childs.
 
You can get lsof at:

It will list all open files. Since most everything in UNIX is a file it can do a lot. For example it can tell you about open sockets. I am pretty sure fuser can't do that.
 
I'd recommend to download lsof from ftp://vic.cc.purdue.edu/pub/tools/unix/lsof/lsof.tar.gz
or ftp://vic.cc.purdue.edu/pub/tools/unix/lsof/lsof.tar.Z
so you are sure to get the latest version directly from the source.
 
Avardan is right in saying fuser is worth a look.
'fuser -c /' should give you a list of all pids which have open files.
 
just to put flesh on the bones of the last post;
fuser -c / | wc | awk '{ NR==2; print $2 }' | read ret_val
will put the # of files opened by other processes in the / filesystem into $ret_val
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top