Operating System - Linux
1753275 Members
4783 Online
108792 Solutions
New Discussion юеВ

Re: Device or resource busy

 
SOLVED
Go to solution
'chris'
Super Advisor

Device or resource busy

hi

Howto check under Linux why a file or resource is busy, I mean which program is using this file?
5 REPLIES 5
Pete Randall
Outstanding Contributor
Solution

Re: Device or resource busy

I don't know. Here in HP-UX land, we sometimes use a utility called lsof. I suspect there is probably a port for you in linux land, too.


Pete

Pete
SoorajCleris
Honored Contributor

Re: Device or resource busy

will fuser help in linux ??

I dont know!!!

Regards,
Sooraj
"UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity" - Dennis Ritchie
Steven E. Protter
Exalted Contributor

Re: Device or resource busy

Shalom,

lsof started out on Linux. So lsof is a good way to find out what is occupying the resource.

fuser works to, but the HP-UX switch -c does not work on Linux, you'll need to consult the man page to work that out.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
S.N.S
Valued Contributor

Re: Device or resource busy

Chris,


Specific to your question,
lsof filename

And to see all files in use by a particular process:
lsof -p -processid

For the rest, man lsof

HTH
SNS


"Genius is 1% inspiration, 99% Perspiration" - Edison
Kranti Mahmud
Honored Contributor

Re: Device or resource busy

Hi Chris,

lsof (no options) will list all files opened by any processes currently running. To restrict this to processes owned by username,

# lsof -u username

# lsof +D /directory will show processes which have files in this directory open.

# lsof -c processname will show all processes beginning with processname that have files open;
# lsof +p PID does the same thing for a process ID.
# lsof -i will get you information about IP sockets.

Check out the man page for more detail and for the many other available options.

Rgds-Kranti
Dont look BACK as U will miss something INFRONT!