LFCS and LFCE: How to find files?


Now we are going to see the commands that are going to help us to find files. We can look for files by many criteria including name, size, date, and type.

 
To make a test with the command find I am going to create 4 files with the below command:
touch fileA fileB fileC fileD

We can create also files with no information on it, just based on a specific quantity of space.
truncate -s 3MB file1
truncate -s 30MB file2
truncate -s 25MB file3
truncate -s 11MB file4




So at the end in order to use the comannd find, we must use this basic syntax:

find -name file1
find -name fileA

To find a file regardless of what's begore and after it use this command: 

find . -name "*A*"

Insted to just find by size use:

find . -size -5M

(-5M indicates that we are going to search for files that are less than 5 Megabytes)

Comments

Leave as a comment:

Archive