![find file in linux find file in linux](https://www.oreilly.com/content/wp-content/uploads/sites/2/2020/01/how-find-duplicate-files-linux-f2242f9a72d3dba2247c283bbf196f34.png)
For instance, this search looks for files with modification times more than one day in the past, but no more than seven: $ find ~ -mtime + 1 -mtime -7 Limit a search by file type
![find file in linux find file in linux](https://sourcedigit.com/wp-content/uploads/2018/03/diff-command.png)
For the first -mtime argument, provide the most recent number of days you could have modified the file, and for the second, give the greatest number of days. You can combine -mtime options to locate a file within a range of days. home /tux /Documents /examples /foobar.txt Find a file modified within a range of days Here's a literal search for a file with the name "foo": By default, your search string is treated literally: The find command searches for a filename that is exactly the string you enter between quotes unless you use regular expression syntax.Īssume your Documents directory contains four files: Foo, foo, foobar.txt, and foo.xml. The find command requires the path to the directory you want to search in, options to specify what attribute you're searching (for instance, - name for a case-sensitive file name), and then the search string.
#Find file in linux full#
You can locate a file by its filename by providing the full file name or parts of the file name using regular expressions. Most commands demonstrated in this article work with other implementations of find, but should you try a command on a platform other than Linux and get unexpected results, try downloading and installing the GNU version. This article uses GNU find from the findutils package because it's readily available and pretty popular. The GNU find command, for instance, has features that the BSD or Busybox or Solaris find command might not have or does have but implements differently.
![find file in linux find file in linux](https://winaero.com/blog/wp-content/uploads/2016/12/Linux-find-largest-file-or-folder.png)
However, not all find commands are exactly alike. Simply put, you already have find installed as long as you're running Linux, BSD, or macOS. The find command is defined by the POSIX specification, which creates the open standard by which POSIX systems (including Linux, BSD, and macOS) are measured.