Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When doing an ls in a directory I get the following output:

drwxr-xr-x@ 12 xonic  staff    408 22 Jun 19:00 .
drwxr-xr-x   9 xonic  staff    306 22 Jun 19:42 ..
-rwxrwxrwx@  1 xonic  staff   6148 25 Mai 23:04 .DS_Store
-rw-r--r--@  1 xonic  staff  17284 22 Jun 00:20 filmStrip.cpp
-rw-r--r--@  1 xonic  staff   3843 21 Jun 21:20 filmStrip.h

I was wondering what the @ means.

share|improve this question

migrated from stackoverflow.com Jun 22 '10 at 18:05

This question came from our site for professional and enthusiast programmers.

    

7 Answers 7

It indicates that the file has extended attributes. Use ls -l@ to see them.

You can use xattr to edit these attributes. xattr -h will give you the inline help for it.

share|improve this answer
4  
thanks. found com.apple.quarantine, here is what that is and how to deal with it for the sake of completeness: superuser.com/questions/28384/… –  xon1c Jun 22 '10 at 18:08

Off the top of my head, I think is has something to do with the file having extended attributes available. Here's a link to a similar discussion:

http://discussions.apple.com/thread.jspa?messageID=5791060

So if you see a file with an "@" when you do an ls, try doing this:

xattr -l <filename>

That should show you the extended attributes.

You can check xattr's help for more details:

xattr --help
usage: xattr [-l] file [file ...]
       xattr -p [-l] attr_name file [file ...]
       xattr -w attr_name attr_value file [file ...]
       xattr -d attr_name file [file ...]

The first form lists the names of all xattrs on the given file(s).
The second form (-p) prints the value of the xattr attr_name.
The third form (-w) sets the value of the xattr attr_name to attr_value.
The fourth form (-d) deletes the xattr attr_name.

options:
  -h: print this help
  -l: print long format (attr_name: attr_value)

It seems like if you look at the extra attributes with "-l" and then remove them with "-d" it'll probably do what you want. Practice this in a temporary directory somewhere first though and make sure it works ;)

share|improve this answer
    
Thanks a lot! It would seem that the directory in question was marked as com.apple.quarantine, which is a security measure to protect against dodgy scripts and apps from the net. That can't possibly cause the problem of the directory not listing. :/ I'll look around more and post the solution if I find it. –  Constant M Aug 26 '09 at 20:17

From the ls(1) man page on Mac OS 10.6.1:

If the file or directory has extended attributes, the permissions field printed by the -l option is followed by a '@' character. Otherwise, if the file or directory has extended security information (such as an access control list), the permissions field printed by the -l option is followed by a '+' character.

From the available options list:

 -@      Display extended attribute keys and sizes in long (-l) output.

 -e      Print the Access Control List (ACL) associated with the file, if present, in long (-l) output.

These will let you see the value of those extended options. FWIW, ACL info can be set using the same chmod(1) utility you are probably already aware of. :-)

There doesn't appear to be an easy way from the command line to do anything with extended attributes.

share|improve this answer
2  
Extended attributes can be viewed and manipulated with the xattr command (only available in OS X v10.5 and .6). It doesn't seem to have a man page, but xattr -h will print its internal help. –  Gordon Davisson Nov 6 '09 at 20:28
    
xattr now has a man page, and you can use xattr -l file to list all attributes or xattr -p attribute_name file to print a specific attribute. –  Lri Aug 14 '13 at 12:09

From the man page for ls:

If the -l option is given, the following information is displayed for each file: file mode, number of links, owner name, group name, number of bytes in the file, abbreviated month, day-of-month file was last modified, hour file last modified, minute file last modified, and the pathname.

In addition, for each directory whose contents are displayed, the total number of 512-byte blocks used by the files in the directory is displayed on a line by itself, immediately before the information for the files in the directory.

If the file or directory has extended attributes, the permissions field printed by the -l option is followed by a '@' character. Otherwise, if the file or directory has extended security information (such as an access control list), the permissions field printed by the -l option is fol-lowed followed lowed by a '+' character.

Use:

ls -la@e

for more information on files or directories with those attributes/information.

share|improve this answer

The "@" means that the file has "extended attributes" associated with it.

If you do "ls -@ -l", you can see what attributes there are for each file. You can also do something like "xattr -l pgsql.so" to dump the attributes for a particular file.

Typically they're stuff like old-school FinderInfo, text encoding info, or the "quarantine" info that gives you the "This file was downloaded from the web, are you sure you want to open it?" warning.

share|improve this answer
1  
Extended attributes are not unique to the mac platform. A number of operating systems support this file-level feature. –  Stefan Kendall Jul 14 '10 at 16:46
    
@iftrue: ultimately it's a file system feature, though. –  Joey Jul 14 '10 at 17:06

This is related to extended attributes and access control.

From the man page of sun ls:

The character after permissions is an ACL or extended attributes indicator. This character is an @ if extended attributes are associated with the file and the -@ option is in effect. Otherwise, this character is a plus sign (+) character if a non-trivial ACL is associated with the file or a space character if not.

share|improve this answer

From the man page of ls:

The Long Format
[…] If the file or directory has extended attributes, the permissions field printed by the -l option is followed by a '@' character. […]

share|improve this answer
1  
Note that the '@' can also hide the '+' that would normally be there to indicate that the file/directory has an ACL associated with it. Try 'ls -le@O' -- that'll list xattrs, ACL (if present), and also any flags. –  Gordon Davisson Aug 26 '09 at 20:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.