[{"data":1,"prerenderedAt":117},["ShallowReactive",2],{"blog-post-bat-show-line-numbers":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},"awBNlhIAACoAFJ-_","bat-show-line-numbers",null,"blog_posts","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=awi2cRIAACwAhxgS&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awBNlhIAACoAFJ-_%22%29+%5D%5D",[],"2026-11-26T22:45:05+0000",[12],"bat-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","Bat: How to Show Line Numbers",[],"ltr","2026-11-26",[25],{"type":26,"text":27,"spans":28,"direction":22},"heading2","Learn how to show line numbers in a file using bat",[],{"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\u002F9EACcMMdCc_YmGGd_bat-show-line-numbers.png?auto=format,compress","9EACcMMdCc_YmGGd",{"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 bat installed on your computer and the file you want to view ready in a folder. If you don't have bat yet, run this command:",[],{"type":45,"text":46,"spans":47,"direction":22},"preformatted","brew install bat",[],{"type":41,"text":49,"spans":50,"direction":22},"First, open your terminal and navigate to the folder that has your file. When you run bat in a terminal, it shows line numbers by default, along with a header and a border:",[],{"type":45,"text":52,"spans":53,"direction":22},"bat input.py",[],{"type":41,"text":55,"spans":56,"direction":22},"Just remember to replace \u003Ccode>input.py\u003C\u002Fcode> with your actual filename. If you only want the numbers, without the header and the border, add the \u003Ccode>-n\u003C\u002Fcode> flag:",[],{"type":45,"text":58,"spans":59,"direction":22},"bat -n input.py",[],{"type":41,"text":61,"spans":62,"direction":22},"Bat only shows its decorations when it prints to a terminal, so if you pipe it into another command, the line numbers disappear. To keep them, add \u003Ccode>--decorations=always\u003C\u002Fcode>. Here I'm sending the result to \u003Ccode>grep\u003C\u002Fcode> to find every line with \u003Ccode>fizz\u003C\u002Fcode> in it:",[],{"type":45,"text":64,"spans":65,"direction":22},"bat --decorations=always input.py | grep fizz",[],{"type":67,"oembed":68},"embed",{"embed_url":69,"type":67},"",{"type":41,"text":71,"spans":72,"direction":22},"One closing tip: if line numbers ever go missing because of your settings, add \u003Ccode>--style=+numbers\u003C\u002Fcode> and they come right back.",[],{"results":74,"page":37,"results_per_page":115,"results_size":115,"total_results_size":116,"total_pages":37},[75,94,96],{"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},"awBNkxIAACkAFJ-q","hyperfine-multiple-parameters","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=awi2cRIAACwAhxgS&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awBNkxIAACkAFJ-q%22%29+%5D%5D",[],[81],"hyperfine-how-to-run-multiple-parameters",[],[],{"image":85,"title":91},{"dimensions":86,"alt":87,"copyright":6,"url":88,"id":89,"edit":90},{"width":31,"height":32},"Hyperfine: How to Run Multiple Parameters","https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002F_l5pwA96nzZYxC9L_hyperfine-multiple-parameters.png?auto=format,compress","_l5pwA96nzZYxC9L",{"x":36,"y":36,"zoom":37,"background":38},[92],{"type":19,"text":87,"spans":93,"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":95},{"image":29,"title":17},{"id":97,"uid":98,"url":6,"type":7,"href":99,"tags":100,"first_publication_date":10,"last_publication_date":10,"slugs":101,"linked_documents":103,"lang":14,"alternate_languages":104,"data":105},"awBNlRIAAC4AFJ-5","bat-set-man-pager","https:\u002F\u002Fmarks-personal-website.cdn.prismic.io\u002Fapi\u002Fv2\u002Fdocuments\u002Fsearch?ref=awi2cRIAACwAhxgS&q=%5B%5B%3Ad+%3D+at%28document.id%2C+%22awBNlRIAAC4AFJ-5%22%29+%5D%5D",[],[102],"bat-how-to-set-bat-as-the-man-pager",[],[],{"image":106,"title":112},{"dimensions":107,"alt":108,"copyright":6,"url":109,"id":110,"edit":111},{"width":31,"height":32},"Bat: How to Set Bat as the Man Pager","https:\u002F\u002Fimages.prismic.io\u002Fmarks-personal-website\u002FTkD7gMTS-unoDHu6_bat-set-man-pager.png?auto=format,compress","TkD7gMTS-unoDHu6",{"x":36,"y":36,"zoom":37,"background":38},[113],{"type":19,"text":108,"spans":114,"direction":22},[],3,99,1795733125375]