14-Apr-2023
.
Admin
Hello Friends,
In this tutorial, we will learn how to find files by name, size, and type in Linux Ubuntu using the terminal.
Find Files in Linux Ubuntu Using the Terminal: Through this tutorial, we will learn how to find files by name, size, and type in Linux Ubuntu using the terminal.
In this quick example, let's see how to find files in Ubuntu using the terminal. This tutorial will give you a simple example of how to find a file by name using the command line in Ubuntu. This article goes into detail on finding a file by name using the command line. I explained simply step by step how to search files on the linux terminal. you will do the following things how to find files in the linux terminal.
Finding by Name using Terminal
Use the following command to find a file by name; is as follows:
find -name "query"
Use the following command to find a file by name but ignore the case of the query; is as follows:
find -iname "query"
Use the following command to find all files that don’t adhere to a specific pattern; is as follows:
find -not -name "query_to_avoid"
Finding by Type using Terminal
Use the following command to find the -type parameter; is as follows:
find -type type_descriptor query
There are other options in the type to find the file. These are given below:
Filtering by Time and Size using Terminal
You can also find files by their size and time in the Linux Ubuntu system. The following commands have been given for this:
And also known as some commonly used size suffixes:
For example, the following command will find each file in the /usr directory that is exactly 60 bytes:
find /usr -size 60c
To find files that are less than 100 bytes, Use the following command:
find /usr -size -100c
To find files over 800 megabytes in the /usr directory, Use the following command:
find /usr -size +800M
Find File By Time using Terminal
Here we will talk about how to find time recording files in the Linux Ubuntu system.
For example, to find files in the /usr directory that were modified in the previous day, use the following command:
find /usr -mtime 1
If you want files that were accessed less than a day ago, you could run this command:
find /usr -atime -1
To find files that last had their meta information changed more than 3 days ago, you might execute the following:
find /usr -ctime +3
These options also have companion parameters you can use to specify minutes instead of days:
find /usr -mmin -1
This will give the files that have been modified at the last minute.
find can also do comparisons against a reference file and return those that are newer:
find / -newer reference_file
I hope it can help you...
#Ubuntu