SlideShare a Scribd company logo
Find and Locate Utility
Pal Nikola
Praful Borad
Ravina Prajapati
Find:-
● Search for files in real time system.
● Find is a command for recursively filtering objects in the file
system.
● Find command used to search and locate list of files and
directories based on conditions you specify for files that
match the arguments.
● Files can be find based on the following:-
1.permissions
2.users
3.groups
4.file type
5.age
6.size
Switches for FIND
Switches Description
maxdepth x Search current directory as well as all sub-
directories X levels deep.
-iname Search without regard for case.
-not Return only results that do not match the
test case.
-type f Search for files.
-type d Search for directories.
-L Follow symbolic Link
-delete Immediately delete after finding the file
-exec Immediately process the file in same
command
Find files using name in current directory
 find . -name hello.txt
 find . -name test.txt
Find files using name and ignoring case
 find /home -iname “new.txt”
Find files under home directory
 find /home -name '*.jpg
 find /home/username/ -name "*.txt“
Finding directories using name
 find /home -type d -name work
Find files with 777 permissions
 find . -type f -perm 0777 -print
Find all empty files
 find /home/RAVINA/grep -type f -empty
Find all hidden files
 find -name ".*"
Find files based on days
Modified in last 2 days
 find . -mtime 2
Accessed in last 2 days
 find . -atime 2
Find files based on hours
Files changed in last 1 hour
 find . -cmin -60
Files accessed in last 1 hour
 find . -amin -60
Find files by its size
 find . –size 100k
 c – bytes, k – kilobytes, M – megabytes, G – gigabytes, b – 512 byte blocks
Find all executable files
 find -maxdepth “N” -perm /UserType=Permission
Where:- N = level of depth ; UserType = User, group, others
Permission = read(r), write(w), execute(x)
 find -maxdepth 2 -perm /a=x
Find symbolic links or delete files
Find and delete files
 find . -name "ffff.txt" -delete
Find symbolic links
 find -L -name "hello.txt"
Locate
 Search for files and directories from existing database.
 It is often used when speed is the top most priority for finding any files or
directories.
 Database is renewed every 24 hours.
 Locate only stores names and permissions.
How to get the statistic of the database
 locate –S
Syntax and switches of locate command
 Syntax :-locate [options] filename
Switches Description
-c (count) Instead of writing file names on
standard output, write the number of
matching entries only.
-e (existing) Print only entries that refer to files
existing at the time locate is run.
-i (ignore case) Ignore case while matching
-l,-n (limit) Exit successfully after finding LIMIT
entries.
-S (statistics) Write statistics about each read
database to standard output instead
of searching for files and exit
successfully.
To get the count of number of matching
entries
 locate -c *.txt
 locate -c *.mp3
 locate -c hello.txt
Check file existence
 locate -e sysctl.conf
 Even when the file exist in the mlocate.db, it will still verify to make sure the
file is physically present in the system before displaying it.
Ignore case while matching entries
 locate -i new.txt
To restrict locate output
 “locate -l 5 passwd”
Difference between find and locate
Find Locate
Searches in whole system and find the
specified files or directories.
Searches in database which is already
created in system.
Find command has number of options and is
very configurable.
Locate has very few options.
We can find files based on name, size,
age, permission, user, groups etc
We can find files based on name and
permission only.
There are many ways to reduce the depth
and breadth of your search and make it more
efficient.
While locate cannot be reduced to
make it efficient.
Find is more accurate as it search in
real time system.
Locate is less accurate as it searches
from the existing database because if
database is not updated then locate
command will find any match. To sync the
database, it is must to execute the
“updatedb” command.
Difference between find and locate
Find Locate
If a file is deleted then find command
will not give the match as it searches
in real time system.
If a file is deleted still locate command
will show the matched file if the file
image still exist in the database.
Find is slow. Locate is fast.

More Related Content

What's hot

MindMap - Forensics Windows Registry Cheat Sheet
MindMap - Forensics Windows Registry Cheat SheetMindMap - Forensics Windows Registry Cheat Sheet
MindMap - Forensics Windows Registry Cheat SheetJuan F. Padilla
 
