Posted: Fri May 05, 2006 7:08 pm Post subject: View/Monitor disk activity, files access per process
Hi,
I'm on a dead end : after fiddling around with tools like ps, sar, iostat, I have not found how to display read/w bytes PER process, file descriptors (exploring /proc is not convenient...), opened files and so on.
Just an example taken from Window$ XP : taskman can easily display read/written bytes.
So, why this is such a pain to find those infos under Linux ?
Did I missed something big ?
Thx for any help !
top = list processes, much like windows taskmgr : processes
w = list logged on users, and what they are doing
ps = shows processes
lsof = list open files, by process
I guess you could consider this 'old school' UNIX : the system offers a number of small tools that do 1 thing really well, the user is supposed to be capable of choosing the correct options to get the desired output, and to combine the output of several tools to get the information he needs. That combining can be done by using other tools (pipes, filters, ...). There's an article on this elsewhere in this tutorial.
eg to see files used by a specific process:
get the process' identifier (PID) : ps
get files for this proces : lsof | grep [i]PID[/i]
to list open files by user :
lsof -u [i]username[/i]
This approach obviously differs from the Windows approach to integrate as much functionality as possible into 1 application which seems may seem better or at least more 'user-friendly' on first sight, but is a pain in the neck if you want to programatically process the output.
Thanks !!! You're the man !
lsof is the cmdline tool I was loooking for.
Have read many stuffs about linux troubleshooting and nothing about lsof...
I was aware off some utilities as top, watch (better than top), free, vmstat, ps, sar, pstack, pstree, gdb, iostat, mpstat but nothing about lsof.
I you know about some more valuable linux tools/utilities for administering or troubleshooting, please, do post anything else...
[quote]I you know about some more valuable linux tools/utilities for administering or troubleshooting, please, do post anything else...[/quote]
I'm afraid I can't. My brain doesn't work that way. Usually the things I know come back to me when I need them (or when someone posts a question in this forum that rings a bell).
I do know how to find info. In this case, I looked up some man pages - the usually have a list of related files / commands or they may inspire you for keywords that are relevant to google with.
I actually came across lsof by googling : linux list open files by user, and it returnd a manpage for lsof in the first 5 search results.
nothing to it
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
More information about the site can be found in the FAQ
Login
Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.
Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums. All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved. The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use
and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look
here