News
Seven days of Black Friday madness — great deal from Serverspace!

THE NEW YEAR
WHEEL OF FORTUNE

Spin the wheel and win a guaranteed prize right now!

By registering, you are signing up to receiving emails.
RF
August 24 2023
Updated August 22 2023

Linux find command

Debian Maintenance VPS

Introduction

Linux mostly used with CLI shell for efficiency and rapid communication with OS, that help to execute process and task. That operating system represent modular architecture, whith ocean of utilities, daemons and files. How to search needed object in that chaos? We can use default utility find for that task.

Requirements

  • Root rights;
  • Debian 12 or higher version;
  • Several knowledge about work OS ;
  • Internet connection.

How to use?

Let's imagine we have backup in our system which name is BACKUP.txt in one of the tonne of data, then we need to check installation of command:

find --help
help
Screenshot №1 — Help

Alright, utility was in the system before, now we can use command below for search needed object:

find / -name "BACKUP.txt"

But if you don't remember format of your backup file, then you can mask for searching:

find / -name "BACKUP.*"

Alternatively, if you search by only format, then you can use command below:

find / -name "*.txt"
Path of backup
Screenshot №2 — Path of backup

We can see two path in the whole file system and in the command we indicate / like as root of all machine. But what if you don't remember name and type of file, but you highlight, that creating was day ago, type command:

find /data -mtime -1
Modification time
Screenshot №3 — Modification time

If we want search only file then use accordance option and we also can combine this:

find /data -type f -mtime -1
Type of file
Screenshot №4 — Type of file

The Mtime that decoding as modification time and we can see that text file, if we remember only a size of saved file we can use:

find /data -size -1M
Size of file
Screenshot №5 — Size of file

But if you remember only specific data, for example, you denied access for all group and users with exception owner to the file. Then use command below:

find /data -type f -perm 700
Permission of file
Screenshot №6 — Permission of file

Conclusion

The find utility stands as a powerful ally in the realm of Linux exploration, enabling you to efficiently locate files based on diverse attributes such as names, types, sizes, and modification times. By mastering this utility, you harness the ability to navigate the intricate tapestry of the Linux filesystem with finesse and precision.

Vote:
5 out of 5
Аverage rating : 5
Rated by: 1
1101 CT Amsterdam The Netherlands, Herikerbergweg 292
+31 20 262-58-98
700 300
ITGLOBAL.COM NL
700 300

You might also like...

We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.