tracking what files are being accessed by a process?

Christopher Browne cbbrowne-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Mon Jan 7 15:41:33 UTC 2013


On Mon, Jan 7, 2013 at 10:24 AM, Matt Price <moptop99-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org> wrote:
> hey folks,
>
> I'm having a trouble with skype on my ubuntu 12.10 laptop -- it
> monopolizes the disk with very heavy reads, and my system grinds to a
> halt.
>
> I'd like to at least check to see what it's reading, before I give up
> and stop using it; is there a simple way to do this?  thanks,
> Matt

The usual tools used for this are lsof and fuser, which have somewhat
different user
interfaces for determining processes associated with files.

fuser is in the package "psmisc"

lsof is in the package "lsof"

Alternatively, you can figure quite a bit out from what's found in /proc

Here's the file listing for the instance of firefox that I have running:

cbbrowne at cbbrowne /proc/30090/fd> ps auxww | grep firefox/firefox
cbbrowne 30090 15.6  7.0 809344 278864 pts/1   SNl  10:32   1:12
/home/cbbrowne/firefox/firefox
cbbrowne 30614  0.0  0.0   6304   604 pts/1    S+   10:39   0:00 grep
firefox/firefox
cbbrowne at cbbrowne /proc/30090/fd> cd
cbbrowne at cbbrowne ~> ps auxww | grep firefox/firefox
cbbrowne 30090 15.4  7.0 809408 279064 pts/1   SNl  10:32   1:12
/home/cbbrowne/firefox/firefox
cbbrowne 30632  0.0  0.0   6304   604 pts/1    S+   10:39   0:00 grep
firefox/firefox
cbbrowne at cbbrowne ~> cd /proc/30090/fd
cbbrowne at cbbrowne /proc/30090/fd> ls -l
total 0
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 0 -> /dev/pts/1
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 1 -> /dev/pts/1
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 10 -> socket:[1531164]
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 11 -> socket:[1531165]
lr-x------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 12 -> pipe:[1531166]
l-wx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 13 -> pipe:[1531166]
lr-x------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 14 -> pipe:[1531167]
l-wx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 15 -> pipe:[1531167]
lr-x------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 16 -> pipe:[1531168]
l-wx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 17 -> pipe:[1531168]
lr-x------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 18 -> pipe:[1531170]
l-wx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 19 -> pipe:[1531170]
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:38 2 -> /dev/pts/1
lr-x------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 20 -> /dev/urandom
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 21 -> socket:[1531172]
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 22 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/extensions.sqlite
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 23 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/extensions.sqlite-journal
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 24 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/cert8.db
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 25 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/key3.db
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 26 ->
/var/tmp/etilqs_r87bGbR5JW7sitk (deleted)
l-wx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 27 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/ybookmarks-ziVeAjt3larYtjvyW6yDsg at public.gmane.org
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 28 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/cookies.sqlite
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 29 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/cookies.sqlite-wal
lr-x------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 3 -> pipe:[1532043]
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 30 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/cookies.sqlite-shm
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 31 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/cookies.sqlite
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 32 -> socket:[1531191]
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 33 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/permissions.sqlite
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 34 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/places.sqlite
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 35 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/places.sqlite-wal
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 36 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/places.sqlite-shm
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 37 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/webappsstore.sqlite
lr-x------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 38 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/places.sqlite
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 39 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/places.sqlite-wal
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 4 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/addons.sqlite
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 40 -> socket:[1542023]
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:40 41 -> socket:[1543198]
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 42 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/ybookmarks.sqlite
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 43 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/downloads.sqlite
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 44 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/readItLater.sqlite
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 45 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/content-prefs.sqlite
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 47 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/Cache/_CACHE_MAP_
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 48 -> socket:[1532317]
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 49 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/_CACHE_CLEAN_
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 5 -> socket:[1531161]
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 50 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/Cache/_CACHE_001_
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 51 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/Cache/_CACHE_002_
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 52 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/Cache/_CACHE_003_
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 53 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/signons.sqlite
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 54 -> socket:[1531454]
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 59 -> socket:[1538271]
lr-x------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 6 -> pipe:[1531162]
l-wx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 7 -> pipe:[1531162]
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 73 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/addons.sqlite-journal
l-wx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 8 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/.parentlock
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 9 -> anon_inode:[eventpoll]
lrwx------ 1 cbbrowne cbbrowne 64 Jan  7 10:39 96 ->
/home/cbbrowne/.mozilla/firefox/cwjqkq94.default/formhistory.sqlite

Do similar for skype, and you should get some more or less interesting
information.
-- 
When confronted by a difficult problem, solve it by reducing it to the
question, "How would the Lone Ranger handle this?"
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list