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.

A Look at vCenter 5.5 SSO RC Installation

vCenter single sign on (SSO)  vsphere 5.5  release has several improvements, like the following: Completely re-written from the ground Multi-master architecture Native replication mechanism SSO now has site awareness (think

vCheck6 Utility Commands

There is a new release of the vCheck6 and those with need for more info they can visit the vCheck 6 release page and ensure to visit the vCheck plugins

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