<p>Attributes are data fields that belong to a file but aren't part of that file, e.g. they are not computed into the file size and can be copied or changed without touching the file itself. The system uses these attributes to store e.g. file size, file type or date of the last modification. This is similar to other operating systems and their filesystems.
</p><p>What's different is that you can add any kind of attribute to any file and display it or make it editable in a Tracker window. You just have to define the kind of attribute you want to add to a file type (e.g. string, integer or time) and give it a name and description.
</p><p>The file itself doesn't even need any contents at all. Take a look at these People files for example:
<p>As you can see, these are all 0-sized files with attached attributes, the E-mail attribute of "John Nox" being edited right in Tracker.
</p><p>If you index these attributes, as People, Email or audio files are by default, they are also searchable with Haiku's fast query system.
</p>
<br>
<h3>Attributes in Tracker</h3>
<p>Attributes are displayed quite similar to a database or spreadsheet. Using Tracker you can choose which attributes to display (columns) and sort file listings (rows) accordingly.
</p><p>To do this, open a Tracker window, click on the <i>Attributes</i> menu, and select the attributes you want to display. Alternatively, simply right-click onto a column heading and mark the items in the context menu. You can rearrange the columns by a simple drag&drop of the column heading. Moving a column out of a window, is a fast way to get rid of columns you don't need.
</p><p>Double-click on the line between two attributes in the heading to automatically resize a column to its optimal width.
</p><p>Click on a column heading to toggle the sorting order from ascending to descending. You can establish a secondary sort order by pressing the <tt>SHIFT</tt> key while clicking on a column heading. Doing that you can, for example, sort your People files by company and within that order sort by contact name. See the above screenshot as an example. The secondary sort order is marked by a dotted line under the heading.
</p><p>Editing these attributes is as simple as renaming a file: Either click on an entry or press <tt>ALT+E</tt> and move between the attibutes with <tt>TAB</tt> and <tt>SHIFT+TAB</tt>. <tt>ESC</tt> leaves the editing mode without applying the changes.
</p>
<br>
<h3>Attributes in Terminal</h3>
<p>If you prefer to use the commandline or plan to work with many files using scripting, there are several commands for controlling attributes from Terminal:
</p>
<ul><li><b>listattr</b> - lists a file's attributes, but doesn't show the contents of the attributes.<br>
<p>Besides all the "<tt>META:*</tt>" attributes that hold the contact's information, there are two attributes that are managed by the system:
</p><p>
<ul><li><tt>BEOS:TYPE</tt> holds the file type as a MIME string, here "<tt>application/x-person</tt>. It determines the default icon and the application that opens the file when you e.g. double click it.</li>
<li>"<tt>_trk/pinfo_le</tt>" is kept by Tracker as... I'm not sure, I'm still investigating... :)</li></ul></p>
<p>Note the backslash after "Clara". In Terminal you have to "escape" special characters like '"*\$?!. The space between "Clara" and "Botters" is also one of those. Therefore the backslash is really in front of the space character, and not after "Clara".</li>
<p><br>
</p>
<li><b>catattr</b> - displays the contents of a specific attribute of a file.