How to Find Locate Search for Files with Linux

Table of Contents

Facebook
Twitter
LinkedIn
Pinterest

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

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.

Release: Veam Backup & Replication 6.5

For those not aware, there has been a new release of the Veam Backup & Replication 6.5. It’s very interesting, the first backup solution for vSphere 5.1 and windows Server

Free eBooks from Microsoft Press

It is clear that Microsoft have available a books, which are free to download. These books provide an introduction and detailed information on some of their enterprise nad development products. They