Facebook

Finding file and directory in ubuntu


To find a file in your system by name use below command -

find -name "query"

For case insensitive search -
find -iname "query"


Search by extension -
find / -type f -name "*.txt"

Search by size -
find / -size 50c
  c - byte
  k - kilo byte
  M - mega byte
  G - giga byte

less than 50 byte
find / -size -50c
more than 50 Mb
find / -size +50M
Search by time -
can be searched on three time basis
Access Time -atime
Modification time -mtime , when file content is changed.
Change time -ctime , when metadata , inode data is chaged.

Modified 1 day ago -
find / -mtime 1
Accessed less than 1 day ago -
find / -atime -1
Finding by owner -
find / -user username

Finding by permission -
find / -perm 644


Finding files by using command locat
locate filename

locate -b basefilename




Find a directory by name -
find / -name directoryname -type d




No comments:

Post a Comment