[{"data":1,"prerenderedAt":135},["ShallowReactive",2],{"blog-post-ripgrep-search-one-directory":3,"recent-posts":73},{"id":4,"uid":5,"url":6,"type":7,"href":8,"tags":9,"first_publication_date":10,"last_publication_date":10,"slugs":11,"linked_documents":13,"lang":14,"alternate_languages":15,"data":16},"awbJXhIAACwAJT51","ripgrep-search-one-directory",null,"blog_posts","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=axHxNRMAACoA2InR&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awbJXhIAACwAJT51%22%29+%5D%5D",[],"2026-12-03T22:46:13+0000",[12],"ripgrep-how-to-search-only-one-directory",[],"en-us",[],{"title":17,"date":23,"description":24,"image":29,"content":39},[18],{"type":19,"text":20,"spans":21,"direction":22},"heading1","Ripgrep: How to Search Only One Directory",[],"ltr","2026-12-03",[25],{"type":26,"text":27,"spans":28,"direction":22},"heading2","Learn how to search only one directory with ripgrep (rg)",[],{"dimensions":30,"alt":20,"copyright":6,"url":33,"id":34,"edit":35},{"width":31,"height":32},1280,720,"https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002FZFeT_8LfOrbwszZS_ripgrep-search-one-directory.png?auto=format,compress","ZFeT_8LfOrbwszZS",{"x":36,"y":36,"zoom":37,"background":38},0,1,"transparent",[40,44,48,51,54,57,60,63,66,70],{"type":41,"text":42,"spans":43,"direction":22},"paragraph","Before we start, make sure you have ripgrep installed on your computer. On a Mac, you can install it with Homebrew:",[],{"type":45,"text":46,"spans":47,"direction":22},"preformatted","brew install ripgrep",[],{"type":41,"text":49,"spans":50,"direction":22},"First, open your terminal and navigate to your project folder. To search only one directory, put its path right after your search pattern:",[],{"type":45,"text":52,"spans":53,"direction":22},"rg \"pattern\" path\u002Fto\u002Fdirectory\u002F",[],{"type":41,"text":55,"spans":56,"direction":22},"Just replace \u003Ccode>pattern\u003C\u002Fcode> with what you're looking for and \u003Ccode>path\u002Fto\u002Fdirectory\u002F\u003C\u002Fcode> with your folder, for example \u003Ccode>rg \"TODO\" src\u002F\u003C\u002Fcode>. ripgrep treats anything after the pattern as a path to search, and it still goes into the subfolders inside it.",[],{"type":41,"text":58,"spans":59,"direction":22},"If you only want the files sitting directly in that folder, add \u003Ccode>--max-depth 1\u003C\u002Fcode> (or the short form \u003Ccode>-d 1\u003C\u002Fcode>):",[],{"type":45,"text":61,"spans":62,"direction":22},"rg \"pattern\" path\u002Fto\u002Fdirectory\u002F --max-depth 1",[],{"type":41,"text":64,"spans":65,"direction":22},"The results come back almost instantly, and every file path now starts with the folder you picked, so it's easy to check that nothing else was searched.",[],{"type":67,"oembed":68},"embed",{"embed_url":69,"type":67},"",{"type":41,"text":71,"spans":72,"direction":22},"If you want to search every folder with a certain name, wherever it lives in the project, use a glob instead: \u003Ccode>rg \"assert\" -g '**\u002Ftests\u002F**'\u003C\u002Fcode>.",[],{"results":74,"page":37,"results_per_page":133,"results_size":133,"total_results_size":134,"total_pages":37},[75,94,113],{"id":76,"uid":77,"url":6,"type":7,"href":78,"tags":79,"first_publication_date":10,"last_publication_date":10,"slugs":80,"linked_documents":82,"lang":14,"alternate_languages":83,"data":84},"awbJaBIAACsAJT6H","ripgrep-search-hidden-files","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=axHxNRMAACoA2InR&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awbJaBIAACsAJT6H%22%29+%5D%5D",[],[81],"ripgrep-how-to-search-hidden-files",[],[],{"image":85,"title":91},{"dimensions":86,"alt":87,"copyright":6,"url":88,"id":89,"edit":90},{"width":31,"height":32},"Ripgrep: How to Search Hidden Files","https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002FURhJw7MpuRYF7gWJ_ripgrep-search-hidden-files.png?auto=format,compress","URhJw7MpuRYF7gWJ",{"x":36,"y":36,"zoom":37,"background":38},[92],{"type":19,"text":87,"spans":93,"direction":22},[],{"id":95,"uid":96,"url":6,"type":7,"href":97,"tags":98,"first_publication_date":10,"last_publication_date":10,"slugs":99,"linked_documents":101,"lang":14,"alternate_languages":102,"data":103},"awbJhRIAACcAJT6_","ripgrep-show-line-numbers","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=axHxNRMAACoA2InR&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awbJhRIAACcAJT6_%22%29+%5D%5D",[],[100],"ripgrep-how-to-show-line-numbers",[],[],{"image":104,"title":110},{"dimensions":105,"alt":106,"copyright":6,"url":107,"id":108,"edit":109},{"width":31,"height":32},"Ripgrep: How to Show Line Numbers","https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002Fs321hxB6Ig55dpAV_ripgrep-show-line-numbers.png?auto=format,compress","s321hxB6Ig55dpAV",{"x":36,"y":36,"zoom":37,"background":38},[111],{"type":19,"text":106,"spans":112,"direction":22},[],{"id":114,"uid":115,"url":6,"type":7,"href":116,"tags":117,"first_publication_date":10,"last_publication_date":10,"slugs":118,"linked_documents":120,"lang":14,"alternate_languages":121,"data":122},"awbJoRIAACkAJT7y","ripgrep-fix-rg-command-not-found","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=axHxNRMAACoA2InR&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awbJoRIAACkAJT7y%22%29+%5D%5D",[],[119],"ripgrep-how-to-fix-rg-command-not-found",[],[],{"image":123,"title":129},{"dimensions":124,"alt":125,"copyright":6,"url":126,"id":127,"edit":128},{"width":31,"height":32},"Ripgrep: How to Fix rg Command Not Found","https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002Fhg6FIxSh73y6T04k_ripgrep-fix-rg-command-not-found.png?auto=format,compress","hg6FIxSh73y6T04k",{"x":36,"y":36,"zoom":37,"background":38},[130],{"type":19,"text":131,"spans":132,"direction":22},"Ripgrep: How to Fix \"rg Command Not Found\"",[],3,127,1796337997369]