
To demonstrate this we can again search the home directory for Ogg Vorbis files but this time looking for those that are 100 megabytes or larger: This highlights an important difference in the way that find operates in that it examines the system directly each time unlike programs like locate or slocate which actually examine a regularly updated database of filnames and locations.Īnother possible search is to search for files by size. This could be a slow search depending on the number of directories, sub-directories and files on your system. To perform the same search on your entire drive you would run: Here the option '-iname' performs a case-insensitive search while the wildcard character '*' matches any character, or number of characters, or zero characters. For example if you wished to search for all of the ogg files in your home directory, some of which you think might be named 'OGG' rather than 'ogg', you would run: Such a search can be much more sophisticated though. It is important to get into the habit of quoting patterns in your search as seen above or your search results can be a little unpredictable. The following command searches the home directory and all of its subdirectories looking for the file mysong.ogg: The most common use of find is in the search for a specific file by use of its name. These options can involve a search by name, by size, by access time or can also involve actions taken upon these files.
#Find file ubuntu series#
The option refers to one or a series of options which effect the overall option of the find command. The option refers to the particular location that you wish to search, whether it be your $HOME directory, a particular directory such as /usr, your present working directory which can simply be expressed as '.' or your entire computer which can be expressed as '/'.


This wiki page will be only be dealing with find while also briefly mentioning xargs. Xargs - build and execute command lines from standard input - usually you do this directly w/o xargs
#Find file ubuntu update#
Updatedb - update a file name database, i.e. Locate - list files in databases that match a pattern, i.e. findutils is actually made up of 4 utilities:įind - search for files in a directory hierarchy, whether its a database or not The GNU find command is part of the GNU findutils and is installed on every Ubuntu system. By default find prints the name of the located files but it can also perform commands on these files. The GNU find command searches files within a directory and its subdirectories according to several criteria such as name, size and time of last read/write.
