Skip to content


Color and ‘human readable’ file sizes in Terminal

These are two very old tips, but I'd forgotten about them until recently, when I sent someone a screenshot and they said "Hey, how'd you do that?"

Do what, exactly? This…

The most-obvious thing in that shot is the colored filenames. But notice, too, the file sizes are in a human-readable form. Both of these changes are pretty simple, though you could spend hours playing with colors.

Human-readable output

To get human readable output—not just from ls but also in du, which shows disk space usage—just include an h with the ls command: ls -alh. Instead of raw bytes, the values are converted and marked with trailing B, K, M, etc.

Because I never use ls in its short form, I actually added a line to my .profile (which loads whenever you open a Terminal session) to make this automatic:

alias ls='ls -alh'

You could do the same thing with du, but I rarely use that command, so I didn't bother.

[continue reading…]