Fstat
From FreeBSDwiki
(Difference between revisions)
DrModiford (Talk | contribs) m (Slight changes) |
DrModiford (Talk | contribs) m (Religning the collumns due to format / pasting problem) |
||
Line 10: | Line 10: | ||
%'''fstat -u joeuser''' | %'''fstat -u joeuser''' | ||
− | USER | + | USER CMD PID FD MOUNT INUM MODE SZ|DV R/W |
− | joeuser fstat 96741 root / 2 drwxr-xr-x 512 | + | joeuser fstat 96741 root / 2 drwxr-xr-x 512 r |
− | joeuser fstat 96741 wd /usr | + | joeuser fstat 96741 wd /usr 2378753 drwxr-xr-x 512 r |
− | joeuser fstat 96741 text /usr | + | joeuser fstat 96741 text /usr 2308260 -r-xr-sr-x 14340 r |
− | joeuser fstat 96741 0 /dev 93 crw--w---- ttyp0 rw | + | joeuser fstat 96741 0 /dev 93 crw--w---- ttyp0 rw |
− | joeuser fstat 96741 1 /dev 93 crw--w---- ttyp0 rw | + | joeuser fstat 96741 1 /dev 93 crw--w---- ttyp0 rw |
− | joeuser fstat 96741 2 /dev 93 crw--w---- ttyp0 rw | + | joeuser fstat 96741 2 /dev 93 crw--w---- ttyp0 rw |
− | joeuser fstat 96741 3 /dev 26 crw-r----- mem | + | joeuser fstat 96741 3 /dev 26 crw-r----- mem r |
− | joeuser fstat 96741 4 /dev 27 crw-r----- kmem | + | joeuser fstat 96741 4 /dev 27 crw-r----- kmem r |
− | joeuser fstat 96741 5 / 25179 -rw-r--r-- 40960 | + | joeuser fstat 96741 5 / 25179 -rw-r--r-- 40960 r |
− | joeuser csh 760 root / 2 drwxr-xr-x 512 | + | joeuser csh 760 root / 2 drwxr-xr-x 512 r |
− | joeuser csh 760 wd /usr | + | joeuser csh 760 wd /usr 2378753 drwxr-xr-x 512 r |
− | joeuser csh 760 text / 16628 -r-xr-xr-x 293060 | + | joeuser csh 760 text / 16628 -r-xr-xr-x 293060 r |
− | joeuser csh 760 15 /dev 93 crw--w---- ttyp0 rw | + | joeuser csh 760 15 /dev 93 crw--w---- ttyp0 rw |
− | joeuser csh 760 16 /dev 93 crw--w---- ttyp0 rw | + | joeuser csh 760 16 /dev 93 crw--w---- ttyp0 rw |
− | joeuser csh 760 17 /dev 93 crw--w---- ttyp0 rw | + | joeuser csh 760 17 /dev 93 crw--w---- ttyp0 rw |
− | joeuser csh 760 18 /dev 93 crw--w---- ttyp0 rw | + | joeuser csh 760 18 /dev 93 crw--w---- ttyp0 rw |
− | joeuser csh 760 19 /dev 93 crw--w---- ttyp0 rw | + | joeuser csh 760 19 /dev 93 crw--w---- ttyp0 rw |
− | joeuser sshd 759 root / 2 drwxr-xr-x 512 | + | joeuser sshd 759 root / 2 drwxr-xr-x 512 r |
− | joeuser sshd 759 wd / 2 drwxr-xr-x 512 | + | joeuser sshd 759 wd / 2 drwxr-xr-x 512 r |
− | joeuser sshd 759 text /usr | + | joeuser sshd 759 text /usr 1318917 -r-xr-xr-x 180452 r |
− | joeuser sshd 759 0 /dev 6 crw-rw-rw- null rw | + | joeuser sshd 759 0 /dev 6 crw-rw-rw- null rw |
− | joeuser sshd 759 1 /dev 6 crw-rw-rw- null rw | + | joeuser sshd 759 1 /dev 6 crw-rw-rw- null rw |
− | joeuser sshd 759 2 /dev 6 crw-rw-rw- null rw | + | joeuser sshd 759 2 /dev 6 crw-rw-rw- null rw |
joeuser sshd 759 3* internet stream tcp c23cf1d0 | joeuser sshd 759 3* internet stream tcp c23cf1d0 | ||
joeuser sshd 759 4* local stream c23b47a8 <-> c23b4c94 | joeuser sshd 759 4* local stream c23b47a8 <-> c23b4c94 | ||
− | joeuser sshd 759 5* pipe c2335660 <-> c2335718 0 rw | + | joeuser sshd 759 5* pipe c2335660 <-> c2335718 0 rw |
− | joeuser sshd 759 6* pipe c2335718 <-> c2335660 0 rw | + | joeuser sshd 759 6* pipe c2335718 <-> c2335660 0 rw |
− | joeuser sshd 759 7 /dev 92 crw-rw-rw- ptyp0 rw | + | joeuser sshd 759 7 /dev 92 crw-rw-rw- ptyp0 rw |
− | joeuser sshd 759 8 /dev 92 crw-rw-rw- ptyp0 rw | + | joeuser sshd 759 8 /dev 92 crw-rw-rw- ptyp0 rw |
− | joeuser sshd 759 9 /dev 92 crw-rw-rw- ptyp0 rw | + | joeuser sshd 759 9 /dev 92 crw-rw-rw- ptyp0 rw |
=== See also === | === See also === |
Revision as of 07:51, 4 January 2008
fstat is a command similar to the lsof command Linux users are familiar with. Simply put, it returns a list of all open files and what user context they've been opened in. Handy arguments:
fstat -f /usr/local/etc - only return locked files from the filesystem containing /usr/local/etc/ (/usr, on most systems) fstat -p qmail-send - only return files locked by the qmail-send process fstat /usr/local/sbin/smbd - only return info on processes and users locking the file /usr/local/sbin/smbd.
User
To determine the file status for a particular user the option -u username is used. for example when used against user account 'joeuser':
%fstat -u joeuser USER CMD PID FD MOUNT INUM MODE SZ|DV R/W joeuser fstat 96741 root / 2 drwxr-xr-x 512 r joeuser fstat 96741 wd /usr 2378753 drwxr-xr-x 512 r joeuser fstat 96741 text /usr 2308260 -r-xr-sr-x 14340 r joeuser fstat 96741 0 /dev 93 crw--w---- ttyp0 rw joeuser fstat 96741 1 /dev 93 crw--w---- ttyp0 rw joeuser fstat 96741 2 /dev 93 crw--w---- ttyp0 rw joeuser fstat 96741 3 /dev 26 crw-r----- mem r joeuser fstat 96741 4 /dev 27 crw-r----- kmem r joeuser fstat 96741 5 / 25179 -rw-r--r-- 40960 r joeuser csh 760 root / 2 drwxr-xr-x 512 r joeuser csh 760 wd /usr 2378753 drwxr-xr-x 512 r joeuser csh 760 text / 16628 -r-xr-xr-x 293060 r joeuser csh 760 15 /dev 93 crw--w---- ttyp0 rw joeuser csh 760 16 /dev 93 crw--w---- ttyp0 rw joeuser csh 760 17 /dev 93 crw--w---- ttyp0 rw joeuser csh 760 18 /dev 93 crw--w---- ttyp0 rw joeuser csh 760 19 /dev 93 crw--w---- ttyp0 rw joeuser sshd 759 root / 2 drwxr-xr-x 512 r joeuser sshd 759 wd / 2 drwxr-xr-x 512 r joeuser sshd 759 text /usr 1318917 -r-xr-xr-x 180452 r joeuser sshd 759 0 /dev 6 crw-rw-rw- null rw joeuser sshd 759 1 /dev 6 crw-rw-rw- null rw joeuser sshd 759 2 /dev 6 crw-rw-rw- null rw joeuser sshd 759 3* internet stream tcp c23cf1d0 joeuser sshd 759 4* local stream c23b47a8 <-> c23b4c94 joeuser sshd 759 5* pipe c2335660 <-> c2335718 0 rw joeuser sshd 759 6* pipe c2335718 <-> c2335660 0 rw joeuser sshd 759 7 /dev 92 crw-rw-rw- ptyp0 rw joeuser sshd 759 8 /dev 92 crw-rw-rw- ptyp0 rw joeuser sshd 759 9 /dev 92 crw-rw-rw- ptyp0 rw