Muffinresearch Labs by Stuart Colville

Mac OSX tip: ls command color output | 2 Comments

Posted in Code, Linux/Unix on 1st April 2008, 9:25 am by

If you have OSX tiger simply grab the fileutils from fink with

fink install fileutils

Then add the following to your .profile:

export LS_OPTIONS='--color=auto'

eval "`/sw/bin/dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -lah'
alias l='ls $LS_OPTIONS -lA'

In leopard it’s even easier; simply use the -G switch:

alias ls='ls -G'
alias ll='ls -lahG'
alias l='ls -laG'

Completely non-essential but I find it quite handy to be able to tell apart dirs and files by colour.

Post Tools

  • http://www.robertnyman.com Robert Nyman

    Any way to get folders first and then files in Finder, as opposed to name being the only sorting parameter?

  • http://www.kulor.com James Broad

    Robert, this may be what your looking for:

    ls -la | sort -nr +1

GNU screen: open tab in current working directory|(1)

A nice trick for having screen open a new tab in the same directory as the one you’re currently in. To use it add it to your .screenrc

# Open new window in current dir.
bind c stuff "screen -X chdir \$PWD;screen^M"
bind ^c stuff "screen -X chdir \$PWD;screen^M"

Hat tip: mteckert on SuperUser.com

Ubuntu: add-apt-repository: command not found|(3)

When you’re using a minimal Ubuntu install if you find the ‘add-apt-repository’ command is missing (it’s useful for adding PPAs and other repositories), then simply run:

sudo apt-get install python-software-properties

Photos on Flickr

© Copyright 2004-12 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by Slicehost.com This page was baked in 0.488s.