Skip to content

Instantly share code, notes, and snippets.

@marr
Created September 22, 2012 19:20
Show Gist options
  • Save marr/3767498 to your computer and use it in GitHub Desktop.
Save marr/3767498 to your computer and use it in GitHub Desktop.
# ----------------------------------------------------------------------
# LS AND DIRCOLORS
# ----------------------------------------------------------------------
# we always pass these to ls(1)
LS_COMMON="-hBG"
# if the dircolors utility is available, set that up to
dircolors="$(type -P gdircolors dircolors | head -1)"
test -n "$dircolors" && {
COLORS=/etc/DIR_COLORS
test -e "/etc/DIR_COLORS.$TERM" && COLORS="/etc/DIR_COLORS.$TERM"
test -e "$HOME/.dircolors" && COLORS="$HOME/.dircolors"
test ! -e "$COLORS" && COLORS=
eval `$dircolors --sh $COLORS`
}
unset dircolors
# setup the main ls alias if we've established common args
test -n "$LS_COMMON" &&
alias ls="command ls $LS_COMMON"
# these use the ls aliases above
alias ll="ls -l"
alias l.="ls -d .*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment