I have a "folder" (as it appears from Finder), but I can't cd into it from the terminal. if I ls -la this is what it looks like.

-rw-r--r--@   1 christopher  admin   1317440 Oct 17 22:23 Tomcat

What is it and how do I make it a folder or at least cd into it?

1 Answer 1


Usually this is an Alias of a folder. An alias is normally marked with a litte arrow a the left lower corner.



-rw-r--r--@  1 user  staff  1938832 31 Okt 16:54 Car
drwxr-xr-x   3 user  staff      102 31 Okt 16:56 Car1
-rw-r--r--@  1 user  staff      178 31 Okt 16:56 Car2

Car is an Alias, Car1 a folder, Car2 is a text file without suffix but with the icon of a folder though.

To enable cd'ing into an Alias I've found the following at Mac OS X Hints. Don't know if it still works.

Here is the bash function I include in .bashrc. Note that the second elif requires double brackets for the test, because it include the logical operator or (||):

function cd {
  if [ ${#1} == 0 ]; then
    builtin cd
  elif [ -d "${1}" ]; then
    builtin cd "${1}"
  elif [[ -f "${1}" || -L "${1}" ]]; then
    path=$(getTrueName "$1")
    builtin cd "$path"
    builtin cd "${1}"

And here's the C source code for getTrueName.

A similar approach is available at superuser.com

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .