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  Scientists can create an atmosphere around a black hole in the lab | Science

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  Valve announces Steam Deck OLED, and Switch says it's paving the way for OLED
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  The latest men's watches for 2022 .. "Apple" has been upgraded and "Casio" is back.

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
    • June 5, 2024
    • 505 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…

    • Tech
    • May 20, 2024
    • 599 views
    Unlock the easiest way to get EU citizenship of Slovenia and Romania with Union Permits

    Due to the nature of their immigration programs, Slovenia and Romania are the European countries where it is easier to get EU citizenship. In these states, newcomers can obtain a…

    Leave a Reply

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

    You Missed

    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

    Where to Get a Professional Massage in Dubai

    Where to Get a Professional Massage in Dubai

    Dog Spay Surgery 101: Benefits, Risks, Cost, and Aftercare

    Dog Spay Surgery 101: Benefits, Risks, Cost, and Aftercare