---
name: "runat"
section: "1"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/runat"
---

# runat(1)

run a shell command on a named attribute directory

## NAME

**runat** – run a shell command on a named attribute directory

## SYNOPSIS

**runat** \[*file*\] \[*shell* *command*\]

## DESCRIPTION

The **runat** utility runs the shell command on the named attribute directory for the *file* argument. It does a [fchdir(2)](/fchdir/2.md) system call to change the current working directory into the named attribute directory for the *file* argument and then performs the shell command via [sh(1)](/sh/1.md).

If a named attribute directory does not exist for *file*, an empty one will be created. If an application needs to determine if a named attribute exists for the *file*, [pathconf(2)](/pathconf/2.md) with the name *\_PC\_HAS\_NAMEDATTR* may be used. This will not create an empty named attribute directory if one does not exist for *file*.

## EXAMPLES

For a *file* called “myfile”:

```
$ runat myfile ls -l			# lists the attributes for myfile
$ runat myfile cp /etc/hosts attrhosts	# creates attrhosts
$ runat myfile cat attrhosts		# displays contents of attrhosts
```

## SEE ALSO

[sh(1)](/sh/1.md), [fchdir(2)](/fchdir/2.md), [open(2)](/open/2.md), [pathconf(2)](/pathconf/2.md), [named\_attribute(7)](/named_attribute/7.md)

## HISTORY

The **runat** utility first appeared in FreeBSD 15.0.
