By Alvin Alexander. Last updated: December 31, 2020
When using Apple’s macOS Terminal application, sometimes you’ll issue the ls -l
command and see @
characters in the ls
command output, like this:
$ ls -l total 1280 -rw-r--r--@ 1 al staff 1695 Dec 24 17:19 ca-context-bounds.md -rw-r--r-- 1 al staff 4064 Dec 24 14:41 ca-type-classes.md -rw-r--r--@ 1 al staff 20580 Dec 24 14:41 collections-classes.md -rw-r--r--@ 1 al staff 15960 Dec 24 14:29 control-structures.md
Today I learned that the @
character means that the file has extended attributes.
This SO page shows that you can issue these macOS xattr
commands to see and manage the extended file attributes:
xattr -l file # lists the names of all xattrs xattr -w attr_name attr_value file # sets xattr attr_name to attr_value xattr -d attr_name file # deletes xattr attr_name xattr -c file # deletes all xattrs xattr -h # prints help
That same page notes that you can use the ls -l@
command to see the attributes in the ls
output:
$ ls -l@ total 1280 -rw-r--r--@ 1 al staff 1695 Dec 24 17:19 ca-context-bounds.md com.macromates.selectionRange 1 com.macromates.visibleIndex 1
I use the MacroMates TextMate editor quite a bit, and apparently it stores those extended file attributes for each file I edited, or perhaps each file I had visible when I closed the editor.
If you ever wondered what the @
character in the Mac ls -l
output means, I hope that’s helpful.