SlideShare a Scribd company logo
1 of 6
Finding Files
Finding Files
• The Linux File System hierarchy includes a large amount of
directories and a deep tree of subdirectories
• When interacting with the system, one of the most common
need is finding a file’s location or find which files are included
in a custom search criteria.
find
• ‘find’ is a power-full file search tool. It can find files that
matches any type or criteria, such as:
– File name
– Modification or Access time
– File size
– Similarity to other files
find
• Syntax:
 find [options] [filename(s)]
• Options:
 -name ‘pattern’ find files with name matching name
 -iname ‘pattern’ same as above. Case insensitive
 -mtime +/-N find files with modification time of more (+) or less (+)
then N days
 -mmin +/-N same as above. N stands for minutes
 -[i]regex find files with name matching regex
 -user user find files owned by user
 -size +/-N[kMG] find files with size bigger or smaller than N
find
 -exec command {} ; execute command {} while replacing {} with the
file name. This option should be used in conjunction with at least one
filter option
Example
$ find . -name .b* -exec head -n1 {} ;
# .bash_profile
# .bashrc
# ~/.bash_logout
ls -ltr ~
locate
• ‘locate’ is another tool that finds files. It uses a database
which holds a list of all the files in the system and needs to be
updated periodically using the command ‘updatedb’
• Syntax:
 locate [options] PATTERN
• Options:
 -r ‘regex’ find file with names matching regex
 -c only report amount of times each file was found

More Related Content

What's hot (20)

CBSE - Class 12 - Ch -5 -File Handling , access mode,CSV , Binary file
CBSE - Class 12 - Ch -5 -File Handling , access mode,CSV , Binary fileCBSE - Class 12 - Ch -5 -File Handling , access mode,CSV , Binary file
CBSE - Class 12 - Ch -5 -File Handling , access mode,CSV , Binary file
 
Cis166 final review
Cis166 final reviewCis166 final review
Cis166 final review
 
Introduction to the design and specification of file structures
Introduction to the design and specification of file structuresIntroduction to the design and specification of file structures
Introduction to the design and specification of file structures
 
File Handling
File HandlingFile Handling
File Handling
 
file management
file managementfile management
file management
 
RandomAccessFile Quick Start
RandomAccessFile Quick StartRandomAccessFile Quick Start
RandomAccessFile Quick Start
 
File handling
File handlingFile handling
File handling
 
Intake 37 11
Intake 37 11Intake 37 11
Intake 37 11
 
Chapter 10.1
Chapter 10.1Chapter 10.1
Chapter 10.1
 
File organization
File organizationFile organization
File organization
 
File Management
File ManagementFile Management
File Management
 
Chapter 06
Chapter 06Chapter 06
Chapter 06
 
Find and locate
Find and locateFind and locate
Find and locate
 
Switching & Multiplexing
Switching & MultiplexingSwitching & Multiplexing
Switching & Multiplexing
 
File structures
File structuresFile structures
File structures
 
File-Data structure
File-Data structure File-Data structure
File-Data structure
 
File organization
File organizationFile organization
File organization
 
06 File System
06 File System06 File System
06 File System
 
Comp102 lec 11
Comp102   lec 11Comp102   lec 11
Comp102 lec 11
 
Chapter 3 part 1
Chapter 3 part 1Chapter 3 part 1
Chapter 3 part 1
 

Viewers also liked

Viewers also liked (9)

Linux Commands and info
Linux Commands and infoLinux Commands and info
Linux Commands and info
 
Linux Workshop , Day 3
Linux Workshop , Day 3Linux Workshop , Day 3
Linux Workshop , Day 3
 
GNU/LINUX - Day 1
GNU/LINUX - Day 1GNU/LINUX - Day 1
GNU/LINUX - Day 1
 
File System Hierarchy
File System HierarchyFile System Hierarchy
File System Hierarchy
 
Basic Linux day 1
Basic Linux day 1Basic Linux day 1
Basic Linux day 1
 
Dhcp ppt
Dhcp pptDhcp ppt
Dhcp ppt
 
Ubuntu-Overview
Ubuntu-OverviewUbuntu-Overview
Ubuntu-Overview
 
The Near Future of CSS
The Near Future of CSSThe Near Future of CSS
The Near Future of CSS
 
Classroom Management Tips for Kids and Adolescents
Classroom Management Tips for Kids and AdolescentsClassroom Management Tips for Kids and Adolescents
Classroom Management Tips for Kids and Adolescents
 

