

-amin: This one is for access time elapsed in minutesįor each of this option, you can specify a threshold, and say if it should be above or that threshold.-mmin: Same thing for the modification minutes.-ctime: Difference in days from the creation date.-cmin: Difference in minutes from the creation date.It works all the same, so I’ll give you all the options at once: The first one is to find files depending on their creation, access or modification date. Well, find has many options to help you in this case. Ok, so the name/iname option is cool, but what if I don’t know the name of the files I’m looking for? The first one is for file ending with “syslog”, the second starting with “syslog” and the last one containing “syslog”. If you also want files containing the word you provide in parameter, you can use stars as wildcard, for example: This is perfect if you know the exact name of a file and want to locate it, but it’s not working if you only have a part of the name. You can remove the path to search in the current directory (recursively), or the options (to display all file), but most of the time you will use both.Īlso, when looking for a file in the whole file system, don’t forget to use sudo to get access to the system files.

The find syntax is generally formatted as: I will try to keep this simple, and give you the most useful options only. Unfortunately, many criteria means many options to remember when you try to use it. It’s powerful and will save you most of the time, as you can add many criteria to filter the results you are interested in. Find Introductionįind is the command that most people will give you when you ask where is my file. Just connect to your Raspberry Pi with SSH, open a session if on a minimal system, or start a terminal on Desktop. I will also give you a bonus tip at the end 🙂īefore going further, if you are really new in the command line, I recommend checking my tutorial on how the Raspberry Pi file system works.Īll the commands listed here can be use on most Linux operating systems. In this post, I’ll explain the command syntax for each one, and give you a few examples, so you can use them correctly. They accept interesting options, to quickly locate any file on the Raspberry Pi file system.

I will show you everything in this tutorial.įind, locate and grep are three commands very useful to search for a file on Raspberry Pi. No worry, you can do everything with a few commands to learn. The former only matches empty files, the latter matches files from 0 to 1,048,575 bytes.On Raspberry Pi OS (especially the lite version), there is no fancy tool to find a file on your SD card. Bear in mind that the size is rounded up to the next unit. The + and - prefixes signify greater than and less than, as usual i.e., an exact size of n units does not The `b' suffix always denotesĥ12-byte blocks and never 1024-byte blocks, which is different to the behaviour of -ls. `%k' and `%b' format specifiers of -printf handle sparse files differently. In other words, it's consistent with the result you get for ls -l. The size is simply the st_size member of the struct stat populated by the lstat (or stat) system call, rounded `k' for kibibytes (KiB, units of 1024 bytes) `b' for 512-byte blocks (this is the default if no suffix is used) You can use find /PATH/TO/specific_directory -size +MIN -size -MAXįor precise info about what MIN and MAX could be, check man find -size nįile uses n units of space, rounding up.
