<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>hi, it&#39;s mike</title>
    <link>https://mike.puddingtime.org/tags/ls/</link>
    <description>Recent content on hi, it&#39;s mike</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <managingEditor>mike@puddingtime.org (mike)</managingEditor>
    <webMaster>mike@puddingtime.org (mike)</webMaster>
    <copyright>© 2026, mike</copyright>
    <lastBuildDate>Mon, 11 Feb 2013 09:41:41 +0000</lastBuildDate>
    <atom:link href="https://mike.puddingtime.org/tags/ls/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Shape of the problem, better colored ls output on Macs</title>
      <link>https://mike.puddingtime.org/posts/2013-02-11-shape-of-the-problem-better-colored-ls-output-on/</link>
      <pubDate>Mon, 11 Feb 2013 09:41:41 +0000</pubDate><author>mike@puddingtime.org (mike)</author>
      <guid>https://mike.puddingtime.org/posts/2013-02-11-shape-of-the-problem-better-colored-ls-output-on/</guid>
      
      <description>BBEdit tells me it found 439 occurrences of “img src” in 317 files in the Markdown archives for dot unplanned, so this is starting to feel kind of doable. 122 of those occurrences are flickr images, only 27 use the ancient Movable Type 3 “click the thumbnail to pop up a window with the full image …</description>
      <content:encoded><![CDATA[<p>BBEdit tells me it found 439 occurrences of &ldquo;img src&rdquo; in 317 files in the Markdown archives for dot unplanned, so this is starting to feel kind of doable. 122 of those occurrences are flickr images, only 27 use the ancient Movable Type 3 &ldquo;click the thumbnail to pop up a window with the full image inside&rdquo; markup, and 142 are consistently organized WordPress uploads I can manage with a little find-foo and a BBEdit text factory.</p>
<p>Hey &hellip; here are some things I learned to do, figured out or got around to:</p>
<p>Better color <code>ls</code> in Mac:</p>
<p>You can do <code>ls -G</code> in a Mac right now, without MacPorts or Homebrew installed, and you&rsquo;ll get BSD-style colored output, which is to say &ldquo;not as good as GNU-style colored output.&rdquo; Directories, symlinks, and executables will be colored. That&rsquo;s o.k. But I remembered back in Linux times where I could get things colored down to the file type. That&rsquo;s what I prefer. I did some things one might reasonably do expecting to get that GNU-style output back on my Mac, missing a few key steps and badly aggravating myself, then stumbled across a missing piece last week while trying to figure out better bash prompts.  So here&rsquo;s what to do:</p>
<ul>
<li>Pick one of <a href="http://www.macports.org">MacPorts</a> or <a href="https://github.com/mxcl/homebrew">Homebrew</a>. I do Homebrew, so the steps after this one should be read as <em>vague guidance</em> by MacPortists.</li>
<li>Install the GNU coreutils package: <code>brew install coreutils</code></li>
<li>Download <a href="https://gist.github.com/pdxmph/4751727">this gist</a> and save it to <code>~/.dir_colors</code></li>
<li>Make sure your new <code>~/.dir_colors</code> file has a line in it that starts with &ldquo;TERM&rdquo; and then matches the output of the command <code>echo $TERM</code></li>
<li>Get this into your <code>~/.profile</code> or <code>~/.bash_profile</code> or whatever it is you do<sup>*</sup>:</li>
</ul>
<script src="https://gist.github.com/pdxmph/4751777.js"></script>  
<ul>
<li><code>source</code> your <code>~/.profile</code> or <code>~/.bash_profile</code></li>
<li>Try it out in a directory full of different kinds of things:</li>
</ul>
<p><a href="https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2013/02/better_ls_colors.jpg.png" class="glightbox" data-gallery="post-8454ada0b26b439d1e46b9baa43ff42c"><img src="https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2013/02/better_ls_colors.jpg.png" alt="" loading="lazy"></a></p>
<p>Is it awesome for you? Hope so!</p>
<p>More informative <code>ls</code></p>
<p>I also learned about a few more nice <code>ls</code> options while I was mucking around, and now I include these in my <code>ls</code> alias:</p>
<ul>
<li><code>-F</code> (classify): Which marks symlinks and directories with a <code>@</code> and <code>/</code> respectively. Yes, they are also colored, but I like seeing the trailing <code>/</code> after a directory.</li>
<li><code>--group-directories-first</code>, which does what it says on the tin.</li>
<li><code>-h</code>, for &ldquo;human readable output&rdquo; when displaying file sizes. I finally, after years of just typing it out, realized I never use <code>ls</code> without, so I canonicalized it. I eagerly await the first horrific misunderstanding that is going to cause me on some system that is not mine some day.</li>
</ul>
<p><small><sup>*</sup>Do I sort of hate the hall of mirrors that is <code>.bashrc</code>, <code>.bash_profile</code>, and <code>.profile</code>? Boy, I sure do. Especially in the age of things like <code>rbenv</code>/<code>rvm</code> and whatever else quietly diddles what they think your shell&rsquo;s init file oughta be to make whatever blood magic they&rsquo;re up to work correctly. I thought &ldquo;just switch to zsh&rdquo; would fix that, but then you start getting into bizarre &ldquo;oh, that doesn&rsquo;t work with zsh during install&rdquo; situations that make you realize you&rsquo;re losing all the time you thought you&rsquo;d get back with obscure little shell workflow optimizations trying to figure out why suddenly <code>which</code> doesn&rsquo;t work anymore.</small></p>
<p>#blogging #ls #octopress</p>
<p><em><a href="mailto:mike@puddingtime.org?subject=Re%3A%20Shape%20of%20the%20problem%2C%20better%20colored%20ls%20output%20on%20Macs">Drop a line about this</a>.</em></p>]]></content:encoded>
    </item>
  </channel>
</rss>
