{"id":562,"date":"2013-10-02T14:03:21","date_gmt":"2013-10-02T19:03:21","guid":{"rendered":"http:\/\/pchristensen.com\/blog\/?p=562"},"modified":"2013-10-02T14:03:21","modified_gmt":"2013-10-02T19:03:21","slug":"find-the-largest-files-in-a-directory","status":"publish","type":"post","link":"http:\/\/pchristensen.com\/blog\/articles\/find-the-largest-files-in-a-directory\/","title":{"rendered":"Find the Largest Files In A Directory"},"content":{"rendered":"<p>tl;dr:\u00a0$ find . -type f -ls | sort -r -k 7 | head -20<\/p>\n<p>I&#8217;m a programmer who grew up on Windows, so while I&#8217;m competent at Unix commands, there&#8217;s a lot I don&#8217;t know. That &#8220;young and clueless with lots of time&#8221; period is a great time to pick up skills; the &#8220;busy working father&#8221; period means I have to be much more selective now.<\/p>\n<p>Backstory: I have been a Dropbox user since they were in beta in 2006, and every once in a while I bump up against my free space limit and have to weed out files. This gets harder every time since everything left is something I&#8217;d previously decided to keep. COMPUTERS TO THE RESUCE!<\/p>\n<p>I went to the first place I always look for these problems: Stack Overflow. <a href=\"http:\/\/stackoverflow.com\/questions\/12522269\/bash-how-to-find-the-largest-file-in-a-directory-and-its-subdirectories\">There was an answer<\/a>, of course, but it didn&#8217;t work for me. I tried to get it to work, but didn&#8217;t feel like looking past the man page for why the printf option wasn&#8217;t valid on my machine.<\/p>\n<p>So the next place I looked was the rest of the Google search results. Eventually I came up with this:<\/p>\n<p>$ find . -type f -ls | sort -r -k 7 | head -20<\/p>\n<p>List all the files, sort in reverse order based on the 7th field, and take the top 20. Thanks nerds of the world for answering my question!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>tl;dr:\u00a0$ find . -type f -ls | sort -r -k 7 | head -20 I&#8217;m a programmer who grew up on Windows, so while I&#8217;m competent at Unix commands, there&#8217;s a lot I don&#8217;t know. That &#8220;young and clueless with lots of time&#8221; period is a great time to pick up skills; the &#8220;busy working [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[10],"tags":[],"class_list":{"0":"post-562","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-programming","7":"entry"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pazgP-94","_links":{"self":[{"href":"http:\/\/pchristensen.com\/blog\/wp-json\/wp\/v2\/posts\/562","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/pchristensen.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pchristensen.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pchristensen.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/pchristensen.com\/blog\/wp-json\/wp\/v2\/comments?post=562"}],"version-history":[{"count":0,"href":"http:\/\/pchristensen.com\/blog\/wp-json\/wp\/v2\/posts\/562\/revisions"}],"wp:attachment":[{"href":"http:\/\/pchristensen.com\/blog\/wp-json\/wp\/v2\/media?parent=562"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pchristensen.com\/blog\/wp-json\/wp\/v2\/categories?post=562"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pchristensen.com\/blog\/wp-json\/wp\/v2\/tags?post=562"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}