Skip to content

aos file

Read, write, and inspect files

11 commands. Run aos file --help for the same list from the binary, or see every group.

Read, write and inspect files with exit codes an agent can trust. read takes a line range, write and append take words or stdin, list and stat have --json. delete refuses filesystem roots, your home directory and system directories, and needs --recursive for a directory. recent lists the documents the person opened lately, newest first, from the OS’s own recents: macOS Recent Documents (per-app lists with --app, matched against the bundle id), the freedesktop recently-used.xbel on Linux (with --app), and the shortcuts in the Windows Recent folder (no --app there). It follows the host, because it is about the person’s desktop.

Append stdin, or the given words, to a file

Under WSL / SSH: runs inside WSL (where aos was started). How the host works

Terminal window
aos file append <path> [text...]
flag values meaning
<path> Required positional argument
Terminal window
aos file append log.txt "done"

Copy a file

Under WSL / SSH: runs inside WSL (where aos was started). How the host works

Terminal window
aos file copy <source> <destination>
flag values meaning
<source> Required positional argument
<destination> Required positional argument
Terminal window
aos file copy a.txt b.txt

Delete a file, or a directory with –recursive

Under WSL / SSH: runs inside WSL (where aos was started). How the host works

Terminal window
aos file delete <path> [--recursive]
flag values meaning
<path> Required positional argument
--recursive Optional
Terminal window
aos file delete /tmp/scratch --recursive

List a directory

Under WSL / SSH: runs inside WSL (where aos was started). How the host works

Terminal window
aos file list [path] [--all] [--json]
flag values meaning
--all Optional
--json Optional
Terminal window
aos file list
aos file list ~/Downloads --json

Create a directory, including parents

Under WSL / SSH: runs inside WSL (where aos was started). How the host works

Terminal window
aos file mkdir <path>
flag values meaning
<path> Required positional argument
Terminal window
aos file mkdir ~/.config/aos/layouts

Move or rename a path

Under WSL / SSH: runs inside WSL (where aos was started). How the host works

Terminal window
aos file move <source> <destination>
flag values meaning
<source> Required positional argument
<destination> Required positional argument
Terminal window
aos file move old.txt new.txt

Print a file, optionally a line range

Under WSL / SSH: runs inside WSL (where aos was started). How the host works

Terminal window
aos file read <path> [--lines=<from>:<to>]
flag values meaning
<path> Required positional argument
<to> Optional positional argument
--lines <from> Optional
Terminal window
aos file read go.mod
aos file read main.go --lines=10:40

List recently opened documents, newest first, from the OS’s own recents

Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works

Terminal window
aos file recent [--app=<name>] [--limit=<n>] [--json]
flag values meaning
--app <name> Optional
--limit <n> Optional
--json Optional
Terminal window
aos file recent
aos file recent --app=textedit --limit=5
aos file recent --json

Find files and folders by name, through the OS index when there is one

Under WSL / SSH: runs inside WSL (where aos was started). How the host works

Terminal window
aos file search <query> [--root=<dir>] [--kind=file|dir] [--limit=<n>] [--engine=auto|everything|index|walk] [--json]
flag values meaning
<query> Required positional argument
--root <dir> Optional
--kind file, dir Optional
--limit <n> Optional
--engine auto, everything, index, walk Optional
--json Optional
Terminal window
aos file search invoice --limit=10
aos file search "*.pdf" --root=~/Downloads --json
aos file search notes --kind=dir --engine=walk

Print one path’s size, mode, and modified time

Under WSL / SSH: runs inside WSL (where aos was started). How the host works

Terminal window
aos file stat <path> [--json]
flag values meaning
<path> Required positional argument
--json Optional
Terminal window
aos file stat go.mod --json

Write stdin, or the given words, to a file

Under WSL / SSH: runs inside WSL (where aos was started). How the host works

Terminal window
aos file write <path> [text...]
flag values meaning
<path> Required positional argument
Terminal window
aos file write notes.txt "first line"
cat in.txt | aos file write out.txt