$ discover . -name myfile -print ./checks/eg/myfile ./checks/myfile
Within the above instance, the command shows solely the title and placement of the recordsdata that it finds. Use the -ls command as a substitute of -print and also you get the sort of particulars you’d anticipate while you listing recordsdata with the ls -l command.
$ discover . -name myfile -ls 36417 4 -rw-r--r-- 1 shs shs 188 Jun 10 09:57 ./checks/eg/myfile 36418 4 -rw-r--r-- 1 shs shs 83 Jun 10 09:57 ./checks/myfile
Perceive that beginning places don’t must be relative. You’ll be able to all the time use an entire path like /house/jdoe or /usr/native/bin wherever you’re sitting within the file system supplied you have got learn entry to these places or use the sudo command to offer you root-level entry.
Discovering recordsdata by partial title
To search out in another way named recordsdata that share just some portion of their filenames, enclose the shared portion of the file names in a string utilizing quotes and use asterisks to specify the situation of the variable parts of the file names (e.g., “*txt“ to seek out recordsdata with names that finish in “txt”). Within the command beneath, we discover recordsdata that begin with “zip”.
$ discover /usr/bin -name "zip*" /usr/bin/zipgrep /usr/bin/zipinfo /usr/bin/zip /usr/bin/zipcloak /usr/bin/zipnote /usr/bin/zipsplit
Discovering recordsdata by age
To search out recordsdata which have been modified inside the final 24 hours, use a command like this with the -mtime (modification time) possibility:
$ discover . -mtime 0 -ls 3060 0 drwx------ 1 shs shs 3050 Jun 10 10:35 . 36415 0 drwxr-xr-x 1 shs shs 16 Jun 10 09:54 ./checks 36416 0 drwxr-xr-x 1 shs shs 12 Jun 10 09:53 ./checks/eg
The 0 in that command means “0 days previous” (i.e., lower than a day previous). You may as well use -mtime with constructive and adverse indicators. For instance -mtime -2 or -mtime +4. Utilizing -mtime -1 means “lower than sooner or later previous”. Utilizing -mtime +1 means “greater than sooner or later previous”, so the outcomes can be dramatically totally different. For those who’re on the lookout for a file that you simply had been engaged on every week in the past, a command like this may work simply advantageous:
$ discover . -mtime -8 -ls
One other straightforward method to listing not too long ago modified recordsdata is to make use of the ls command. The -ltr arguments characterize an extended itemizing (-l), type in newest-first time order (-t) and reverse the order (-r). Utilizing these choices, the recordsdata will likely be listed with probably the most not too long ago modified recordsdata proven final.