CNIT 126: Ch 2 & 3
CNIT 126: Ch 2 & 3CNIT 126: Ch 2 & 3
CNIT 126: Ch 2 & 3Sam Bowne
 
Fractional knapsack class 13
Fractional knapsack class 13Fractional knapsack class 13
Fractional knapsack class 13Kumar
 
OWASP A4 XML External Entities (XXE)
OWASP A4 XML External Entities (XXE)OWASP A4 XML External Entities (XXE)
OWASP A4 XML External Entities (XXE)Michael Furman
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object ModelWebStackAcademy
 
Data Structures in Python
Data Structures in PythonData Structures in Python
Data Structures in PythonDevashish Kumar
 
Introduction to Basics of Python
Introduction to Basics of PythonIntroduction to Basics of Python
Introduction to Basics of PythonElewayte
 
Regular expressions in Python
Regular expressions in PythonRegular expressions in Python
Regular expressions in PythonSujith Kumar
 
HP Blades Presentation
HP Blades PresentationHP Blades Presentation
HP Blades PresentationBhavin Vyas
 
Python Variable Types, List, Tuple, Dictionary
Python Variable Types, List, Tuple, DictionaryPython Variable Types, List, Tuple, Dictionary
Python Variable Types, List, Tuple, DictionarySoba Arjun
 
Data file handling in python introduction,opening & closing files
Data file handling in python introduction,opening & closing filesData file handling in python introduction,opening & closing files
Data file handling in python introduction,opening & closing fileskeeeerty
 

What's hot (20)

Python Modules
Python ModulesPython Modules
Python Modules
 
Functions in Python
Functions in PythonFunctions in Python
Functions in Python
 
Python programming : Strings
Python programming : StringsPython programming : Strings
Python programming : Strings
 
MindMap - Forensics Windows Registry Cheat Sheet
MindMap - Forensics Windows Registry Cheat SheetMindMap - Forensics Windows Registry Cheat Sheet
MindMap - Forensics Windows Registry Cheat Sheet
 
Xml dom
Xml domXml dom
Xml dom
 
CNIT 126: Ch 2 & 3
CNIT 126: Ch 2 & 3CNIT 126: Ch 2 & 3
CNIT 126: Ch 2 & 3
 
Fractional knapsack class 13
Fractional knapsack class 13Fractional knapsack class 13
Fractional knapsack class 13
 
OWASP A4 XML External Entities (XXE)
OWASP A4 XML External Entities (XXE)OWASP A4 XML External Entities (XXE)
OWASP A4 XML External Entities (XXE)
 
DTD
DTDDTD
DTD
 
Python Tutorial Part 1
Python Tutorial Part 1Python Tutorial Part 1
Python Tutorial Part 1
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
 
Data Structures in Python
Data Structures in PythonData Structures in Python
Data Structures in Python
 
Python Scipy Numpy
Python Scipy NumpyPython Scipy Numpy
Python Scipy Numpy
 
Introduction to Basics of Python
Introduction to Basics of PythonIntroduction to Basics of Python
Introduction to Basics of Python
 
Wireshark Basic Presentation
Wireshark Basic PresentationWireshark Basic Presentation
Wireshark Basic Presentation
 
Regular expressions in Python
Regular expressions in PythonRegular expressions in Python
Regular expressions in Python
 
HP Blades Presentation
HP Blades PresentationHP Blades Presentation
HP Blades Presentation
 
Files in Python.pptx
Files in Python.pptxFiles in Python.pptx
Files in Python.pptx
 
Python Variable Types, List, Tuple, Dictionary
Python Variable Types, List, Tuple, DictionaryPython Variable Types, List, Tuple, Dictionary
Python Variable Types, List, Tuple, Dictionary
 
Data file handling in python introduction,opening & closing files
Data file handling in python introduction,opening & closing filesData file handling in python introduction,opening & closing files
Data file handling in python introduction,opening & closing files
 

Similar to Find and locate

Unit 12 finding and processing files
Unit 12 finding and processing filesUnit 12 finding and processing files
Unit 12 finding and processing filesroot_fibo
 
File systems and inodes
File systems and inodesFile systems and inodes
File systems and inodesDr. Girish GS
 
