How to use find, locate, which, whereis, whatis and grep commands in Linux

  • Tech
  • March 13, 2023

The first hurdle Linux users face is searching and locating files. Some users may not know how to use each of the following six search commands in Linux, locate, which, whereis, whatis, and grep. The methods differ from others in its results. Because each command is concerned with searching in a specific field and in a specific situation, so you must know how to use all the search commands in Linux, the website we will show you in this article.

search command Find out

The Find command in Linux is used to search directories and files and perform several sequential operations by folder, file, modified date, folder, owner, navigating through files in a pyramid-like fashion. , creation date or name and command are entered according to the following method:

How to Use Search Commands in Linux

Tools used in the Find command

  • Perm Octal: If the declaration is octal, this option is used in the search of the file
  • Links: Used to search for files with N attachment
  • Blank: Enables searching for empty paths and files.
  • Name Demo: It is used to search for classified files with the demo command
  • user Name: Contributes to searching files related to ID number or username.
  • :(expr) True ifexpr is true, and is used for grouping in addition to the OR or AND suffixes
  • EXPERIENCE!: Expert lies are true.
  • New file: This option searches for files created or modified in a file.
  • Imma n: Searches for files with N attachment
  • Size + N/ -N: It is used to scale files of type N followed by C followed by size.
  • – violated CMD: Uses the file you want to search for as the previous method, like the exit option on successful completion of the command.
  • ok CMD: This option remains the same as before, with the username changed and added first.
See also  What do young stars teach us about the birth of our solar system?

Use the Locate command

Install the detect command function

The locate command is faster than find because it does not rely on the file’s own database, and the locate command functionality is not installed on all versions of Linux. To do this, you can install it by typing the following commands:

  • Type susdi apt-get update and press enter
  • On Debian and Ubuntu, type sudo apt-get install mlocate and hit enter
  • On Arch Linux, using the Pacman cluster manager, type pacman -s mlocate
  • Type emermerm , emermmogate in the Condo app

Update location

  • The locate command cannot find anything if there is no database.
  • But this can happen manually or automatically by adding susdo updated and then pressing the Enter option

Use the find command

  • The Find command is fast, but it’s a shame it doesn’t have the options found in the Find command, so you can just type “locate-i.jpg” and search for files. in jpg format.
  • * -I is completely ignored as with the Find command if it performs the same function as the Find command.

Limit search results

  • Multiple search results can be collapsed with the -n option to show results like “*.jpg -I – 20 -n locate”.
  • Then the first 20 search results are displayed with the locate command.

Use any command

  • By using the which command, you can search the directories found in the user’s path and specify the scope of the command you want to search for, as well as specify the version of the command or program. The name is written in the command field.
  • If you want to search for a specific command or program like Geoloc; It must be in a certain place in the path, and as soon as its name is written, it is immediately executed; So you can use any search command to specify its location via any geolog and then click enter button
See also  How to set up and use the WhatsApp app on Android smartwatches
Use search commands in Linux

Use the whereis command

  • The whereis command is very similar to the which command, but is more detailed In addition to the program file or command location, the whereis command manually returns data for the location of files and source codes; Most likely, you will not find these files on the computer, but if they are, where will they be displayed?
  • The word package usually refers to page files and command source code. type thereis diff and it will display the location of the diff files and their supporting document file, to narrow down the results, only the location of the supporting document will be displayed; Use the -b option by typing whereis -b diff
  • You must rely on the -m command to narrow down the search results to only display pages, and you must use the -s option to display source code files and find out what range the search command searches. , you can use command -1

Use the whatis search command

  • The whatis command is one of the search commands used in Linux and is characterized by displaying search results quickly through manual pages as it displays short results in one line about the command to be searched for.
  • If you use the whatis command, you will see two descriptions for the same result, a short description and a detailed description. To enter a directory in the description section, use the man command with the addition of man 1 man.
  • Whatis -s “7” man can rely on the -s option to narrow search results to the section corresponding to the directory, and results that refer to directory section 7 will be displayed.
See also  All devices manufactured after 2014 can be hacked via Bluetooth

Use the grep search command

  • The grep search command is used to search a specific text or a specific file for lines that contain links to selected words, as the grep command displays similar lines.
  • Files with a username like harvy can be searched with the grep command; Then type:
    • grep -1 “harvy” /etc/passwd
  • When searching for a specific phrase or word and want to ignore the secondary order, the -w option should be used.
  • A command line in Linux is a program or tool that is used to interact with the computer through a set of options that differ from one tool to another based on their usage and purposes.
  • Search commands in Linux are used to perform necessary operations without requiring RAM.

Finally, we learned in detail how to use find, locate, which, whereis, whatis and grep commands in Linux.

  • Stuart Wagner

    "Professional coffee fan. Total beer nerd. Hardcore reader. Alcohol fanatic. Evil twitter buff. Friendly tv scholar."

    Related Posts

    • Tech
    • November 6, 2024
    • 130 views
    Yaroslav Bogdanov: Google in Dubai announced the launch of an artificial intelligence initiative for MENA countries

    On November 1 in Dubai, Google announced the launch of the AI Opportunity initiative for the Middle East and North Africa (MENA). This is Google’s largest AI initiative for this…

    • Tech
    • June 5, 2024
    • 553 views
    Artificial Intelligence in Daily Work

    Using AI has become a part of our everyday lives, including work. We can ease so many tasks and still be good at what we do for a living! Many…

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    You Missed

    Free Job Posting Sites in the UAE: Perfect for Both Job Seekers and Recruiters

    Free Job Posting Sites in the UAE: Perfect for Both Job Seekers and Recruiters

    Yaroslav Bogdanov: Google in Dubai announced the launch of an artificial intelligence initiative for MENA countries

    Yaroslav Bogdanov: Google in Dubai announced the launch of an artificial intelligence initiative for MENA countries

    How to Choose the Right Mattress: Find the Best Fit for You

    How to Choose the Right Mattress: Find the Best Fit for You

    Emils Kerimovs on Wealthtech Revolution: Investing in the Middle East and Africa

    Emils Kerimovs on Wealthtech Revolution: Investing in the Middle East and Africa

    Forex Brokers Review: Is ITBFX A Safe Broker?

    Forex Brokers Review: Is ITBFX A Safe Broker?

    Best Kitchen Renovation Ideas to Upgrade Your Space

    Best Kitchen Renovation Ideas to Upgrade Your Space