{"id":483,"date":"2021-03-01T22:32:05","date_gmt":"2021-03-01T13:32:05","guid":{"rendered":"https:\/\/www.tiptip.today\/?p=483"},"modified":"2021-03-03T09:07:10","modified_gmt":"2021-03-03T00:07:10","slug":"search-option-for-files-on-linux","status":"publish","type":"post","link":"https:\/\/tippang.net\/?p=483","title":{"rendered":"How to search files on Linux, using command options"},"content":{"rendered":"<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone wp-image-484\" src=\"https:\/\/www.tiptip.today\/wp-content\/uploads\/2021\/03\/search-2876776_1920.jpg\" alt=\"\" width=\"262\" height=\"262\" srcset=\"https:\/\/tippang.net\/wp-content\/uploads\/2021\/03\/search-2876776_1920.jpg 1920w, https:\/\/tippang.net\/wp-content\/uploads\/2021\/03\/search-2876776_1920-300x300.jpg 300w, https:\/\/tippang.net\/wp-content\/uploads\/2021\/03\/search-2876776_1920-1024x1024.jpg 1024w, https:\/\/tippang.net\/wp-content\/uploads\/2021\/03\/search-2876776_1920-150x150.jpg 150w, https:\/\/tippang.net\/wp-content\/uploads\/2021\/03\/search-2876776_1920-768x768.jpg 768w, https:\/\/tippang.net\/wp-content\/uploads\/2021\/03\/search-2876776_1920-1536x1536.jpg 1536w, https:\/\/tippang.net\/wp-content\/uploads\/2021\/03\/search-2876776_1920-800x800.jpg 800w\" sizes=\"(max-width: 262px) 100vw, 262px\" \/><\/p>\n<p><em><strong>Command &#8216;find&#8217; is used to search for files and directories, Unix\/Linux<\/strong><\/em><\/p>\n<p>find [OPTION&#8230;] [PATH] [EXPRESSION&#8230;]\n<!--more--><br \/>\nOPTION<br \/>\n-P: Do not follow the symbolic link, use the symbolic link&#8217;s own information<br \/>\n-L: Use file information linked to symbolic link.<br \/>\n-H: Does not follow symbolic links, except when handling Command Line Argument.<br \/>\n-D: Output debugs messages.<br \/>\nEXPRESSION<br \/>\n-name: Search for files that match the specified string pattern.<br \/>\n-empty: Search for empty directories or zero-sized files.<br \/>\n-delete: Delete the searched file or directory.<br \/>\n-exec: Execute the specified command on the retrieved file.<br \/>\n-path: Search in the path corresponding to the specified string pattern.<br \/>\n-print: Print the search results. Search items are separated by a newline. (Default)<br \/>\n-print0: Print search results. Search items are separated by null.<br \/>\n-size: Search for files using file size.<br \/>\n-type: Search for files corresponding to the specified file type.<br \/>\n-mindepth: Specifies the minimum depth of subdirectories to start searching.<br \/>\n-maxdepth: Specifies the maximum depth of subdirectories to be searched.<br \/>\n-atime: Search files based on file access time.<br \/>\n-ctime: Search files based on the time of file content and property change.<br \/>\n-mtime: Search for files based on the data modification time of the file.<\/p>\n<p><strong><em>Combining &#8220;two or more expressions&#8221; via operator<\/em><\/strong><\/p>\n<p>Expression description<br \/>\n(expression) Specifies the priority of expression.<br \/>\n!expression<br \/>\n-not expression NOT operation on the result of expression.<br \/>\nexpression -a expression<br \/>\nexpression -and expression<br \/>\nexpression expression AND operation between expressions.<br \/>\nexpression -o expression<br \/>\nexpression -or expression OR operation between expressions.<\/p>\n<p>When two or more expressions are used and the operator is not specified, -a (AND) is applied by default (&#8220;-empty -print&#8221; = &#8220;-empty -a -print&#8221;)<\/p>\n<p><strong><em>An example of using the find command<\/em>.<\/strong><\/p>\n<p>A simple search for a given name in the current directory. Specify filename after find command<\/p>\n<p>$ ls<br \/>\nFILE_1 FILE_2 FILE_3<br \/>\n$ find FILE_1<br \/>\nFILE_1<\/p>\n<p>$ find. -name &#8220;FILE&#8221;<\/p>\n<p><em><strong>find usage example command options<\/strong><\/em><br \/>\nList of files and directories in the current directory find<br \/>\nList of files and directories in the target directory find [PATH]\nSearch for files in all files and subdirectories under the current directory find. -name [FILE]\nSearch for a file on the entire system (root directory) find \/ -name [FILE]\nSearch for files whose filenames start with a specific string find. -name &#8220;STR*&#8221;<br \/>\nSearch for files that contain a specific string in the file name find. -name &#8220;*STR*&#8221;<br \/>\nSearch for files whose filename ends with a specific string find. -name &#8220;*STR&#8221;<br \/>\nSearch for empty directories or zero-sized files find. -empty<br \/>\nDelete after searching all files with a specific extension find. -name &#8220;*.EXT&#8221; -delete<br \/>\nPrint a list of searched files consecutively without line breaks find. -name [FILE] -print0<br \/>\nSearch only for files or directories find. -name [FILE] -type f<br \/>\nSearch for files using file size find. -size +[N]c -and -size -[M]c<br \/>\nPrint detailed information about the searched file. (find + ls) find. -name [FILE] -exec ls -l {}<br \/>\nOutput number of lines in the retrieved file. (find + wc) find. -name [FILE] -exec wc -l {}<br \/>\nFinding a string in the searched file. (find + grep) find. -name [FILE] -exec grep &#8220;STR&#8221; {}<br \/>\nSave search results to a file. (find, redirection) find. -name [FILE] &amp;gt; [SAVE_FILE]\nDo not display error messages during search (find, redirection) find. -name [FILE] 2&gt; \/dev\/null<br \/>\nDon&#8217;t search subdirectories find. -maxdepth 1 -name [FILE]\nCopy retrieved files. (find + cp) find. -name [FILE] -exec cp {} [PATH]\n","protected":false},"excerpt":{"rendered":"<p>Command &#8216;find&#8217; is used to search for files and directories, Unix\/Linux find [OPTION&#8230;] [PATH] [EXPRESSION&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"footnotes":""},"categories":[7,14],"tags":[37],"class_list":["post-483","post","type-post","status-publish","format-standard","hentry","category-itexpert","category-linux","tag-linux-find"],"aioseo_notices":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to search files on Linux, using command options - tippang.net<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/tippang.net\/?p=483\" class=\"yoast-seo-meta-tag\" \/>\n<meta property=\"og:locale\" content=\"en_US\" class=\"yoast-seo-meta-tag\" \/>\n<meta property=\"og:type\" content=\"article\" class=\"yoast-seo-meta-tag\" \/>\n<meta property=\"og:title\" content=\"How to search files on Linux, using command options - tippang.net\" class=\"yoast-seo-meta-tag\" \/>\n<meta property=\"og:description\" content=\"Command &#8216;find&#8217; is used to search for files and directories, Unix\/Linux find [OPTION&#8230;] [PATH] [EXPRESSION&#8230;]\" class=\"yoast-seo-meta-tag\" \/>\n<meta property=\"og:url\" content=\"https:\/\/tippang.net\/?p=483\" class=\"yoast-seo-meta-tag\" \/>\n<meta property=\"og:site_name\" content=\"tippang.net\" class=\"yoast-seo-meta-tag\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-01T13:32:05+00:00\" class=\"yoast-seo-meta-tag\" \/>\n<meta property=\"article:modified_time\" content=\"2021-03-03T00:07:10+00:00\" class=\"yoast-seo-meta-tag\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.tiptip.today\/wp-content\/uploads\/2021\/03\/search-2876776_1920.jpg\" class=\"yoast-seo-meta-tag\" \/>\n<meta name=\"author\" content=\"Charles\" class=\"yoast-seo-meta-tag\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" class=\"yoast-seo-meta-tag\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" class=\"yoast-seo-meta-tag\" \/>\n\t<meta name=\"twitter:data1\" content=\"Charles\" class=\"yoast-seo-meta-tag\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" class=\"yoast-seo-meta-tag\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" class=\"yoast-seo-meta-tag\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/tippang.net\/?p=483#article\",\"isPartOf\":{\"@id\":\"https:\/\/tippang.net\/?p=483\"},\"author\":{\"name\":\"Charles\",\"@id\":\"https:\/\/tippang.net\/#\/schema\/person\/d1b0d568e5385a89b638f3eedf2dca86\"},\"headline\":\"How to search files on Linux, using command options\",\"datePublished\":\"2021-03-01T13:32:05+00:00\",\"dateModified\":\"2021-03-03T00:07:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/tippang.net\/?p=483\"},\"wordCount\":558,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/tippang.net\/#organization\"},\"image\":{\"@id\":\"https:\/\/tippang.net\/?p=483#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.tiptip.today\/wp-content\/uploads\/2021\/03\/search-2876776_1920.jpg\",\"keywords\":[\"linux find\"],\"articleSection\":[\"ITEXPERT\",\"Linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/tippang.net\/?p=483#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/tippang.net\/?p=483\",\"url\":\"https:\/\/tippang.net\/?p=483\",\"name\":\"How to search files on Linux, using command options - tippang.net\",\"isPartOf\":{\"@id\":\"https:\/\/tippang.net\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/tippang.net\/?p=483#primaryimage\"},\"image\":{\"@id\":\"https:\/\/tippang.net\/?p=483#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.tiptip.today\/wp-content\/uploads\/2021\/03\/search-2876776_1920.jpg\",\"datePublished\":\"2021-03-01T13:32:05+00:00\",\"dateModified\":\"2021-03-03T00:07:10+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/tippang.net\/?p=483#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/tippang.net\/?p=483\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tippang.net\/?p=483#primaryimage\",\"url\":\"https:\/\/www.tiptip.today\/wp-content\/uploads\/2021\/03\/search-2876776_1920.jpg\",\"contentUrl\":\"https:\/\/www.tiptip.today\/wp-content\/uploads\/2021\/03\/search-2876776_1920.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/tippang.net\/?p=483#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/tippang.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to search files on Linux, using command options\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/tippang.net\/#website\",\"url\":\"https:\/\/tippang.net\/\",\"name\":\"tippang.net\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/tippang.net\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/tippang.net\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/tippang.net\/#organization\",\"name\":\"tippang.net\",\"url\":\"https:\/\/tippang.net\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tippang.net\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/tippang.net\/wp-content\/uploads\/2021\/02\/cropped-\u110e\u1162\u1102\u1165\u11af\u110b\u1161\u110b\u1175\u110f\u1169\u11ab1_\u1100\u1165\u1107\u116e\u11a8\u110b\u1175.png\",\"contentUrl\":\"https:\/\/tippang.net\/wp-content\/uploads\/2021\/02\/cropped-\u110e\u1162\u1102\u1165\u11af\u110b\u1161\u110b\u1175\u110f\u1169\u11ab1_\u1100\u1165\u1107\u116e\u11a8\u110b\u1175.png\",\"width\":280,\"height\":280,\"caption\":\"tippang.net\"},\"image\":{\"@id\":\"https:\/\/tippang.net\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/tippang.net\/#\/schema\/person\/d1b0d568e5385a89b638f3eedf2dca86\",\"name\":\"Charles\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tippang.net\/#\/schema\/person\/image\/\",\"url\":\"\/\/www.gravatar.com\/avatar\/3a452b00f5e85211cbb28d2708d7f18f?s=96&#038;r=g&#038;d=wavatar\",\"contentUrl\":\"\/\/www.gravatar.com\/avatar\/3a452b00f5e85211cbb28d2708d7f18f?s=96&#038;r=g&#038;d=wavatar\",\"caption\":\"Charles\"},\"description\":\"An IT Guy On earth\",\"sameAs\":[\"https:\/\/www.tiptip.today\"],\"url\":\"https:\/\/tippang.net\/author\/cm201705\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to search files on Linux, using command options - tippang.net","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:\/\/tippang.net\/?p=483","og_locale":"en_US","og_type":"article","og_title":"How to search files on Linux, using command options - tippang.net","og_description":"Command &#8216;find&#8217; is used to search for files and directories, Unix\/Linux find [OPTION&#8230;] [PATH] [EXPRESSION&#8230;]","og_url":"https:\/\/tippang.net\/?p=483","og_site_name":"tippang.net","article_published_time":"2021-03-01T13:32:05+00:00","article_modified_time":"2021-03-03T00:07:10+00:00","og_image":[{"url":"https:\/\/www.tiptip.today\/wp-content\/uploads\/2021\/03\/search-2876776_1920.jpg","type":"","width":"","height":""}],"author":"Charles","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Charles","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/tippang.net\/?p=483#article","isPartOf":{"@id":"https:\/\/tippang.net\/?p=483"},"author":{"name":"Charles","@id":"https:\/\/tippang.net\/#\/schema\/person\/d1b0d568e5385a89b638f3eedf2dca86"},"headline":"How to search files on Linux, using command options","datePublished":"2021-03-01T13:32:05+00:00","dateModified":"2021-03-03T00:07:10+00:00","mainEntityOfPage":{"@id":"https:\/\/tippang.net\/?p=483"},"wordCount":558,"commentCount":0,"publisher":{"@id":"https:\/\/tippang.net\/#organization"},"image":{"@id":"https:\/\/tippang.net\/?p=483#primaryimage"},"thumbnailUrl":"https:\/\/www.tiptip.today\/wp-content\/uploads\/2021\/03\/search-2876776_1920.jpg","keywords":["linux find"],"articleSection":["ITEXPERT","Linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/tippang.net\/?p=483#respond"]}]},{"@type":"WebPage","@id":"https:\/\/tippang.net\/?p=483","url":"https:\/\/tippang.net\/?p=483","name":"How to search files on Linux, using command options - tippang.net","isPartOf":{"@id":"https:\/\/tippang.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/tippang.net\/?p=483#primaryimage"},"image":{"@id":"https:\/\/tippang.net\/?p=483#primaryimage"},"thumbnailUrl":"https:\/\/www.tiptip.today\/wp-content\/uploads\/2021\/03\/search-2876776_1920.jpg","datePublished":"2021-03-01T13:32:05+00:00","dateModified":"2021-03-03T00:07:10+00:00","breadcrumb":{"@id":"https:\/\/tippang.net\/?p=483#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/tippang.net\/?p=483"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tippang.net\/?p=483#primaryimage","url":"https:\/\/www.tiptip.today\/wp-content\/uploads\/2021\/03\/search-2876776_1920.jpg","contentUrl":"https:\/\/www.tiptip.today\/wp-content\/uploads\/2021\/03\/search-2876776_1920.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/tippang.net\/?p=483#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/tippang.net\/"},{"@type":"ListItem","position":2,"name":"How to search files on Linux, using command options"}]},{"@type":"WebSite","@id":"https:\/\/tippang.net\/#website","url":"https:\/\/tippang.net\/","name":"tippang.net","description":"","publisher":{"@id":"https:\/\/tippang.net\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/tippang.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/tippang.net\/#organization","name":"tippang.net","url":"https:\/\/tippang.net\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tippang.net\/#\/schema\/logo\/image\/","url":"https:\/\/tippang.net\/wp-content\/uploads\/2021\/02\/cropped-\u110e\u1162\u1102\u1165\u11af\u110b\u1161\u110b\u1175\u110f\u1169\u11ab1_\u1100\u1165\u1107\u116e\u11a8\u110b\u1175.png","contentUrl":"https:\/\/tippang.net\/wp-content\/uploads\/2021\/02\/cropped-\u110e\u1162\u1102\u1165\u11af\u110b\u1161\u110b\u1175\u110f\u1169\u11ab1_\u1100\u1165\u1107\u116e\u11a8\u110b\u1175.png","width":280,"height":280,"caption":"tippang.net"},"image":{"@id":"https:\/\/tippang.net\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/tippang.net\/#\/schema\/person\/d1b0d568e5385a89b638f3eedf2dca86","name":"Charles","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tippang.net\/#\/schema\/person\/image\/","url":"\/\/www.gravatar.com\/avatar\/3a452b00f5e85211cbb28d2708d7f18f?s=96&#038;r=g&#038;d=wavatar","contentUrl":"\/\/www.gravatar.com\/avatar\/3a452b00f5e85211cbb28d2708d7f18f?s=96&#038;r=g&#038;d=wavatar","caption":"Charles"},"description":"An IT Guy On earth","sameAs":["https:\/\/www.tiptip.today"],"url":"https:\/\/tippang.net\/author\/cm201705"}]}},"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/tippang.net\/index.php?rest_route=\/wp\/v2\/posts\/483","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tippang.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tippang.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tippang.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tippang.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=483"}],"version-history":[{"count":7,"href":"https:\/\/tippang.net\/index.php?rest_route=\/wp\/v2\/posts\/483\/revisions"}],"predecessor-version":[{"id":502,"href":"https:\/\/tippang.net\/index.php?rest_route=\/wp\/v2\/posts\/483\/revisions\/502"}],"wp:attachment":[{"href":"https:\/\/tippang.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=483"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tippang.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=483"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tippang.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=483"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}