Introduction
In the 1990s, Finnish software engineer Linus Torvalds and the Free Software Foundation developed the Linux OS. It is an open-source operating system. It provides a list of tools to perform various tasks.
In this article, we will discuss the basic tools available in Linux to perform basic operations and locate files, set time and date, sleep mode etc.

Tools for Searching Files in Linux
Mainly two basic tools are used in Linux for finding a specific file inside a directory.
-
Find Tool.
-
Locate Tool.
The find tools and locate tools are used to search a file by filename. However, the difference between the two operations is that whereas the find tool checks the filesystem, locate searches the database as a background process. The find command generally takes longer than the locate command.
Linux Find Tool
It is used to search a list of files satisfying various conditions, such as
-
Filetype.
-
User ownership.
-
Size.
-
Date and time.
-
File name and many more.
The syntax of the Linux command for the Find tool:
find <file-location> <conditions> <search-keyword>
It is in the form of the following:
$ find [Where to begin your search]
[expression chooses what to find in the filesystem] [-options] [What to find]
Parameters
We can search a file by using different parameters.
Using File name
We may search over every file that ends in ".txt." To perform this, use the following syntax:
find . /CodingNinjas-name example .txt
Using File type
The file type can be specified using the '-type' keyword. To perform this, use the following syntax:
find . -type d -name .txt
It will display all files that end in ".txt."
The following are some of the file types:
-
f: normal file
-
d: directory
-
l: symbolic links
-
b: Blocking devices
Finding Directory
To find a directory, use the 'type -d' option. To perform this, use the following syntax:
find . type -depth -name Newdirectory
Newer Files
The '-newer' keyword facilitates the search for more recent files than the specified file. To perform this, use the following syntax:
find . -newer example.txt
Empty Files
Use the '- empty' keyword to find all the empty files and folders in the specified directory. We can use the following syntax:
find ./CodingNinjas -empty
Linux Locate Tool
The Locate tool searches the file in the database. You can use the "updatedb" command to update your database if you are unable to locate a file using the locate command because your database is out of date.
The Syntax for the locate tool:
locate[OPTION]… PATTERN..
If any of the provided matches are discovered, this command will exit with status 0. It will terminate with status 1 if no match is discovered or if a fatal error occurs.
Options
Here are some useful command-line options:
🧩 -A, --all: This option displays only entries that match all PATTERNs rather than just the one that matches.
🧩 -b, –basename: It matches only the base name against the given patterns.
🧩 -c, –count: Only print the number of matching items on standard output; do not print file names.
🧩 -d, --database DBPATH: It is used to substitute DBPATH for the default database.
🧩 -e, --existing: When the command is used, it displays only entries that refer to existing files.
🧩 -h, -help: Successfully exit by printing a list of all available options to standard output.
🧩 -i, –ignore-case: When matching patterns, ignore case-related differences.
🧩 -L, --follow: When the '—existing' option is supplied, it is used to check for the existence of files and to track trailing symbolic links. The output will not contain the broken symbolic links.