{"id":5555,"date":"2023-06-06T21:58:51","date_gmt":"2023-06-06T21:58:51","guid":{"rendered":"https:\/\/www.webhi.com\/how-to\/?p=5555"},"modified":"2023-06-06T21:58:52","modified_gmt":"2023-06-06T21:58:52","slug":"search-for-files-on-linux-using-find-and-locate-commands","status":"publish","type":"post","link":"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/","title":{"rendered":"How to Search for Files on Linux using find\u00a0and\u00a0locate\u00a0Commands"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/06\/find_locate_en.jpg\" alt=\"Search for Files on Linux using the\u00a0find\u00a0and\u00a0locate\u00a0Commands\" class=\"wp-image-5654\" srcset=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/06\/find_locate_en.jpg 1200w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/06\/find_locate_en-300x169.jpg 300w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/06\/find_locate_en-1024x576.jpg 1024w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/06\/find_locate_en-768x432.jpg 768w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/06\/find_locate_en-150x84.jpg 150w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<p>When working with Linux, one common challenge is finding specific files. In this guide, we will explore how to use the\u00a0<strong><code>find<\/code>\u00a0command<\/strong> to search for files based on various filters and parameters. We will also briefly cover the\u00a0<strong><code>locate<\/code>\u00a0command<\/strong>, which provides an alternative way to search for files.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"prerequisites\">Prerequisites<\/h2>\n\n\n\n<p>In order to proceed with this tutorial, you must have a computer that runs on a Linux-based operating system. This can be either a local machine or a virtual private server accessible through SSH. While the demonstrations in this guide were verified on Ubuntu 20.04, they should function on any Linux distribution.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"searching-by-file-name\">Searching by File Name<\/h2>\n\n\n\n<p>The most commonly used method to search for files is by their name. To locate a file by name using the&nbsp;<code>find<\/code>&nbsp;command, you can utilize the following syntax:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ find \/ -name \"query\"<\/code><\/pre>\n\n\n\n<p>By default, this search is case-sensitive. If you want to perform a case-insensitive search, you can employ the&nbsp;<code>-iname<\/code>&nbsp;option:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ find \/ -iname \"query\"<\/code><\/pre>\n\n\n\n<p>If you wish to find all files that do not match a particular pattern, you can utilize the&nbsp;<code>-not<\/code>&nbsp;option:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ find \/ -not -name \"query_to_avoid\"<\/code><\/pre>\n\n\n\n<p>Alternatively, you can use the exclamation point (<code>!<\/code>) to invert the search:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ find \/ \\! -name \"query_to_avoid\"<\/code><\/pre>\n\n\n\n<p>When employing the exclamation point, remember to escape it with a backslash (<code>\\<\/code>) to prevent the shell from interpreting it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"searching-by-file-type\">Searching by File Type<\/h2>\n\n\n\n<p>Another way to search for files is based on their type using the&nbsp;<code>-type<\/code>&nbsp;parameter. Here are some type descriptors you can utilize:<\/p>\n\n\n\n<ul>\n<li><code>f<\/code>: regular file<\/li>\n\n\n\n<li><code>d<\/code>: directory<\/li>\n\n\n\n<li><code>l<\/code>: symbolic link<\/li>\n\n\n\n<li><code>c<\/code>: character devices<\/li>\n\n\n\n<li><code>b<\/code>: block devices<\/li>\n<\/ul>\n\n\n\n<p>For instance, if you want to find all character devices on your system, execute the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ find \/dev -type c<\/code><\/pre>\n\n\n\n<p>To search for files with a specific extension (e.g.,&nbsp;<code>.conf<\/code>), employ the&nbsp;<code>-name<\/code>&nbsp;option along with the&nbsp;<code>*.extension<\/code>&nbsp;pattern:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ find \/usr -type f -name \"*.conf\"<\/code><\/pre>\n\n\n\n<p>You can combine multiple search expressions using the&nbsp;<code>-and<\/code>&nbsp;operator (implied when no option is specified) or the&nbsp;<code>-or<\/code>&nbsp;operator:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ find -name query_1 -or -name query_2<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"filtering-by-size-and-time\">Filtering by Size and Time<\/h2>\n\n\n\n<p>The&nbsp;<code>find<\/code>&nbsp;command offers various options to filter files based on their size and time.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"size\">Size<\/h3>\n\n\n\n<p>To filter files by size, utilize the&nbsp;<code>-size<\/code>&nbsp;parameter followed by a size value and a suffix indicating the unit. Common size suffixes include:<\/p>\n\n\n\n<ul>\n<li><code>c<\/code>: bytes<\/li>\n\n\n\n<li><code>k<\/code>: kilobytes<\/li>\n\n\n\n<li><code>M<\/code>: megabytes<\/li>\n\n\n\n<li><code>G<\/code>: gigabytes<\/li>\n\n\n\n<li><code>b<\/code>: 512-byte blocks<\/li>\n<\/ul>\n\n\n\n<p>For instance, to locate files that are exactly 50 bytes in size:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ find \/usr -size 50c<\/code><\/pre>\n\n\n\n<p>To find files that are smaller than 50 bytes:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ find \/usr -size -50c<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"time\">Time<\/h3>\n\n\n\n<p>To filter files based on their modification time, you can employ the&nbsp;<code>-mtime<\/code>,&nbsp;<code>-atime<\/code>, and&nbsp;<code>-ctime<\/code>&nbsp;parameters.<\/p>\n\n\n\n<ul>\n<li><code>-mtime<\/code>&nbsp;searches based on the modification time of the file.<\/li>\n\n\n\n<li><code>-atime<\/code>&nbsp;searches based on the access time of the file.<\/li>\n\n\n\n<li><code>-ctime<\/code>&nbsp;searches based on the change time of the file.<\/li>\n<\/ul>\n\n\n\n<p>You can specify the time using different formats:<\/p>\n\n\n\n<ul>\n<li><code>n<\/code>: exact number of 24-hour periods ago.<\/li>\n\n\n\n<li><code>+n<\/code>: more than n 24-hour periods ago.<\/li>\n\n\n\n<li><code>-n<\/code>: less than n 24-hour periods ago.<\/li>\n<\/ul>\n\n\n\n<p>For example, to find files modified within the last 7 days:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ find \/usr -mtime -7<\/code><\/pre>\n\n\n\n<p>To locate files accessed more than 30 days ago:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ find \/usr -atime +30<\/code><\/pre>\n\n\n\n<p>To discover files whose metadata (such as permissions) has changed within the last 24 hours:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ find \/usr -ctime 0<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"finding-by-owner-and-permissions\">Finding by Owner and Permissions<\/h2>\n\n\n\n<p>The&nbsp;<code>find<\/code>&nbsp;command also allows you to search for files based on their owner and permissions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"owner\">Owner<\/h3>\n\n\n\n<p>To find files owned by a specific user, you can use the&nbsp;<code>-user<\/code>&nbsp;parameter followed by the username. For example, to search for files owned by the user &#8220;john&#8221;:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ find \/ -user john<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"permissions\">Permissions<\/h3>\n\n\n\n<p>You can search for files based on their permissions using the&nbsp;<code>-perm<\/code>&nbsp;parameter. This parameter accepts a numeric mode or symbolic notation representing the desired permissions.<\/p>\n\n\n\n<p>To find files with specific permissions expressed in numeric mode, use a three-digit octal number. For example, to search for files with read, write, and execute permissions for the owner, and read permissions for others:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ find \/ -perm 744<\/code><\/pre>\n\n\n\n<p>To search for files with specific permissions expressed in symbolic notation, use a combination of&nbsp;<code>u<\/code>&nbsp;(user),&nbsp;<code>g<\/code>&nbsp;(group),&nbsp;<code>o<\/code>&nbsp;(others),&nbsp;<code>r<\/code>&nbsp;(read),&nbsp;<code>w<\/code>&nbsp;(write), and&nbsp;<code>x<\/code>&nbsp;(execute). For example, to search for files with read and write permissions for the owner:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ find \/ -perm u=rw<\/code><\/pre>\n\n\n\n<p>You can also combine multiple permissions and specify different ownership levels in symbolic notation. For example, to search for files with read and execute permissions for the owner, write permission for the group, and read permission for others:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ find \/ -perm u=rx,g=w,o=r<\/code><\/pre>\n\n\n\n<p>By utilizing the&nbsp;<code>-user<\/code>&nbsp;and&nbsp;<code>-perm<\/code>&nbsp;options, you can effectively search for files based on their owner and permissions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"executing-commands-on-find-results\">Executing Commands on&nbsp;<code>find<\/code>&nbsp;Results<\/h2>\n\n\n\n<p>The&nbsp;<code>find<\/code>&nbsp;command not only helps you locate files but also enables you to perform actions on the search results. You can execute various commands on the files found by&nbsp;<code>find<\/code>&nbsp;using the&nbsp;<code>-exec<\/code>&nbsp;option.<\/p>\n\n\n\n<p>The basic syntax for executing commands on&nbsp;<code>find<\/code>&nbsp;results is as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ find \/path\/to\/search -name \"query\" -exec command {} \\;<\/code><\/pre>\n\n\n\n<p>In this syntax:<\/p>\n\n\n\n<ul>\n<li><code>\/path\/to\/search<\/code>&nbsp;is the directory where you want to search for files.<\/li>\n\n\n\n<li><code>\"query\"<\/code>&nbsp;is the search query or pattern to match filenames.<\/li>\n\n\n\n<li><code>command<\/code>&nbsp;is the command you want to execute on each found file.<\/li>\n\n\n\n<li><code>{}<\/code>&nbsp;represents the placeholder for the found file.<\/li>\n\n\n\n<li><code>\\;<\/code>&nbsp;is used to terminate the&nbsp;<code>-exec<\/code>&nbsp;option.<\/li>\n<\/ul>\n\n\n\n<p>For example, to delete all files with the&nbsp;<code>.log<\/code>&nbsp;extension in the&nbsp;<code>\/var\/log<\/code>&nbsp;directory, you can use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ find \/var\/log -name \"*.log\" -exec rm {} \\;<\/code><\/pre>\n\n\n\n<p>This command will execute the&nbsp;<code>rm<\/code>&nbsp;command on each file found by&nbsp;<code>find<\/code>, deleting all files with the&nbsp;<code>.log<\/code>&nbsp;extension.<\/p>\n\n\n\n<p>You can also combine multiple commands or pass additional arguments to the command. Just ensure to properly escape any special characters.<\/p>\n\n\n\n<p>Using the&nbsp;<code>-exec<\/code>&nbsp;option with the&nbsp;<code>find<\/code>&nbsp;command provides flexibility in performing actions on the search results, making it a powerful tool for file management and automation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"using-locate-command\">Using&nbsp;<code>locate<\/code>&nbsp;Command<\/h2>\n\n\n\n<p>The&nbsp;<code>locate<\/code>&nbsp;command provides a faster way to search for files on your system by utilizing a prebuilt database called the locate database. The database is updated regularly, so it may not include recently created or modified files.<\/p>\n\n\n\n<p><strong>Database Initialization:<\/strong><\/p>\n\n\n\n<p>Before using the&nbsp;<code>locate<\/code>&nbsp;command, it&#8217;s crucial to ensure that the database is up to date. Execute the following command as root or with&nbsp;<code>sudo<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo updatedb<\/code><\/pre>\n\n\n\n<p>This command updates the database used by&nbsp;<code>locate<\/code>&nbsp;to index the file system.<\/p>\n\n\n\n<p><strong>Searching for Files:<\/strong><\/p>\n\n\n\n<p>To search for files using&nbsp;<code>locate<\/code>, simply specify the keyword or pattern you want to search for. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ locate file.txt<\/code><\/pre>\n\n\n\n<p>This command will find all files with &#8220;file.txt&#8221; in their name.<\/p>\n\n\n\n<p><strong>Case Sensitivity:<\/strong><\/p>\n\n\n\n<p>By default, the&nbsp;<code>locate<\/code>&nbsp;command is case-insensitive. If you want to perform a case-sensitive search, use the&nbsp;<code>-i<\/code>&nbsp;option. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ locate -i File.txt<\/code><\/pre>\n\n\n\n<p>This command will find files with &#8220;File.txt&#8221; or &#8220;file.txt&#8221; in their name.<\/p>\n\n\n\n<p><strong>Updating the Database:<\/strong><\/p>\n\n\n\n<p>The file database used by&nbsp;<code>locate<\/code>&nbsp;may not always be up to date. To ensure you have the latest file information, periodically update the database using the&nbsp;<code>updatedb<\/code>&nbsp;command.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>Searching for files on Linux can be accomplished using the&nbsp;<code>find<\/code>&nbsp;and&nbsp;<code>locate<\/code>&nbsp;commands. The&nbsp;<code>find<\/code>&nbsp;command provides more flexibility and allows for fine-grained searches based on various criteria, such as file name, type, size, and time. On the other hand, the&nbsp;<code>locate<\/code>&nbsp;command provides a faster search using a prebuilt database.<\/p>\n\n\n\n<p>By mastering these commands, you can efficiently locate files on your Linux system and streamline your workflow. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>When working with Linux, one common challenge is finding specific files. In this guide, we will explore how to use the\u00a0find\u00a0command to search for files based on various filters and parameters. We will also briefly cover the\u00a0locate\u00a0command, which provides an alternative way to search for files. Prerequisites In order to proceed with this tutorial, you ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[69],"tags":[],"yoast_head":"\n<title>How to Search for Files on Linux using find\u00a0and\u00a0locate\u00a0Commands - WebHi Tutorials &amp; Documentations<\/title>\n<meta name=\"description\" content=\"Discover how to efficiently search for files on a Linux system using the find and locate commands. Learn about the powerful features of the find command, including filtering by file name, type, size, and modification time. Explore the benefits of the locate command, which leverages a prebuilt database for faster file searches. Enhance your Linux file searching skills and optimize your workflow today.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Search for Files on Linux using find\u00a0and\u00a0locate\u00a0Commands - WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"og:description\" content=\"Discover how to efficiently search for files on a Linux system using the find and locate commands. Learn about the powerful features of the find command, including filtering by file name, type, size, and modification time. Explore the benefits of the locate command, which leverages a prebuilt database for faster file searches. Enhance your Linux file searching skills and optimize your workflow today.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/\" \/>\n<meta property=\"og:site_name\" content=\"WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webhi.technology\" \/>\n<meta property=\"article:published_time\" content=\"2023-06-06T21:58:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-06T21:58:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/06\/find_locate_en.jpg\" \/>\n<meta name=\"author\" content=\"webhi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:site\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"webhi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/\"},\"author\":{\"name\":\"webhi\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\"},\"headline\":\"How to Search for Files on Linux using find\u00a0and\u00a0locate\u00a0Commands\",\"datePublished\":\"2023-06-06T21:58:51+00:00\",\"dateModified\":\"2023-06-06T21:58:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/\"},\"wordCount\":1188,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"articleSection\":[\"Linux system administration\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/\",\"name\":\"How to Search for Files on Linux using find\u00a0and\u00a0locate\u00a0Commands - WebHi Tutorials &amp; Documentations\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\"},\"datePublished\":\"2023-06-06T21:58:51+00:00\",\"dateModified\":\"2023-06-06T21:58:52+00:00\",\"description\":\"Discover how to efficiently search for files on a Linux system using the find and locate commands. Learn about the powerful features of the find command, including filtering by file name, type, size, and modification time. Explore the benefits of the locate command, which leverages a prebuilt database for faster file searches. Enhance your Linux file searching skills and optimize your workflow today.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webhi.com\/how-to\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Search for Files on Linux using find\u00a0and\u00a0locate\u00a0Commands\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"name\":\"WebHi Tutorials &amp; Documentations\",\"description\":\"System administration and knowledge base\",\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\",\"name\":\"WebHi Technology\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"width\":288,\"height\":95,\"caption\":\"WebHi Technology\"},\"image\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webhi.technology\",\"https:\/\/twitter.com\/WebHiTechnology\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\",\"name\":\"webhi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1783029557\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1783029557\",\"caption\":\"webhi\"},\"sameAs\":[\"https:\/\/www.webhi.com\/how-to\"],\"url\":\"https:\/\/www.webhi.com\/how-to\/author\/webhi\/\"}]}<\/script>\n","yoast_head_json":{"title":"How to Search for Files on Linux using find\u00a0and\u00a0locate\u00a0Commands - WebHi Tutorials &amp; Documentations","description":"Discover how to efficiently search for files on a Linux system using the find and locate commands. Learn about the powerful features of the find command, including filtering by file name, type, size, and modification time. Explore the benefits of the locate command, which leverages a prebuilt database for faster file searches. Enhance your Linux file searching skills and optimize your workflow today.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/","og_locale":"en_US","og_type":"article","og_title":"How to Search for Files on Linux using find\u00a0and\u00a0locate\u00a0Commands - WebHi Tutorials &amp; Documentations","og_description":"Discover how to efficiently search for files on a Linux system using the find and locate commands. Learn about the powerful features of the find command, including filtering by file name, type, size, and modification time. Explore the benefits of the locate command, which leverages a prebuilt database for faster file searches. Enhance your Linux file searching skills and optimize your workflow today.","og_url":"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/","og_site_name":"WebHi Tutorials &amp; Documentations","article_publisher":"https:\/\/www.facebook.com\/webhi.technology","article_published_time":"2023-06-06T21:58:51+00:00","article_modified_time":"2023-06-06T21:58:52+00:00","og_image":[{"url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2023\/06\/find_locate_en.jpg"}],"author":"webhi","twitter_card":"summary_large_image","twitter_creator":"@WebHiTechnology","twitter_site":"@WebHiTechnology","twitter_misc":{"Written by":"webhi","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/#article","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/"},"author":{"name":"webhi","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54"},"headline":"How to Search for Files on Linux using find\u00a0and\u00a0locate\u00a0Commands","datePublished":"2023-06-06T21:58:51+00:00","dateModified":"2023-06-06T21:58:52+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/"},"wordCount":1188,"commentCount":0,"publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"articleSection":["Linux system administration"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/","url":"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/","name":"How to Search for Files on Linux using find\u00a0and\u00a0locate\u00a0Commands - WebHi Tutorials &amp; Documentations","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/#website"},"datePublished":"2023-06-06T21:58:51+00:00","dateModified":"2023-06-06T21:58:52+00:00","description":"Discover how to efficiently search for files on a Linux system using the find and locate commands. Learn about the powerful features of the find command, including filtering by file name, type, size, and modification time. Explore the benefits of the locate command, which leverages a prebuilt database for faster file searches. Enhance your Linux file searching skills and optimize your workflow today.","breadcrumb":{"@id":"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.webhi.com\/how-to\/search-for-files-on-linux-using-find-and-locate-commands\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webhi.com\/how-to\/"},{"@type":"ListItem","position":2,"name":"How to Search for Files on Linux using find\u00a0and\u00a0locate\u00a0Commands"}]},{"@type":"WebSite","@id":"https:\/\/www.webhi.com\/how-to\/#website","url":"https:\/\/www.webhi.com\/how-to\/","name":"WebHi Tutorials &amp; Documentations","description":"System administration and knowledge base","publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webhi.com\/how-to\/#organization","name":"WebHi Technology","url":"https:\/\/www.webhi.com\/how-to\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/","url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","contentUrl":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","width":288,"height":95,"caption":"WebHi Technology"},"image":{"@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webhi.technology","https:\/\/twitter.com\/WebHiTechnology"]},{"@type":"Person","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54","name":"webhi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/","url":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1783029557","contentUrl":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1783029557","caption":"webhi"},"sameAs":["https:\/\/www.webhi.com\/how-to"],"url":"https:\/\/www.webhi.com\/how-to\/author\/webhi\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/5555"}],"collection":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/comments?post=5555"}],"version-history":[{"count":6,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/5555\/revisions"}],"predecessor-version":[{"id":5695,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/5555\/revisions\/5695"}],"wp:attachment":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/media?parent=5555"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/categories?post=5555"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/tags?post=5555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}