KEMBAR78
13 Find Command | PDF | Directory (Computing) | Computer File
0% found this document useful (0 votes)
5 views3 pages

13 Find Command

Uploaded by

Brian K. Acevedo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

13 Find Command

Uploaded by

Brian K. Acevedo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Linux find Practices: 10 Exercises

Practice 1: Finding Files in the Current Directory


Objective: Use find to locate specific files in a directory.
Instructions:
1. Open your Linux terminal.
2. Navigate to the Marvel directory using cd Marvel.
3. Find all files named Avengers.txt using:
find . -name "Avengers.txt"
4. Observe the output to locate the file.

Practice 2: Finding Files by Extension


Objective: Use find to locate files with a specific extension.
Instructions:
1. Inside the Marvel directory, search for all .txt files:
find . -name "*.txt"
2. Verify that all text files in the directory and subdirectories are listed.

Practice 3: Finding Files in Specific Directories


Objective: Use find to search within a specific directory.
Instructions:
1. Search for files only within the Heroes directory:
find Heroes -name "*.txt"
2. Observe the output to ensure it only includes files in the Heroes directory.

Practice 4: Finding Hidden Files


Objective: Use find to locate hidden files.
Instructions:
1. Inside the Marvel directory, search for hidden files:
find . -name ".*"
2. Verify that hidden files such as .ShieldSecrets are displayed.

Practice 5: Finding Files by Size


Objective: Use find to locate files larger than a specific size.
Instructions:
1. Search for files larger than 1MB:
find . -size +1M
2. Observe the output to identify large files, such as mission logs or reports.

Practice 6: Finding Files Modified Recently


Objective: Use find to locate files modified in the last N days.
Instructions:
1. Search for files modified in the last 7 days:
find . -mtime -7
2. Use the output to identify recently updated files, such as BattlePlans.txt.

Practice 7: Finding and Deleting Files


Objective: Use find to locate and delete specific files.
Instructions:
1. Inside the Marvel directory, search for and delete all files named Temp.txt:
find . -name "Temp.txt" -delete
2. Verify the deletion by searching again.

Practice 8: Finding Files by Type


Objective: Use find to locate directories or other file types.
Instructions:
1. Search for directories in the Marvel structure:
find . -type d
2. Verify that only directories, such as Heroes and Villains, are listed.

Practice 9: Finding Files by Permissions


Objective: Use find to locate files with specific permissions.
Instructions:
1. Search for files with 700 permissions:
find . -perm 700
2. Verify that restricted files, such as WakandaSecrets.txt, are displayed.
Practice 10: Executing Commands on Found Files
Objective: Use find to execute commands on located files.
Instructions:
1. Search for all .txt files and display their content:
find . -name "*.txt" -exec cat {} ;
2. Observe the output to verify that the contents of each file are displayed.

You might also like