{"id":20164,"date":"2016-11-23T07:48:20","date_gmt":"2016-11-23T13:48:20","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=20164"},"modified":"2022-06-03T03:42:31","modified_gmt":"2022-06-03T08:42:31","slug":"linux-find-file","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/","title":{"rendered":"Linux Find File"},"content":{"rendered":"
<\/div>

\"Linux<\/p>\n

Linux find file command explained. Finding files using the command line on a Linux machine could be very uncomfortable experience, especially for the beginners. Without a GUI it is very difficult to navigate through the directories and find the files you need. In this tutorial, we will show you how to find a specific file in Linux, using the command line.<\/p>\n

<\/p>\n

The first thing your need to do is to connect to your Linux VPS via SSH<\/a>. There are two common ways to search for a file under Linux. The one way is to use the find<\/code> command and the other way is to use the locate<\/code> command. Let’s start with the former.<\/p>\n

1. Linux Find File Command<\/h2>\n

The Linux find file command<\/strong> allows you to search the directory tree using various search criteria such as name, type, ownership, size etc. This is the basic syntax:<\/p>\n

# find path expression search-term<\/pre>\n

Here is a brief example on how to use the Linux find command to find a specific file by its name:<\/p>\n

# find -name test.file<\/pre>\n

The command will search the entire directory tree for a file named test.file<\/code> and will provide you with the location. You can try using a name of a file that actually exists on your Linux VPS.<\/p>\n

Sometimes it may take few minutes for the find command to search the entire directory tree, especially if there are many files and directories on your system. To save a significant amount of time you can specify the searching directory. For example, if you know that the test.file<\/code> is somewhere in the \/var<\/code> directory, there is no need to search other directories. Therefore, you can use the command below:<\/p>\n

# find \/var -name test.file<\/pre>\n

There is also an option to search for a file by time, size, ownership, permissions etc. For more information about these options, you can check the Linux find file command<\/strong> man page.<\/p>\n

# man find<\/pre>\n

2. Locate File command<\/h2>\n

In order to be able to use the Linux locate<\/code> command, you need to install it first.<\/p>\n

If you are using an Ubuntu VPS<\/a>, run the following commands to install locate:<\/p>\n

# apt-get update\n# apt-get install mlocate<\/pre>\n

If you are using a CentOS VPS<\/a>, run the following command to install locate:<\/p>\n

# yum install mlocate<\/pre>\n

Locate is a faster option to find a file since it searches for the files in a database. To update the search databases run the following command:<\/p>\n

# updatedb<\/pre>\n

To find files in Linux with locate, use the following syntax:<\/p>\n

# locate test.file<\/pre>\n

Just like with the find command, there are many options to filter the search output. To learn more about this you can check the Linux locate command<\/strong> man page.<\/p>\n

# man locate<\/pre>\n
\n

Of course, you don\u2019t have to use the Linux find file, if you use one of our Linux hosting services<\/a>, in which case you can simply ask our expert Linux admins to look and find the files on Linux for you. They are available 24\u00d77 and will take care of your request immediately. For more updates, you might want to consider reading Find Large Files in Linux<\/a>.<\/p>\n

PS. If you liked this post on how to use the Linux find file command, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"

Linux find file command explained. Finding files using the command line on a Linux machine could be very uncomfortable experience, … <\/p>\n

Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":24118,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[1336,1623],"yoast_head":"\nLinux Find File<\/title>\n<meta name=\"description\" content=\"How to Use the Find File command from the Linux command line to locate files in a file system. In this guide we gonna show you the usage of Linux Find File.\" \/>\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.rosehosting.com\/blog\/linux-find-file\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux Find File\" \/>\n<meta property=\"og:description\" content=\"How to Use the Find File command from the Linux command line to locate files in a file system. In this guide we gonna show you the usage of Linux Find File.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2016-11-23T13:48:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-03T08:42:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/11\/linux-find-file.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"Linux Find File\",\"datePublished\":\"2016-11-23T13:48:20+00:00\",\"dateModified\":\"2022-06-03T08:42:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/\"},\"wordCount\":520,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/11\/linux-find-file.jpg\",\"keywords\":[\"files\",\"find file linux\"],\"articleSection\":[\"Tips and Tricks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/\",\"name\":\"Linux Find File\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/11\/linux-find-file.jpg\",\"datePublished\":\"2016-11-23T13:48:20+00:00\",\"dateModified\":\"2022-06-03T08:42:31+00:00\",\"description\":\"How to Use the Find File command from the Linux command line to locate files in a file system. In this guide we gonna show you the usage of Linux Find File.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/#primaryimage\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/11\/linux-find-file.jpg\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/11\/linux-find-file.jpg\",\"width\":1200,\"height\":600,\"caption\":\"Linux find file\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.rosehosting.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux Find File\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"name\":\"RoseHosting\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/RoseHosting\",\"https:\/\/x.com\/rosehosting\",\"https:\/\/www.linkedin.com\/in\/rosehosting\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\/\/www.rosehosting.com\",\"https:\/\/www.facebook.com\/rosehosting.helpdesk\"],\"url\":\"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux Find File","description":"How to Use the Find File command from the Linux command line to locate files in a file system. In this guide we gonna show you the usage of Linux Find File.","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.rosehosting.com\/blog\/linux-find-file\/","og_locale":"en_US","og_type":"article","og_title":"Linux Find File","og_description":"How to Use the Find File command from the Linux command line to locate files in a file system. In this guide we gonna show you the usage of Linux Find File.","og_url":"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2016-11-23T13:48:20+00:00","article_modified_time":"2022-06-03T08:42:31+00:00","og_image":[{"width":1200,"height":600,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/11\/linux-find-file.jpg","type":"image\/jpeg"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"Linux Find File","datePublished":"2016-11-23T13:48:20+00:00","dateModified":"2022-06-03T08:42:31+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/"},"wordCount":520,"commentCount":0,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/11\/linux-find-file.jpg","keywords":["files","find file linux"],"articleSection":["Tips and Tricks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/linux-find-file\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/","url":"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/","name":"Linux Find File","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/11\/linux-find-file.jpg","datePublished":"2016-11-23T13:48:20+00:00","dateModified":"2022-06-03T08:42:31+00:00","description":"How to Use the Find File command from the Linux command line to locate files in a file system. In this guide we gonna show you the usage of Linux Find File.","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/linux-find-file\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/11\/linux-find-file.jpg","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/11\/linux-find-file.jpg","width":1200,"height":600,"caption":"Linux find file"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/linux-find-file\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Linux Find File"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"]},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/20164"}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=20164"}],"version-history":[{"count":1,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/20164\/revisions"}],"predecessor-version":[{"id":36617,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/20164\/revisions\/36617"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/24118"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=20164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=20164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=20164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}