0
0
Linux CLIscripting~15 mins

find command basics in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Find Command Basics
📖 Scenario: You are organizing files on your computer. You want to find specific files quickly using the find command in Linux.
🎯 Goal: Learn how to use the find command to search for files by name in a directory.
📋 What You'll Learn
Use the find command to search files
Search files by exact name
Search files in a specific directory
Display the full path of found files
💡 Why This Matters
🌍 Real World
Finding files quickly in large folders is common when managing documents, code, or media files.
💼 Career
System administrators and developers often use the <code>find</code> command to locate files for backup, cleanup, or deployment tasks.
Progress0 / 4 steps
1
Create a test directory with files
Create a directory called testdir and inside it create three files named file1.txt, file2.txt, and notes.txt using the mkdir and touch commands.
Linux CLI
Need a hint?

Use mkdir testdir to create the folder and touch to create empty files.

2
Set the search directory variable
Create a variable called search_dir and set it to the path of the testdir directory you created.
Linux CLI
Need a hint?

Use search_dir=testdir to store the testdir directory path.

3
Use find command to search for a file
Use the find command with $search_dir to find the file named file2.txt.
Linux CLI
Need a hint?

Use find "$search_dir" -name "file2.txt" to find the file by name.

4
Display the found file path
Run the script to display the full path of file2.txt found by the find command.
Linux CLI
Need a hint?

The output should show the full path ending with file2.txt.