By default, the fuser command lists the process numbers of local processes and a letter indicating how the process uses the file:
| c | Uses the file as the current directory. |
| e | Uses the file as a program’s executable object. |
| r | Uses the file as the root directory. |
| s | Uses the file as a shared library (or other loadable object). |
Well, this letter could cause issue when you try to put it in a script or want to show all processes in one line.
Solution:
Redirecting stderr to /dev/null will do the magic trick!
myuserid [aixlpar1] /home/myuserid: fuser / /: 1c 2425058c 2556030c 3080396c 3145910r 3539102c 3801206c 3866754c 3997908c 4063362c 4391064c 4522132c 4587666c 4653084c 4718782c 4849740r 5112010r 5373966r 5439664r 5701674r 5832948r 6029330c 6226112c 6553804c 6619256r 7078116r 7143446r 7209010r 7536878r 7995574r 8126552r 8519692r 9043994r 10485792r 10551534r 10682438r 11468876r 11731008r 16253040r 21037254r 21102810r 21233818r 21364978r 21430368r 21495976r 21758124r 22413370r 24510488r 24772824r 25034896r 25231476r 26345490c 27131918c 28246210c
myuserid [aixlpar1] /home/myuserid: fuser / 2>/dev/null 1 2425058 2556030 3080396 3145910 3539102 3801206 3866754 3997908 4063362 4391064 4522132 4587666 4653084 4718782 4849740 5112010 5373966 5439664 5701674 5832948 6029330 6226112 6553804 6619256 7078116 7143446 7209010 7536878 7995574 8126552 8519692 9043994 10485792 10551534 10682438 11468880 11731008 16253040 18022610 20774944 20840492 21037254 21102810 21233818 21364978 21430368 21495976 21758124 22413370 24510488 24772824 25034896 25231476 25493754 26345490 27131918 28246210 29032688 32768174myuserid [aixlpar1] /home/myuserid: s -o pid,args -p "$(fuser / 2>/dev/null)"
One liner to show the processes names:
myuserid [aixlpar1] /home/myuserid: ps -o pid,args -p "$(fuser / 2>/dev/null)" PID COMMAND 1 /etc/init 2425058 /usr/sbin/biod 6 2556030 /usr/sbin/syncd 60 3080396 /usr/ccs/bin/shlap64 3145910 /usr/lib/errdemon 3539102 /usr/sbin/srcmstr 3801206 /bin/ksh /opt/itlm/tlmagent 3866754 /opt/itlm/tlmagent.bin 3997908 /usr/DynamicLinkManager/bin/dlmmgr 4063362 /usr/sbin/xntpd 4391064 /usr/sbin/inetd 4522132 /usr/sbin/hostmibd 4587666 /usr/sbin/snmpmibd 4653084 /usr/sbin/aixmibd 4718782 /usr/sbin/sshd 4849740 /usr/sbin/rsct/bin/IBM.WLMRMd 5112010 /usr/sbin/rsct/bin/IBM.DRMd 5373966 /usr/sbin/rsct/bin/IBM.ServiceRMd 5439664 /usr/sbin/rsct/bin/rmcd -a IBM.LPCommands -r 5701674 /usr/sbin/rsct/bin/vac8/IBM.CSMAgentRMd 5832948 /usr/sbin/cron 6029330 /usr/lpp/diagnostics/bin/diagd 6226112 /opt/hitachi/HNTRLib2/bin/hntr2mon -d 6553804 /usr/sbin/getty /dev/console 6619256 jpcah -d /opt/jp1pc/bin/action 7078116 ./cirba-snmpd -P 3161 -f 7143446 /esm/bin/aix-ppc64/esmd -fv 7209010 agtu/jpcsto -d /opt/jp1pc/agtu/store 7536878 /usr/HDVM/HBaseAgent/agent/bin/hbsa_service 7995574 /opt/opsware/agent/bin/python /opt/opsware/agent/pylibs/shadowbot/daemonbot.pyc --conf /etc/opt/opsware/agent/agent.args 8126552 /opt/opsware/agent/bin/python /opt/opsware/agent/pylibs/shadowbot/daemonbot.pyc --conf /etc/opt/opsware/agent/agent.args 8519692 /usr/sbin/rsct/bin/IBM.ConfigRMd 9043994 agte/jpcsto -d /opt/jp1pc/agte/store 10485792 jpcagtu -d /opt/jp1pc/agtu/agent 10551534 ./jpc_hostutil /opt/jp1pc/agtu/jpc_hostutil_ off 10682438 jpcagte -d /opt/jp1pc/agte/agent 11731008 jpcstatsvr -d /opt/jp1pc/bin/statsvr 16253040 -ksh 21037254 /usr/opt/itm/aix526/ux/bin/kuxagent 21102810 /usr/opt/itm/aix526/ux/bin/nfs_stat AIX 30 9 21233818 /usr/opt/itm/aix526/ux/bin/kux_vmstat 30 6 21364978 /usr/opt/itm/aix526/ux/bin/mount_stat 12 21430368 /usr/opt/itm/aix526/ul/bin/kulagent 21495976 /usr/opt/itm/aix523/px/bin/aixDataProvider-61 21758124 /usr/opt/itm/aix526/ux/bin/stat_daemon 13 22413370 /usr/opt/itm/aix526/ux/bin/kcawd 24510488 /usr/bin/topas_nmon -fT -I 0.05 -s120 -c710 -m /monitoring/logs/nmon -youtput_dir=/monitoring/logs/nmon/aixlpar1 -ystart_time=00:05:01,Jul08,2012 24772824 /usr/opt/itm/aix526/ux/bin/ifstat 30 7 25034896 /bin/iostat -ds 30 25231476 /usr/opt/itm/aix523/px/bin/kpxagent 26345490 sshd: myuserid [priv] 27131918 sshd: myuserid@pts/0 28246210 /usr/sbin/syslogd
