attr

reads properties of files and directories

FilesVersion 1.3.2Stable
lil-terminal

Overview

attr reads properties of files and directories. Without a path it inspects the current directory. On hosting without xattr support, portable read-only fields are available: path, type, permissions, access, size, mime, dimensions and modified. Ask for one field with attr feed.xml MIME.

Read MIME and permissions

Run attr feed.xml MIME, then attr feed.xml permissions -x. The latter encodes the permission text as hex; it does not alter permissions.

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

Notes

Portable field names are case-insensitive, so MIME and mime both work. Real xattr keys preserve their case. -x displays a value as hexadecimal; -s and : write an extended attribute, while -d removes one. These operations require filesystem xattr support and cannot modify portable fields.

Safety

Use mod to change file permissions: attr only reads them. The documentation sandbox models hosting without xattr support, so write and delete examples show an availability warning rather than a fictional success.

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.2
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
attr
Path [path]                sandbox
Type [type]                directory
Permissions [permissions]  0755
Access [access]            rwx
Modified [modified]        2026-08-11 18:40:00

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
Path         sandbox/feed.xml
Type         file
Permissions  0644
Access       rw-
Size         127 B
MIME         application/xml
Modified     2026-08-11 18:40:00

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

Write a custom metadata field
attr \sandbox\feed.xml MIME
text/xml

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

Read a custom metadata field
attr \sandbox\feed.xml permissions -x
30363434
Save metadata to a file
attr \sandbox\feed.xml permissions -s 0600
Portable attributes are read-only
Handle a missing path
attr \sandbox\feed.xml user.note : reviewed
Extended attributes are unavailable; portable attributes are read-only
Set a text value for an extended attribute
attr \sandbox\feed.xml user.note -s reviewed
Extended attributes are unavailable; portable attributes are read-only
Delete an extended attribute
attr \sandbox\feed.xml user.note -d
Extended attributes are unavailable; portable attributes are read-only
Show the selected value as hexadecimal
attr \sandbox\feed.xml user.note -x
Extended attributes are unavailable; portable attributes are read-only
Delete an extended attribute
attr \sandbox\feed.xml permissions -d
Portable attributes are read-only
Show a portable field or extended-attribute value
attr \sandbox\images\icon.svg dimensions
Attribute not found
Show extended keys or portable metadata
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.22026-10-31

Portable fields in any letter case

MIME, Type and other portable selectors now accept any letter case. Real extended-attribute keys keep their exact names.