attr

Read portable file metadata and extended attributes; available xattrs can also be written or removed.

FilesVersion 1.3.1Stable
lil-terminal

Overview

attr keeps metadata useful across hosts: localized labels remain readable, stable English keys can now be queried directly, and real xattr keys remain a separate writable domain.

Metadata that stays with the file

Start with portable keys when you need predictable metadata across hosts; use extended-attribute keys only when the server actually exposes them.

Syntax

lil-terminal
attr [path [key]] [-x|-d|-s <value>]

Reference

attr

show portable metadata for the current directory

attr <path>

show extended keys or portable metadata

attr <path> <key>

show a portable field or extended-attribute value

attr <path> <key> : <value>

set raw text for an extended attribute

-x

show the selected value as hexadecimal

-s <value>

set a text value for an extended attribute

-d

delete an extended attribute

Portable fields

The stable portable keys are path, type, permissions, access, size, mime, dimensions and modified. They are read-only and keep these English machine names in every interface language. size, mime and dimensions appear only when they apply to the selected path. A portable key takes precedence over an extended attribute with the same bare name; namespaced xattr keys such as user.note remain unambiguous.

Extended attributes

When xattr is supported, attr <path> lists the real filesystem keys. Reading, hexadecimal output, writing and deletion continue to use those real keys. Portable metadata never pretends that a write operation exists on a host that lacks xattr support.

Interactive sandbox preview

Run the prepared examples directly on the page. Their results are prebuilt and shown in the browser; no terminal command is executed on the server.

Inspect file metadata

The XML extension does not change the filesystem checks; MIME information is added only when PHP can identify it.

Install and manage

Install the current compatible version. Choose Base for the complete feature set or Minimum for the reduced package; use upgrade to update a module that is already installed.

Base and Minimum are two packages of the same current module release, not separate command versions.

Base package

Install the complete package with local command reference and every published mode.

install attr
Minimum package

Install the reduced package. Local reference is omitted; help <cmd> -i opens the current server reference.

install attr -m
Exact public version

Install exactly this published version.

install attr -v 1.3.1
Check or update

Ask upgrade to check compatibility and replace the installed block only when needed.

upgrade attr
Remove module

Remove the extension block while leaving the core and unrelated modules intact.

install attr -u

Examples

Examples are copyable command lines, not actions executed by this website. Review paths, permissions and destructive flags before running them on a real project.

Inspect file metadata
cd \sandbox | attr feed.xml | attr feed.xml permissions
feed.xml
path         feed.xml
type         file
permissions  0644
size         1.3 KB
mime         application/xml

permissions  0644

The XML extension does not change the filesystem checks; MIME information is added only when PHP can identify it.

Read one metadata field
attr sandbox/feed.xml permissions
0644

Recognized images add pixel dimensions to the same portable file metadata.

Write a custom metadata field
attr sandbox/feed.xml user.note : reviewed
path         sandbox/data/sample.txt
type         file
permissions  0644
readable     yes
writable     yes

Directories keep their own filesystem type and omit file-only size, MIME and image fields.

Read a custom metadata field
attr sandbox/feed.xml user.note
path         sandbox/data/sample.txt
type         file
permissions  0644
readable     yes
writable     yes
Save metadata to a file
attr sandbox/feed.xml > attr.log
path         sandbox/data/sample.txt
type         file
permissions  0644
readable     yes
writable     yes
Handle a missing path
attr \sandbox\missing.txt
Path not found

File used in this example: sandbox/feed.xml

The example uses a file or directory from the protected /sandbox/ documentation workspace.

<?xml version="1.0" encoding="UTF-8"?>
<feed>
  <title>lil-sandbox</title>
  <entry id="1">Example XML content</entry>
</feed>

Related documentation

Current public release

v1.3.12026-08-14

Clear attribute value syntax

Moves extended-attribute value assignment to : and keeps portable metadata selectors read-only, so > has one system-wide meaning.