In Linux For Searching a file use 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:
Options
|
Usage
|
-name
|
For
searching a file with its name
|
-inum
|
For
searching a file with particular inode number
|
-type
|
For
searching a particular type of file
|
-user
|
For
files whose owner is a particular user
|
-group
|
For
files belonging to particular group
|
Finding
a file with name:
#
find / -name File1
[root@rahul
Desktop]# find / -name file4
/root/Desktop/file4
|
Finding
a file with its inode number:
#find
/ -inum 5934
[root@rahul
Desktop]# ls -li file4
9517
-rw-r--r--. 1 root root 66 Sep 21 20:16 file4
[root@rahul
Desktop]# find / -inum 9517
/root/Desktop/file4
|
Finding
the Files, Whose owner of the files:
#find
/ -user rahul
[root@rahul
Desktop]# find / -user user
find:
`/proc/2196/task/2196/fd/5': No such file or directory
find:
`/proc/2196/task/2196/fdinfo/5': No such file or directory
find:
`/proc/2196/fd/5': No such file or directory
find:
`/proc/2196/fdinfo/5': No such file or directory
/var/spool/mail/user
/home/user
/home/user/.bash_profile
/home/user/.bashrc
/home/user/.mozilla
/home/user/.mozilla/extensions
/home/user/.mozilla/plugins
/home/user/.bash_logout
/home/user/.gnome2
|
Finding
the files whose group is “rpgroup”
#find
/ -group rpgroup
[root@rahul
Desktop]# find / -group rpgroup
/home/user
/home/user/.bash_profile
/home/user/.bashrc
/home/user/.mozilla
/home/user/.mozilla/extensions
/home/user/file1
/home/user/file2
/home/user/file4
|
Post a Comment