Se usassi 'pgrep cp' troverei anche /usr/sbin/acpid.
Specificando l'opzione -x, prep trova solo la corrispondenza esatta del nome del file in esecuzione.
Codice: Seleziona tutto
-x, --exact
Only match processes whose names (or command line if -f is specified) exactly match the pattern.Codice: Seleziona tutto
ps -ef | grep qemu
root 710 1 12 09:05 ? 00:00:34 qemu-system-x86_64 -enable-kvm -name zeroshell.cloudmin.example.com -m 512 -drive file=/dev/vg00/zeroshell_cloudmin_example_com_img,media=disk,index=0,if=virtio -boot c -net tap,vlan=0,script=/kvm/zeroshell.cloudmin.example.com-eth0.sh -net nic,vlan=0,macaddr=02:54:00:16:54:0B -vnc :1,password -usbdevice tablet -monitor tcp:127.0.0.1:40000,server -smp 2
root 1099 1 12 09:05 ? 00:00:35 qemu-system-x86_64 -enable-kvm -name zeroshell2.cloudmin.example.com -m 512 -drive file=/dev/vg00/zeroshell2_cloudmin_example_com_img,media=disk,index=0,if=ide -boot c -net tap,vlan=0,script=/kvm/zeroshell2.cloudmin.example.com-eth0.sh -net nic,vlan=0,macaddr=02:54:00:C3:92:3D -vnc :2,password -usbdevice tablet -monitor tcp:127.0.0.1:40001,server -smp 2
root 1370 1350 0 09:09 pts/0 00:00:00 grep qemu
pgrep qemu
710
1099
pgrep -x qemu-system-x86_64
