Find Command

find command is used to find the files or directory’s path, it is exactly like the find option in windows where you can search for a file.

Syntax: find / (under root) –option filename

Options that can be used with find command:

Finding a File with name
#find / -name linuxfile

[root@localhost ~]# find / -name linuxfile
/root/linuxfile
[root@localhost ~]#
Finding a file with its inode number
#find / -inum 3076
[root@localhost ~]# find / -inum 3076
/root/linuxfile.hlink
/root/linuxfile
/sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:06/device:1a/path
/sys/kernel/debug/tracing/events/power/pm_qos_update_request_timeout
[root@localhost ~]#

Finding the files, whose owner is a user called “lbuser”
#find / -user lb

[root@localhost ~]# find / -user lb
find: ‘/proc/6570/task/6570/fd/5’: No such file or directory
find: ‘/proc/6570/task/6570/fdinfo/5’: No such file or directory
find: ‘/proc/6570/fd/6’: No such file or directory
find: ‘/proc/6570/fdinfo/6’: No such file or directory
/home/lb
/home/lb/.mozilla
/home/lb/.mozilla/plugins
/home/lb/.mozilla/extensions
/home/lb/.bashrc
/home/lb/.bash_logout
/home/lb/.bash_profile
/var/spool/mail/lb
[root@localhost ~]#

Finding the files whose group is “lbgroup”

#find / -group ktgroup
root@localhost ~]# find / -group lbgroup
#find / -group lbgroup
find: ‘/proc/6570/task/6570/fd/5’: No such file or directory
find: ‘/proc/6570/task/6570/fdinfo/5’: No such file or directory
find: ‘/proc/6570/fd/6’: No such file or directory
find: ‘/proc/6570/fdinfo/6’: No such file or directory
/home/lbuser/lb
[root@localhost ~]#

Leave a Reply

Your email address will not be published. Required fields are marked *