How Do You Search For Files For Linux Command?


It is easy for users who are familiar with Linux from the beginning, but one of the embarrassing tasks for users from Windows is ‘find files’.

Linux Mint is a distribution based on Ubuntu whose purpose is to include several simple, personalized resources and optional out-of-the-box multimedia support with a classic desktop experience. A custom desktop and menus, some special configuration tools, and a web-based installation interface for the kit are also added. Linux Mint is compatible with the repositories of Ubuntu software.

Is Linux an Operating system?

Linux ® is an operating system ( OS) that is an open-source system. The program that directly controls the hardware and resources of a device, such as CPU, memory, and storage, is an operating system.

What is the Linux Operating System?

Linux is an operating system much like Windows, iOS, and Mac OS. The Linux operating system is operated by one of the most popular platforms on the earth, Android. An operating system is a software that controls all of the desktop or laptop related hardware resources.

There are several different components of the Linux operating system:

  1. Bootloader
  2. Kernel
  3. Init System
  4. Daemons
  5. Graphical server
  6. Desktop Environment
  7. Applications

Linux Basic commands:

Here is a list of the following simple Linux commands:

  1. pwd. To find out the direction of the current working directory (folder) you are in
  2. Command to cd. Use the cd command to move through the Linux files and folders. 
  3. Control of ls. 
  4. Command for the cat and many more

To suit every form of user, Linux has a variety of different versions. You will find a “flavor” of Linux to fit your needs, from new users to hard-core users. These variants are called distributions (or “distros” in the short form). You can download almost any Linux distribution for free, burn it to a disc (or USB thumb drive), and install it (on as many machines as you like).

Linux Mint is a distribution based on Ubuntu whose purpose is to include several simple, personalized resources and optional out-of-the-box multimedia support with a classic desktop experience. A custom desktop and menus, some special configuration tools, and a web-based installation interface for the kit are also added. Linux Mint is compatible with the repositories of Ubuntu software.

On Windows, you can find what you need with a GUI and search bar, but in command-line Linux, you can easily get lost.

When using a Mac, because of the GUI, you often forget these commands. So, it will help to make a note of the Linux basic commands that help.

If you want to find a file called foo.txt on Linux, you can do this.

$ find / -name ‘foo.txt’

The find command searches for subfolders recursively, so even if you write the path of the topmost folder, it will search through all the subfolders and list the files.

However, since searching the root folder every time is a waste of time, you can specify a folder where foo.txt is likely instead of the root folder. 

(Here / home / myspace)

$ find /home/myspace -name ‘foo.txt’

To see if there is a specific string in the file, the most common method is a combination of cat and grep as shown below. Below it searches all files in / home/myspace (except for subfolders) and finds the string foobar.

$ cat /home/myspace/* | grep foobar

However, the above method does not tell which file contains the text I want to find. In this case, you can use grep’s option to show which file contains the character you want and where.

The following method finds all sub-files containing the string foobar in / home/myspace and displays the line number where the string is located. The e-option accepts regular expressions, so you can include regular expressions instead of strings.

$ grep -rnw ‘/home/myspace’ -e ‘foobar’

If you are not interested in the content and only want to know which files are included, use this.

$ grep -rnwl ‘/home/myspace’ -e ‘foobar’

You can do a similar thing on Windows, just do this. Similarly, it shows the file path, line number, and contents.

C:\> findstr /s /i /p ‘foobar’ ‘/home/myspace/*.*’

The command line is indeed more inconvenient than the GUI, but once you get used to it, you can do much more powerful things. Sometimes a lot of GUI Nogada can be solved with a few commands. Finding these files and finding content can help you troubleshoot OS configuration problems. Or source bugs by finding specific settings or values ​​that maybe somewhere on this computer.