Similar to 10 finding files

ITFT_File system interface in Operating System
ITFT_File system interface in Operating SystemITFT_File system interface in Operating System
ITFT_File system interface in Operating SystemSneh Prabha
 
UNIT7-FileMgmt.pptx
UNIT7-FileMgmt.pptxUNIT7-FileMgmt.pptx
UNIT7-FileMgmt.pptxNavyaKumar22
 
Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files Ahmed El-Arabawy
 
File Management & Access Control
File Management & Access Control File Management & Access Control
File Management & Access Control YuvrajWadavale
 
File systems and inodes
File systems and inodesFile systems and inodes
File systems and inodesDr. Girish GS
 
Unit 3 file management
Unit 3 file managementUnit 3 file management
Unit 3 file managementKalai Selvi
 
File system in operating system e learning
File system in operating system e learningFile system in operating system e learning
File system in operating system e learningLavanya Sharma
 
file management_osnotes.ppt
file management_osnotes.pptfile management_osnotes.ppt
file management_osnotes.pptHelalMirzad
 
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
 
Unit 3 chapter 1-file management
Unit 3 chapter 1-file managementUnit 3 chapter 1-file management
Unit 3 chapter 1-file managementKalai Selvi
 
Unit ivos - file systems
Unit ivos - file systemsUnit ivos - file systems
Unit ivos - file systemsdonny101
 

Similar to 10 finding files (20)

Ch10 file system interface
Ch10   file system interfaceCh10   file system interface
Ch10 file system interface
 
File system
File systemFile system
File system
 
ITFT_File system interface in Operating System
ITFT_File system interface in Operating SystemITFT_File system interface in Operating System
ITFT_File system interface in Operating System
 
UNIT7-FileMgmt.pptx
UNIT7-FileMgmt.pptxUNIT7-FileMgmt.pptx
UNIT7-FileMgmt.pptx
 
Os6
Os6Os6
Os6
 
Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files
 
File Systems
File SystemsFile Systems
File Systems
 
File Management & Access Control
File Management & Access Control File Management & Access Control
File Management & Access Control
 
File systems and inodes
File systems and inodesFile systems and inodes
File systems and inodes
 
Unit 3 file management
Unit 3 file managementUnit 3 file management
Unit 3 file management
 
Ch10
Ch10Ch10
Ch10
 
5263802.ppt
5263802.ppt5263802.ppt
5263802.ppt
 
File system in operating system e learning
File system in operating system e learningFile system in operating system e learning
File system in operating system e learning
 
file management_osnotes.ppt
file management_osnotes.pptfile management_osnotes.ppt
file management_osnotes.ppt
 
OS_Ch11
OS_Ch11OS_Ch11
OS_Ch11
 
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
 
oslectureset7.pdf
oslectureset7.pdfoslectureset7.pdf
oslectureset7.pdf
 
Unit 3 chapter 1-file management
Unit 3 chapter 1-file managementUnit 3 chapter 1-file management
Unit 3 chapter 1-file management
 
Unit ivos - file systems
Unit ivos - file systemsUnit ivos - file systems
Unit ivos - file systems
 

More from Shay Cohen

Linux Performance Tunning Memory
Linux Performance Tunning MemoryLinux Performance Tunning Memory
Linux Performance Tunning MemoryShay Cohen
 
Linux Performance Tunning Kernel
Linux Performance Tunning KernelLinux Performance Tunning Kernel
Linux Performance Tunning KernelShay Cohen
 
Linux Performance Tunning introduction
Linux Performance Tunning introductionLinux Performance Tunning introduction
Linux Performance Tunning introductionShay Cohen
 
chroot and SELinux
chroot and SELinuxchroot and SELinux
chroot and SELinuxShay Cohen
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/CoreShay Cohen
 
Infra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automationInfra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automationShay Cohen
 
14 network tools
14 network tools14 network tools
14 network toolsShay Cohen
 
13 process management
13 process management13 process management
13 process managementShay Cohen
 
12 linux archiving tools
12 linux archiving tools12 linux archiving tools
12 linux archiving toolsShay Cohen
 
11 linux filesystem copy
11 linux filesystem copy11 linux filesystem copy
11 linux filesystem copyShay Cohen
 
08 text processing_tools
08 text processing_tools08 text processing_tools
08 text processing_toolsShay Cohen
 
07 vi text_editor
07 vi text_editor07 vi text_editor
07 vi text_editorShay Cohen
 
