[{"data":1,"prerenderedAt":121},["ShallowReactive",2],{"blog-post-ripgrep-show-line-numbers":3,"recent-posts":76},{"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},"awbJhRIAACcAJT6_","ripgrep-show-line-numbers",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+%22awbJhRIAACcAJT6_%22%29+%5D%5D",[],"2026-12-03T22:46:13+0000",[12],"ripgrep-how-to-show-line-numbers",[],"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 Show Line Numbers",[],"ltr","2026-12-03",[25],{"type":26,"text":27,"spans":28,"direction":22},"heading2","Learn how to show line and column numbers 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\u002Fs321hxB6Ig55dpAV_ripgrep-show-line-numbers.png?auto=format,compress","s321hxB6Ig55dpAV",{"x":36,"y":36,"zoom":37,"background":38},0,1,"transparent",[40,44,48,51,54,57,60,63,66,69,73],{"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},"Good news: in your terminal, ripgrep already shows line numbers by default. Open your terminal, go to your project folder and run a search, and you'll see the number in front of every matching line.",[],{"type":41,"text":52,"spans":53,"direction":22},"The catch is that ripgrep drops them as soon as you pipe the output into another command or a file. To keep them, add \u003Ccode>-n\u003C\u002Fcode> (or \u003Ccode>--line-number\u003C\u002Fcode>):",[],{"type":45,"text":55,"spans":56,"direction":22},"rg -n \"pattern\" | head -n 20",[],{"type":41,"text":58,"spans":59,"direction":22},"Each line now reads \u003Ccode>file:line:text\u003C\u002Fcode>, so you can see exactly where every match is.",[],{"type":41,"text":61,"spans":62,"direction":22},"If you also want the exact character position on the line, add \u003Ccode>--column\u003C\u002Fcode>:",[],{"type":45,"text":64,"spans":65,"direction":22},"rg --column \"pattern\"",[],{"type":41,"text":67,"spans":68,"direction":22},"You'll get two numbers per match, the line and then the column, for example \u003Ccode>12:6\u003C\u002Fcode>.",[],{"type":70,"oembed":71},"embed",{"embed_url":72,"type":70},"",{"type":41,"text":74,"spans":75,"direction":22},"If you ever want to hide line numbers in the terminal, use a capital \u003Ccode>-N\u003C\u002Fcode> (\u003Ccode>--no-line-number\u003C\u002Fcode>).",[],{"results":77,"page":37,"results_per_page":119,"results_size":119,"total_results_size":120,"total_pages":37},[78,97,99],{"id":79,"uid":80,"url":6,"type":7,"href":81,"tags":82,"first_publication_date":10,"last_publication_date":10,"slugs":83,"linked_documents":85,"lang":14,"alternate_languages":86,"data":87},"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",[],[84],"ripgrep-how-to-search-hidden-files",[],[],{"image":88,"title":94},{"dimensions":89,"alt":90,"copyright":6,"url":91,"id":92,"edit":93},{"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},[95],{"type":19,"text":90,"spans":96,"direction":22},[],{"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":98},{"image":29,"title":17},{"id":100,"uid":101,"url":6,"type":7,"href":102,"tags":103,"first_publication_date":10,"last_publication_date":10,"slugs":104,"linked_documents":106,"lang":14,"alternate_languages":107,"data":108},"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",[],[105],"ripgrep-how-to-fix-rg-command-not-found",[],[],{"image":109,"title":115},{"dimensions":110,"alt":111,"copyright":6,"url":112,"id":113,"edit":114},{"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},[116],{"type":19,"text":117,"spans":118,"direction":22},"Ripgrep: How to Fix \"rg Command Not Found\"",[],3,127,1796337997308]