Tuesday, February 12, 2013

How to check if a file is being accessed by any process ?

Use 'lsof' command with the following syntax:
# lsof -f -- <path of file name>

Example:
linuxmach# lsof -f -- /var/log/secure
COMMAND  PID USER   FD   TYPE DEVICE  SIZE   NODE NAME
syslogd 3065 root    3w   REG  253,0 40558 169083 /var/log/secure
linuxmach#
The file '/var/log/secure' is being accessed by "syslogd" dameon with the PID 3065 and it is being written now.

6 comments:

  1. Hi there I am so happy I found your web site, I really found you by accident,
    while I was browsing on Bing for something else, Nonetheless I am here now and would just like to
    say thanks a lot for a fantastic post and a all round thrilling blog (I also love the theme/design), I don't have time to read through it all at the minute but I have saved it and also added in your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the great work.

    Feel free to surf to my page :: payday loans reviews

    ReplyDelete
  2. I have read so many posts on the topic of the blogger lovers but this article is truly a fastidious paragraph, keep it
    up.

    Here is my site - day trading education

    ReplyDelete
  3. Howdy, There's no doubt that your blog may be having internet browser compatibility problems. Whenever I look at your blog in Safari, it looks fine however, when opening in Internet Explorer, it has some overlapping issues. I simply wanted to give you a quick heads up! Apart from that, excellent site!

    Have a look at my blog post; cedar finance binary options how it works

    ReplyDelete
  4. I do agree with all the concepts you have presented on your post.
    They're very convincing and can definitely work. Still, the posts are very quick for beginners. May just you please prolong them a bit from next time? Thank you for the post.

    My web page; kids folding table and chairs furniture

    ReplyDelete
  5. Good post..!

    Br,
    Jay
    chandranjoy@gmail.com
    www.innovationframes.com/phpbb

    ReplyDelete