I would like to avoid any future problems with aliases (empty files created with the Finder, not to be confused with symbolic links) I might have used in the past and which may stay within the system. I discovered a lot of problem with this type of file:

  • to backup (with rsync)
  • to migrate on another file system (with cp or rsync)
  • to migrate on another system (with rcp, scp or rsync)…

Now I want either to get rid of all of them or at least to know the size of the risk I still have with the remaining ones.

How may I find all the alias type files within a given filesystem using command line (shell script) using for example:

  • mdfind
  • find
  • I edited my answer to include using find. Apr 28, 2015 at 19:44
  • The symbolic links aren't any source of problem. My question is focused on the aliases.
    – dan
    Apr 29, 2015 at 8:54
  • 2
    If it's only aliases created in Finder then I'd just use mdfind as it is better suited to explicitly show aliases where find is not. While find can use -xattrname with com.apple.FinderInfo or com.apple.ResourceFork, the two extended attributes given to an alias created in Finder, nonetheless there are many other files that have these same extended attributes thus making it difficult to differentiate between what's a alias or not using the find command. I'm not saying there is no a way with find, just I don't know of one off the top of my head. Apr 29, 2015 at 14:35

1 Answer 1


To find aliases with mdfind, in a Terminal:

mdfind kMDItemKind="Alias"

This will print a list of aliases with the fully qualified pathname.

Note: These are aliases created in Finder, not symbolic links created with the ln command from a Terminal or script.

To use find to find symbolic links created by, as an example, ln have a look at: man find

Example: find / -type l

This will start in the root of the Macintosh HD and traverse the entire filesystem that you have permission to read and output all symbolic links created by, as an example, ln showing the fully qualified pathname.

To augment the basic command example read man find.

You must log in to answer this question.

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