PEARC17: Designsafe: Using Elasticsearch to Share and Search Data on a Scienc...
PEARC17: Designsafe: Using Elasticsearch to Share and Search Data on a Scienc...PEARC17: Designsafe: Using Elasticsearch to Share and Search Data on a Scienc...
PEARC17: Designsafe: Using Elasticsearch to Share and Search Data on a Scienc...Josue Balandrano
 
Recursively Searching Files and DirectoriesSummaryBuild a class .pdf
Recursively Searching Files and DirectoriesSummaryBuild a class .pdfRecursively Searching Files and DirectoriesSummaryBuild a class .pdf
Recursively Searching Files and DirectoriesSummaryBuild a class .pdfmallik3000
 
10 finding files
10 finding files10 finding files
10 finding filesShay Cohen
 
101 4.7 find system files and place files in the correct location
101 4.7 find system files and place files in the correct location101 4.7 find system files and place files in the correct location
101 4.7 find system files and place files in the correct locationAcácio Oliveira
 
Ch11 OS
Ch11 OSCh11 OS
Ch11 OSC.U
 
Find and Locate: Two Commands
Find and Locate: Two CommandsFind and Locate: Two Commands
Find and Locate: Two CommandsKevin OBrien
 
Common linux ubuntu commands overview
Common linux  ubuntu commands overviewCommon linux  ubuntu commands overview
Common linux ubuntu commands overviewAmeer Sameer
 
Unit ivos - file systems
Unit ivos - file systemsUnit ivos - file systems
Unit ivos - file systemsdonny101
 
linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.pptMeesanRaza
 
Important Linux Commands
Important Linux CommandsImportant Linux Commands
Important Linux CommandsArun Sharma
 

Similar to Find and locate (20)

Unit 12 finding and processing files
Unit 12 finding and processing filesUnit 12 finding and processing files
Unit 12 finding and processing files
 
File systems and inodes
File systems and inodesFile systems and inodes
File systems and inodes
 
PEARC17: Designsafe: Using Elasticsearch to Share and Search Data on a Scienc...
PEARC17: Designsafe: Using Elasticsearch to Share and Search Data on a Scienc...PEARC17: Designsafe: Using Elasticsearch to Share and Search Data on a Scienc...
PEARC17: Designsafe: Using Elasticsearch to Share and Search Data on a Scienc...
 
Recursively Searching Files and DirectoriesSummaryBuild a class .pdf
Recursively Searching Files and DirectoriesSummaryBuild a class .pdfRecursively Searching Files and DirectoriesSummaryBuild a class .pdf
Recursively Searching Files and DirectoriesSummaryBuild a class .pdf
 
10 finding files
10 finding files10 finding files
10 finding files
 
101 4.7 find system files and place files in the correct location
101 4.7 find system files and place files in the correct location101 4.7 find system files and place files in the correct location
101 4.7 find system files and place files in the correct location
 
OS_Ch11
OS_Ch11OS_Ch11
OS_Ch11
 
OSCh11
OSCh11OSCh11
OSCh11
 
Ch11 OS
Ch11 OSCh11 OS
Ch11 OS
 
Find and Locate: Two Commands
Find and Locate: Two CommandsFind and Locate: Two Commands
Find and Locate: Two Commands
 
Common linux ubuntu commands overview
Common linux  ubuntu commands overviewCommon linux  ubuntu commands overview
Common linux ubuntu commands overview
 
File Systems
File SystemsFile Systems
File Systems
 
Unit ivos - file systems
Unit ivos - file systemsUnit ivos - file systems
Unit ivos - file systems
 
MCLS 45 Lab Manual
MCLS 45 Lab ManualMCLS 45 Lab Manual
MCLS 45 Lab Manual
 
Windowsforensics
WindowsforensicsWindowsforensics
Windowsforensics
 
linux-file-system01.ppt
linux-file-system01.pptlinux-file-system01.ppt
linux-file-system01.ppt
 
Ch10
Ch10Ch10
Ch10
 
Important Linux Commands
Important Linux CommandsImportant Linux Commands
Important Linux Commands
 
Unix Basics Commands
Unix Basics CommandsUnix Basics Commands
Unix Basics Commands
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 