06 users groups_and_permissions
06 users groups_and_permissions06 users groups_and_permissions
06 users groups_and_permissionsShay Cohen
 
05 standard io_and_pipes
05 standard io_and_pipes05 standard io_and_pipes
05 standard io_and_pipesShay Cohen
 
04 using and_configuring_bash
04 using and_configuring_bash04 using and_configuring_bash
04 using and_configuring_bashShay Cohen
 
03 browsing the filesystem
03 browsing the filesystem03 browsing the filesystem
03 browsing the filesystemShay Cohen
 
02 linux desktop usage
02 linux desktop usage02 linux desktop usage
02 linux desktop usageShay Cohen
 
09 string processing_with_regex copy
09 string processing_with_regex copy09 string processing_with_regex copy
09 string processing_with_regex copyShay Cohen
 
01 linux history overview
01 linux history overview01 linux history overview
01 linux history overviewShay Cohen
 

More from Shay Cohen (19)

Linux Performance Tunning Memory
Linux Performance Tunning MemoryLinux Performance Tunning Memory
Linux Performance Tunning Memory
 
Linux Performance Tunning Kernel
Linux Performance Tunning KernelLinux Performance Tunning Kernel
Linux Performance Tunning Kernel
 
Linux Performance Tunning introduction
Linux Performance Tunning introductionLinux Performance Tunning introduction
Linux Performance Tunning introduction
 
chroot and SELinux
chroot and SELinuxchroot and SELinux
chroot and SELinux
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
 
Infra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automationInfra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automation
 
14 network tools
14 network tools14 network tools
14 network tools
 
13 process management
13 process management13 process management
13 process management
 
12 linux archiving tools
12 linux archiving tools12 linux archiving tools
12 linux archiving tools
 
11 linux filesystem copy
11 linux filesystem copy11 linux filesystem copy
11 linux filesystem copy
 
08 text processing_tools
08 text processing_tools08 text processing_tools
08 text processing_tools
 
07 vi text_editor
07 vi text_editor07 vi text_editor
07 vi text_editor
 
06 users groups_and_permissions
06 users groups_and_permissions06 users groups_and_permissions
06 users groups_and_permissions
 
05 standard io_and_pipes
05 standard io_and_pipes05 standard io_and_pipes
05 standard io_and_pipes
 
04 using and_configuring_bash
04 using and_configuring_bash04 using and_configuring_bash
04 using and_configuring_bash
 
03 browsing the filesystem
03 browsing the filesystem03 browsing the filesystem
03 browsing the filesystem
 
02 linux desktop usage
02 linux desktop usage02 linux desktop usage
02 linux desktop usage
 
09 string processing_with_regex copy
09 string processing_with_regex copy09 string processing_with_regex copy
09 string processing_with_regex copy
 
01 linux history overview
01 linux history overview01 linux history overview
01 linux history overview
 

Recently uploaded

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
 

Recently uploaded (20)

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 

10 finding files

  • 2. Finding Files • The Linux File System hierarchy includes a large amount of directories and a deep tree of subdirectories • When interacting with the system, one of the most common need is finding a file’s location or find which files are included in a custom search criteria.
  • 3. find • ‘find’ is a power-full file search tool. It can find files that matches any type or criteria, such as: – File name – Modification or Access time – File size – Similarity to other files
  • 4. find • Syntax:  find [options] [filename(s)] • Options:  -name ‘pattern’ find files with name matching name  -iname ‘pattern’ same as above. Case insensitive  -mtime +/-N find files with modification time of more (+) or less (+) then N days  -mmin +/-N same as above. N stands for minutes  -[i]regex find files with name matching regex  -user user find files owned by user  -size +/-N[kMG] find files with size bigger or smaller than N
  • 5. find  -exec command {} ; execute command {} while replacing {} with the file name. This option should be used in conjunction with at least one filter option Example $ find . -name .b* -exec head -n1 {} ; # .bash_profile # .bashrc # ~/.bash_logout ls -ltr ~
  • 6. locate • ‘locate’ is another tool that finds files. It uses a database which holds a list of all the files in the system and needs to be updated periodically using the command ‘updatedb’ • Syntax:  locate [options] PATTERN • Options:  -r ‘regex’ find file with names matching regex  -c only report amount of times each file was found

Editor's Notes

  1. Exercise: find all files on your home directory that has been changed in the last 3 days.
  2. Exercise: - find all files on your home directory that has been changed in the last 3 days. same with files last accessed in the past minutes