How to Find Locate Search for Files with Linux

November 24, 2020

Table of Contents

Basic Linux commands for your server or servers.

Introduction

Many servers admins or hobbyists will usually at some point have an issue trying to find files on the Linux server.

This quick guide will learn you how to use the find command. This will help you search for files on your VPS or Dedicated Server using many options like filters and file types and even size. Also included is how to use the locate command which is obviously used to locate files/folders on a Linux Machine.

Finding Files/Folders using Name

Quite an easy way to find what you need using the command:

 find -name whateverhere

To find any file by name, input:

find -name filenamehere

Finding or Searching by Type

You can specify the type of files you want to find with the -type parameter. It works like this:

  • find -type type_descriptor query

Different ways to find file types using find / -type f for example:

f: regular file

d: directory

l: symbolic link

c: character devices

b: block devices

For example, if you want to find character devices, input this command:

  find / -type c

You can search all files that end in .conf using tis command:

  • find / -type f -name “*.conf”

Find files larger than whatever size you want for example using this command:

find / -size +50M

You can of course change to something like this command:

find / -size +5000M

Try mlocate you can install the command below with Debian/Ubuntu

apt install mlocate

On CentOS, use dnf instead:

dnf install mlocate

mlocate database auto-updates using a daily cron you can update before searching for something with the following command:

updatedb

Use the updateb command before you search using mlocate to ensure you are searching all files including new files.

To find files with locate, simply use this following example command:

locate whateveryouwanthere

Another example:

locate *.gz

If you want to see the history of data information locate has indexed use the following command:

locate -S

Share on
Facebook
Twitter
LinkedIn
Pinterest
More posts

Dedicated Servers Quick Guide

What is a Dedicated Servers? Why bother using a dedicated server over a VPS or Shared Hosting?A dedicated server is a server 100% dedicated to your website/project or business needs.

Emailing vCloud Organization Users

Due to a lot of requests I found necessary to show you guys who might be having a problem using the “notify users” function in the vCloud Director web UI

Get 90% Discount

First 3 People gets the Bonus!
Don't Miss Out Our Big Sale

Get 0-90% On All
247Rack Services

247Rack

The Sale Is Until The End Of March