More from praful borad

Smart attendance system
Smart attendance systemSmart attendance system
Smart attendance systempraful borad
 
Samrt attendance system using fingerprint
Samrt attendance system using fingerprintSamrt attendance system using fingerprint
Samrt attendance system using fingerprintpraful borad
 
Fingerprint base security system
Fingerprint base security systemFingerprint base security system
Fingerprint base security systempraful borad
 
Fingerprint base security system
Fingerprint base security systemFingerprint base security system
Fingerprint base security systempraful borad
 
Fingerprint base security system
Fingerprint base security systemFingerprint base security system
Fingerprint base security systempraful borad
 

More from praful borad (6)

Smart attendance system
Smart attendance systemSmart attendance system
Smart attendance system
 
Samrt attendance system using fingerprint
Samrt attendance system using fingerprintSamrt attendance system using fingerprint
Samrt attendance system using fingerprint
 
Freq counter
Freq counterFreq counter
Freq counter
 
Fingerprint base security system
Fingerprint base security systemFingerprint base security system
Fingerprint base security system
 
Fingerprint base security system
Fingerprint base security systemFingerprint base security system
Fingerprint base security system
 
Fingerprint base security system
Fingerprint base security systemFingerprint base security system
Fingerprint base security system
 

Recently uploaded

Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单yhkoc
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单nscud
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单ewymefz
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单ewymefz
 
tapal brand analysis PPT slide for comptetive data
tapal brand analysis PPT slide for comptetive datatapal brand analysis PPT slide for comptetive data
tapal brand analysis PPT slide for comptetive datatheahmadsaood
 
Q1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year ReboundQ1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year ReboundOppotus
 
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...correoyaya
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单vcaxypu
 
Jpolillo Amazon PPC - Bid Optimization Sample
Jpolillo Amazon PPC - Bid Optimization SampleJpolillo Amazon PPC - Bid Optimization Sample
Jpolillo Amazon PPC - Bid Optimization SampleJames Polillo
 
Introduction-to-Cybersecurit57hhfcbbcxxx
Introduction-to-Cybersecurit57hhfcbbcxxxIntroduction-to-Cybersecurit57hhfcbbcxxx
Introduction-to-Cybersecurit57hhfcbbcxxxzahraomer517
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单ewymefz
 
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...Subhajit Sahu
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .NABLAS株式会社
 
How can I successfully sell my pi coins in Philippines?
How can I successfully sell my pi coins in Philippines?How can I successfully sell my pi coins in Philippines?
How can I successfully sell my pi coins in Philippines?DOT TECH
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样axoqas
 
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单ukgaet
 
Investigate & Recover / StarCompliance.io / Crypto_Crimes
Investigate & Recover / StarCompliance.io / Crypto_CrimesInvestigate & Recover / StarCompliance.io / Crypto_Crimes
Investigate & Recover / StarCompliance.io / Crypto_CrimesStarCompliance.io
 
Empowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptxEmpowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptxbenishzehra469
 
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单vcaxypu
 

Recently uploaded (20)

Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
 
tapal brand analysis PPT slide for comptetive data
tapal brand analysis PPT slide for comptetive datatapal brand analysis PPT slide for comptetive data
tapal brand analysis PPT slide for comptetive data
 
Q1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year ReboundQ1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year Rebound
 
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
 
Jpolillo Amazon PPC - Bid Optimization Sample
Jpolillo Amazon PPC - Bid Optimization SampleJpolillo Amazon PPC - Bid Optimization Sample
Jpolillo Amazon PPC - Bid Optimization Sample
 
Introduction-to-Cybersecurit57hhfcbbcxxx
Introduction-to-Cybersecurit57hhfcbbcxxxIntroduction-to-Cybersecurit57hhfcbbcxxx
Introduction-to-Cybersecurit57hhfcbbcxxx
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
 
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
 
How can I successfully sell my pi coins in Philippines?
How can I successfully sell my pi coins in Philippines?How can I successfully sell my pi coins in Philippines?
How can I successfully sell my pi coins in Philippines?
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
 
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
一比一原版(UVic毕业证)维多利亚大学毕业证成绩单
 
