LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Fuser command (https://www.linuxquestions.org/questions/linux-general-1/fuser-command-351527/)

Gins 08-09-2005 11:16 AM

Fuser command
 
[root@c83-250-88-242 ka]# fuser -a /home

/home:




What is the fuser comand? I looked at the man pages. It should see the user id, display unused files, kill processes accessing that file and search IPV4 sockets etc.

Could you tell me how to use it find some of the above?

Tuttle 08-09-2005 12:08 PM

It's more to do with the apps you are using. "lsof" will give a list of all files used by all applications, in the form:
[filename] [pid] [other.......stuff........]
From this you can infer pid's from files in use, fuser does a similar thing but you can find a process by socket too.... read the man page of both. twice.

Gins 08-09-2005 12:24 PM

Tutti

The 'ls of' command gave me a big list of files. I will write some of them here.


profile.d/ protocols rc0.d@ pango/ paper.config secure-mcservusers
rpm/ securetty rc1.d@ menu/ lynx-site.cfg enscript.cfg
sysconfig/ services rc2.d@ fam.conf oaf/ lftp.conf
raidtab shells rc3.d@ gtk-2.0/ sane.d/ ltrace.conf
fstab passwd- rc4.d@ menu-methods/ postfix/ mailcap.base
hosts group- rc5.d@ bootsplash/ ssh/ mailcap.vga
skel/ iproute2/ rc6.d@ bonobo-activation/ gimp/ mime.types
rpc rmt@ sysctl.conf gconf/ aliases@ mailcap
pwdb.conf shadow termcap gnome-vfs-2.0/ gnome/ issue
nsswitch.conf security/ modprobe.preload gnome-vfs-mime-magic gnucash/ updatedb.conf

Tuttle 08-09-2005 01:15 PM

What program are you looking for exactly? A handy addon is "grep" eg.
Code:

lsof | grep gnome
I think you need to be more specific with the fuser command; if I use my home folder i get this:
Code:

tuttle@shangrila:~$ fuser -a /home/tuttle
/home/tuttle:        7634c  7660c  7662c  7666c  7693c  7713c  7715c  7717c  7720c  7721c  7738c  7739c  7746c  7747c  7748c  7749c  7750c  7751c  7752c  7753c  7754c  7755c  8633c  8639c  8645c  8646c  8647c  8648c  8650c  8652c  8653c  8657c  8676c  8681c  8682c  8683c  8685c  8692c  8694c  8695c  8698c

The "c"'s mean "current directory" according to the man page.
More verbose and with "-m" option:
Code:

tuttle@shangrila:~$ fuser -mu /home
/home:                7634c(tuttle)  7660c(tuttle)  7662c(tuttle)  7666c(tuttle)  7693c(tuttle)  7713c(tuttle)  7715c(tuttle)  7717c(tuttle)  7720c(tuttle)  7721c(tuttle)  7738c(tuttle)  7739c(tuttle)  7741(tuttle)  7746c(tuttle)  7747c(tuttle)  7748c(tuttle)  7749c(tuttle)  7750c(tuttle)  7751c(tuttle)  7752c(tuttle)  7753c(tuttle)  7754c(tuttle)  7755c(tuttle)  7756(tuttle)  7757(tuttle)  7776(tuttle)  8639  8639c(tuttle)  8645  8645c(tuttle)  8646  8646c(tuttle)  8647  8647c(tuttle)  8648  8648c(tuttle)  8650  8650c(tuttle)  8652  8652c(tuttle)  8653  8653c(tuttle)  8657c(tuttle)  8676c(tuttle)  8681  8681c(tuttle)  8682  8682c(tuttle)  8683  8683c(tuttle)  8685  8685c(tuttle)  8692c(tuttle)  8694c(tuttle) 8695c(tuttle)  8698c(tuttle)  8782c(tuttle)  8831c(tuttle)  8872c(tuttle)  8875c(tuttle)

Now with -v:
Code:

tuttle@shangrila:~$ fuser -mv /home

                    USER        PID ACCESS COMMAND
/home                tuttle    7634 ..c..  gnome-session
                    tuttle    7660 ..c..  gnome-keyring-d
                    tuttle    7662 ..c..  esd
                    tuttle    7666 ..c..  gnome-smproxy
                    tuttle    7693 ..c..  metacity
                    tuttle    7713 ..c..  gnome-panel
                    tuttle    7715 ..c..  gnome-volume-ma
                    tuttle    7717 ..c..  nautilus
                    tuttle    7720 ..c..  nautilus
                    tuttle    7721 ..c..  nautilus
                    tuttle    7738 ..c..  gnome-panel
                    tuttle    7739 ..c..  gnome-panel
                    tuttle    7741 f....  evolution-data-
                    tuttle    7746 ..c..  nautilus
                    tuttle    7747 ..c..  nautilus
                    tuttle    7748 ..c..  nautilus
                    tuttle    7749 ..c..  nautilus
                    tuttle    7750 ..c..  nautilus
                    tuttle    7751 ..c..  nautilus
                    tuttle    7752 ..c..  nautilus
                    tuttle    7753 ..c..  nautilus
                    tuttle    7754 ..c..  nautilus
                    tuttle    7755 ..c..  nautilus
                    tuttle    7756 f....  evolution-data-
                    tuttle    7757 f....  evolution-data-
                    tuttle    7776 f....  evolution-data-
                    tuttle    8639 f.c..  evolution-2.2
                    tuttle    8645 f.c..  evolution-2.2
                    tuttle    8646 f.c..  evolution-2.2
                    tuttle    8647 f.c..  evolution-2.2
                    tuttle    8648 f.c..  evolution-2.2
                    tuttle    8650 f.c..  evolution-2.2
                    tuttle    8652 f.c..  evolution-2.2
                    tuttle    8653 f.c..  evolution-2.2
                    tuttle    8657 ..c..  firefox
                    tuttle    8676 ..c..  run-mozilla.sh
                    tuttle    8681 f.c..  firefox-bin
                    tuttle    8682 f.c..  firefox-bin
                    tuttle    8683 f.c..  firefox-bin
                    tuttle    8685 f.c..  firefox-bin
                    tuttle    8692 ..c..  gnome-terminal
                    tuttle    8694 ..c..  bash
                    tuttle    8695 ..c..  gnome-terminal
                    tuttle    8698 ..c..  gnome-terminal
                    tuttle    8782 ..c..  bash
                    tuttle    8831 ..c..  bash
                    tuttle    8872 ..c..  man
                    tuttle    8875 ..c..  sh

edit: the -m option refers to a mounted file system, ie. all files used in that partition (I think).


All times are GMT -5. The time now is 09:41 PM.