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
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"
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
If we want search only file then use accordance option and we also can combine this:
find /data -type f -mtime -1
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
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
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.