Investigate & Recover / StarCompliance.io / Crypto_Crimes
Investigate & Recover / StarCompliance.io / Crypto_CrimesInvestigate & Recover / StarCompliance.io / Crypto_Crimes
Investigate & Recover / StarCompliance.io / Crypto_Crimes
 
Empowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptxEmpowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptx
 
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
 

Find and locate

  • 1. Find and Locate Utility Pal Nikola Praful Borad Ravina Prajapati
  • 2. Find:- ● Search for files in real time system. ● Find is a command for recursively filtering objects in the file system. ● Find command used to search and locate list of files and directories based on conditions you specify for files that match the arguments. ● Files can be find based on the following:- 1.permissions 2.users 3.groups 4.file type 5.age 6.size
  • 3. Switches for FIND Switches Description maxdepth x Search current directory as well as all sub- directories X levels deep. -iname Search without regard for case. -not Return only results that do not match the test case. -type f Search for files. -type d Search for directories. -L Follow symbolic Link -delete Immediately delete after finding the file -exec Immediately process the file in same command
  • 4. Find files using name in current directory  find . -name hello.txt  find . -name test.txt
  • 5. Find files using name and ignoring case  find /home -iname “new.txt”
  • 6. Find files under home directory  find /home -name '*.jpg  find /home/username/ -name "*.txt“
  • 7. Finding directories using name  find /home -type d -name work
  • 8. Find files with 777 permissions  find . -type f -perm 0777 -print
  • 9. Find all empty files  find /home/RAVINA/grep -type f -empty
  • 10. Find all hidden files  find -name ".*"
  • 11. Find files based on days Modified in last 2 days  find . -mtime 2 Accessed in last 2 days  find . -atime 2
  • 12. Find files based on hours Files changed in last 1 hour  find . -cmin -60 Files accessed in last 1 hour  find . -amin -60
  • 13. Find files by its size  find . –size 100k  c – bytes, k – kilobytes, M – megabytes, G – gigabytes, b – 512 byte blocks
  • 14. Find all executable files  find -maxdepth “N” -perm /UserType=Permission Where:- N = level of depth ; UserType = User, group, others Permission = read(r), write(w), execute(x)  find -maxdepth 2 -perm /a=x
  • 15. Find symbolic links or delete files Find and delete files  find . -name "ffff.txt" -delete Find symbolic links  find -L -name "hello.txt"
  • 16. Locate  Search for files and directories from existing database.  It is often used when speed is the top most priority for finding any files or directories.  Database is renewed every 24 hours.  Locate only stores names and permissions.
  • 17. How to get the statistic of the database  locate –S
  • 18. Syntax and switches of locate command  Syntax :-locate [options] filename Switches Description -c (count) Instead of writing file names on standard output, write the number of matching entries only. -e (existing) Print only entries that refer to files existing at the time locate is run. -i (ignore case) Ignore case while matching -l,-n (limit) Exit successfully after finding LIMIT entries. -S (statistics) Write statistics about each read database to standard output instead of searching for files and exit successfully.
  • 19. To get the count of number of matching entries  locate -c *.txt  locate -c *.mp3  locate -c hello.txt
  • 20. Check file existence  locate -e sysctl.conf  Even when the file exist in the mlocate.db, it will still verify to make sure the file is physically present in the system before displaying it.
  • 21. Ignore case while matching entries  locate -i new.txt
  • 22. To restrict locate output  “locate -l 5 passwd”
  • 23. Difference between find and locate Find Locate Searches in whole system and find the specified files or directories. Searches in database which is already created in system. Find command has number of options and is very configurable. Locate has very few options. We can find files based on name, size, age, permission, user, groups etc We can find files based on name and permission only. There are many ways to reduce the depth and breadth of your search and make it more efficient. While locate cannot be reduced to make it efficient. Find is more accurate as it search in real time system. Locate is less accurate as it searches from the existing database because if database is not updated then locate command will find any match. To sync the database, it is must to execute the “updatedb” command.
  • 24. Difference between find and locate Find Locate If a file is deleted then find command will not give the match as it searches in real time system. If a file is deleted still locate command will show the matched file if the file image still exist in the database. Find is slow. Locate is fast.