@rob-c/pi-managed-tools 0.0.0-stage → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BUSYBOX-CONTRACT.md +440 -0
- package/CHANGELOG.md +775 -0
- package/LICENSE +338 -0
- package/README.md +849 -2
- package/package.json +79 -5
- package/skills/busybox-applets/SKILL.md +266 -0
- package/skills/managed-tools/SKILL.md +328 -0
- package/skills/managed-tools-reference/SKILL.md +738 -0
- package/src/agentops.ts +813 -0
- package/src/agenttools.ts +391 -0
- package/src/bashtool.ts +103 -0
- package/src/build.ts +142 -0
- package/src/context.ts +157 -0
- package/src/display.ts +79 -0
- package/src/extension.ts +1229 -0
- package/src/guard.ts +437 -0
- package/src/jobs.ts +1052 -0
- package/src/timing.ts +364 -0
- package/src/tools.ts +2223 -0
- package/src/userstdin.ts +524 -0
- package/src/wrap.ts +683 -0
package/package.json
CHANGED
|
@@ -1,6 +1,80 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@rob-c/pi-managed-tools",
|
|
3
|
+
"version": "0.23.0",
|
|
4
|
+
"description": "Keeps pi's managed binaries, and a few PATH-only extras, at the latest upstream release",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pi-package",
|
|
7
|
+
"pi",
|
|
8
|
+
"pi-coding-agent",
|
|
9
|
+
"fd",
|
|
10
|
+
"ripgrep",
|
|
11
|
+
"bat",
|
|
12
|
+
"prek",
|
|
13
|
+
"just",
|
|
14
|
+
"gron",
|
|
15
|
+
"shellcheck",
|
|
16
|
+
"ast-grep",
|
|
17
|
+
"ninja",
|
|
18
|
+
"jq",
|
|
19
|
+
"yq",
|
|
20
|
+
"fzf",
|
|
21
|
+
"uv",
|
|
22
|
+
"gh",
|
|
23
|
+
"bd",
|
|
24
|
+
"agent-browser",
|
|
25
|
+
"ruff",
|
|
26
|
+
"mise",
|
|
27
|
+
"scc",
|
|
28
|
+
"duckdb",
|
|
29
|
+
"miller",
|
|
30
|
+
"sd",
|
|
31
|
+
"difftastic",
|
|
32
|
+
"busybox"
|
|
33
|
+
],
|
|
34
|
+
"type": "module",
|
|
35
|
+
"license": "GPL-2.0-only",
|
|
36
|
+
"pi": {
|
|
37
|
+
"extensions": [
|
|
38
|
+
"./src/extension.ts"
|
|
39
|
+
],
|
|
40
|
+
"skills": [
|
|
41
|
+
"./skills"
|
|
42
|
+
],
|
|
43
|
+
"changelogPath": "./CHANGELOG.md"
|
|
44
|
+
},
|
|
45
|
+
"files": [
|
|
46
|
+
"src/",
|
|
47
|
+
"skills/",
|
|
48
|
+
"README.md",
|
|
49
|
+
"BUSYBOX-CONTRACT.md",
|
|
50
|
+
"CHANGELOG.md"
|
|
51
|
+
],
|
|
52
|
+
"scripts": {
|
|
53
|
+
"test": "node --test tests/tools.test.ts tests/agentops.test.ts tests/wrap.test.ts tests/display.test.ts tests/timing.test.ts tests/extension.test.ts tests/skills.test.ts tests/userstdin.test.ts tests/guard.test.ts tests/hardening.test.ts tests/jobs.test.ts tests/benchmark-probes.test.ts tests/benchmark-runner.test.ts tests/gauntlet.test.ts",
|
|
54
|
+
"typecheck": "tsc -p .",
|
|
55
|
+
"verify": "./scripts/verify.sh",
|
|
56
|
+
"testbench": "node scripts/testbench.mjs",
|
|
57
|
+
"measure:timing": "node scripts/measure-timing-value.mjs"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
61
|
+
"@earendil-works/pi-tui": "*",
|
|
62
|
+
"typebox": "*"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@types/node": "^22.0.0",
|
|
66
|
+
"typescript": "^5.0.0"
|
|
67
|
+
},
|
|
68
|
+
"engines": {
|
|
69
|
+
"node": ">=22.19.0"
|
|
70
|
+
},
|
|
71
|
+
"author": "Robert Currie (https://github.com/rob-c)",
|
|
72
|
+
"repository": {
|
|
73
|
+
"type": "git",
|
|
74
|
+
"url": "git+https://github.com/rob-c/pi-managed-tools.git"
|
|
75
|
+
},
|
|
76
|
+
"homepage": "https://github.com/rob-c/pi-managed-tools#readme",
|
|
77
|
+
"bugs": {
|
|
78
|
+
"url": "https://github.com/rob-c/pi-managed-tools/issues"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: busybox-applets
|
|
3
|
+
description: "All 279 Darwin BusyBox applets with a read-only vs mutating classification: which applets never change anything, which write, which are destructive or system-level, and which flags cause the write. Load before running any busybox applet that is not obviously an inspection command."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# BusyBox applets
|
|
7
|
+
|
|
8
|
+
`busybox <applet> [args]` — 279 applets in the Darwin build inside one static binary
|
|
9
|
+
(v1.39.0.git, project release 0.4.0).
|
|
10
|
+
BusyBox dispatches on **argv[0]**, so the installed file must stay named `busybox`;
|
|
11
|
+
if you copy or rename it, `busybox` no longer works and the new name is treated as
|
|
12
|
+
the applet name.
|
|
13
|
+
|
|
14
|
+
**Never run `busybox --install -s <dir>` yourself.** In pi's bin directory — which is
|
|
15
|
+
first on `PATH` for every bash command — that would create 279 symlinks ahead of the
|
|
16
|
+
real coreutils, and busybox `sed`, `grep`, `find`, `tar`, `awk` and `xxd` are not
|
|
17
|
+
GNU-compatible. Every later command in the session, including the other tools in
|
|
18
|
+
this package, would silently change behaviour.
|
|
19
|
+
|
|
20
|
+
The package already exposes a curated subset, which is why some of these applets are
|
|
21
|
+
bare names: `<agent dir>/busybox-applets` holds a symlink per applet in `core`
|
|
22
|
+
(62 of them — `xxd`, `hexdump`, `od`, `strings`, `sha*sum`, `base64`, `gzip`,
|
|
23
|
+
`unzip`, `cpio`, `dpkg-deb`, `rpm2cpio`, `timeout`, `setsid`, `nproc`, `realpath`,
|
|
24
|
+
`seq`, `nl`, `paste`, `ts`, `peek`, `waitfor`, `doctor`, `brief`, `why`, `patchcheck`, ...),
|
|
25
|
+
and it sits on `PATH` *after* `<agent dir>/bin` so the dedicated builds still win. `sed`, `grep`, `find`, `awk`, `tar`, `diff`, `ls`,
|
|
26
|
+
`cp`, `rm`, `stat`, `date`, `patch`, `tree` and `sh` are deliberately left out: use
|
|
27
|
+
`busybox <applet>` for those. `replace`, `run`, `log`, `bench`, `check`, `json`,
|
|
28
|
+
`snapshot` and `brief` are also not linked - some run a command, some write a file, and
|
|
29
|
+
the rest are names a project script or another tool already owns. `PI_MANAGED_TOOLS_APPLETS=all` widens the linked set and `off` disables it.
|
|
30
|
+
|
|
31
|
+
Prefer the dedicated tools where they exist: `rg` over `busybox grep`, `fd` over
|
|
32
|
+
`busybox find`, `bat` over `busybox cat`, `jq` over `busybox awk`, `diff`/`difft`
|
|
33
|
+
over `busybox diff`, `scc` over `busybox wc`-loops. Use busybox for the applets
|
|
34
|
+
nothing else covers (`hexdump`, `xxd`, `unzip`, `gzip`, `patch`, `cpio`, `dpkg-deb`,
|
|
35
|
+
`date`, `hostname`, `sha*sum`).
|
|
36
|
+
|
|
37
|
+
Legend: **R** never changes state · **M** writes files or state · **M★**
|
|
38
|
+
destructive, irreversible or system-level · **E** runs a program you name, so its
|
|
39
|
+
effect is whatever that program does.
|
|
40
|
+
|
|
41
|
+
## Output shapes: timeline and brief
|
|
42
|
+
|
|
43
|
+
Two applets decide what an agent actually *sees* on a busy machine, and they are
|
|
44
|
+
mutually exclusive in this build (see the note below).
|
|
45
|
+
|
|
46
|
+
`busybox run --timestamps` (`-t`) prints one interleaved line per record — dmesg style — with a
|
|
47
|
+
microsecond offset from process start and the stream it arrived on:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
[0.011354 out] ok 1
|
|
51
|
+
[0.066632 err] FAILED test_x
|
|
52
|
+
[0.128234 out] done
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
(Unpadded since busybox-static 0.6.1; an older build pads the number, `[ 0.011354 out]`. With `-n` the fraction is nine digits. A bash result shows `[= out]` for a line at the same offset as the one above.)
|
|
56
|
+
|
|
57
|
+
Read it as ordering evidence: a warning that lands *before* a failure was printed
|
|
58
|
+
before it, and a burst of lines sharing one timestamp is a writer that flushed at exit
|
|
59
|
+
(Python without `PYTHONUNBUFFERED`, Java's `System.out`, Ruby's `$stdout`, a `bufio`
|
|
60
|
+
writer in Go). `log RUN --stream timeline` replays the same view from the artifacts, and
|
|
61
|
+
`log RUN --stream timeline --format json` returns `timeline: [{us, stream, text}]` plus
|
|
62
|
+
`started_unix_us`.
|
|
63
|
+
|
|
64
|
+
`brief` reduces line-oriented output to a bounded view without inventing or eliding
|
|
65
|
+
bytes inside a record: identical records collapse to `Nx <first line>`, `-R` makes a
|
|
66
|
+
record span lines (a stack trace stays one record), `-o`/`-x` select, `-c`/`-t`/`-m`
|
|
67
|
+
group, and its own `[brief] lines_in=… records=… merged=… truncated_by=…` marker line
|
|
68
|
+
reports what it did. `busybox run --brief stdout|stderr|both` pipes a stream through `brief -d`,
|
|
69
|
+
and `--brief-json` puts brief's schema-1 payload in the view instead of text.
|
|
70
|
+
|
|
71
|
+
`-R` matches literal text (not a regex) and `-B 0` means a *zero* budget, not "no limit" —
|
|
72
|
+
two flags whose names suggest more than they do.
|
|
73
|
+
|
|
74
|
+
Three properties decide whether a reduction is trustworthy, and all three are in the
|
|
75
|
+
marker: a record is shown **whole or not at all** (the budget drops records, never
|
|
76
|
+
truncates one); `-s` groups lines that differ only in digits, which is what actually
|
|
77
|
+
collapses a real log (`-d` needs byte-identical lines); and `truncated_by` says *why* the
|
|
78
|
+
view is short — `budget`, `selection` (everything that matched, nothing cut) or
|
|
79
|
+
`record_size`. `-F json` carries the same numbers plus a summary sentence and `hints[]`
|
|
80
|
+
naming the flag that would change the answer. The full flag set and worked examples are in
|
|
81
|
+
`managed-tools-reference`.
|
|
82
|
+
|
|
83
|
+
**`--timestamps` wins over `--brief` here**: `busybox run -t -b both` prints the timeline and
|
|
84
|
+
ignores the brief flags entirely, because the timeline branch is taken first. Pick one.
|
|
85
|
+
|
|
86
|
+
## Agent-facing applets
|
|
87
|
+
|
|
88
|
+
Fifteen applets exist for a coding agent rather than for a shell. They share one
|
|
89
|
+
contract: text by default, `--format json` on request with `"schema":1`, explicit
|
|
90
|
+
byte budgets, and `shown_bytes`/`truncated` always reported. `busybox --list` names them
|
|
91
|
+
all; `busybox --caps --format json` reports the version, applet count and the agent-ops
|
|
92
|
+
features this build actually carries.
|
|
93
|
+
|
|
94
|
+
| exit | meaning |
|
|
95
|
+
|---|---|
|
|
96
|
+
| 0 | success — including "read completed, output truncated": truncation is data |
|
|
97
|
+
| 1 | refused or failed (not found, ambiguous, stale, invalid argument) |
|
|
98
|
+
| 2 | usage error |
|
|
99
|
+
| 3 | timeout or cancellation |
|
|
100
|
+
|
|
101
|
+
Error codes appear inside the payload and decide the message: `INVALID_ARGUMENT`,
|
|
102
|
+
`NOT_FOUND`, `STALE_INPUT`, `AMBIGUOUS_MATCH`, `TIMEOUT`, `CANCELLED`,
|
|
103
|
+
`CAPTURE_INCOMPLETE`, `UNSUPPORTED`. Never 124, never 128+N.
|
|
104
|
+
|
|
105
|
+
| applet | does | does not |
|
|
106
|
+
|---|---|---|
|
|
107
|
+
| `peek FILE -l A:B` or `-a STR` | numbered lines *and* the file's `sha256` version, taken from the bytes it printed; continues at `--from-byte N` when truncated; flags binary input instead of dumping it | invent line numbers, skip content when truncating, match a regex unless `-r` |
|
|
108
|
+
| `replace FILE --old S --new S` | literal replacement validated against the whole file first; `--expect N` (default 1), `--sha256` precondition, atomic write, `--dry-run` diff | chain one edit into the next, apply a partial batch, edit through a symlink without `--follow`, or coordinate with an editor that ignores `flock` |
|
|
109
|
+
| `run -- CMD...` | exec argv verbatim (or `--shell` for a shell line), separate stdout/stderr artifacts, bounded head+tail view, own deadline and process-group cleanup; `-x/--effects` reports files created/changed/removed under the run's cwd (JSON output: `effects: [{op, path, size}]`, bounded) | record cross-stream ordering, or keep a grandchild that detaches from the process group |
|
|
110
|
+
| `log RUN` | re-read a captured run: `--lines`, `--match` (literal), `--context`, `--stream`, `--meta` | read anything the capture quota dropped (`capture_complete=false` says so) |
|
|
111
|
+
| `waitfor` | bounded readiness: `--file`, `--tcp`, `--unix`, `--http` + `--expect` | prove *application* readiness from a TCP connect, or speak `https://` (use `wget --spider`) |
|
|
112
|
+
| `doctor` | cwd, argv[0] resolution, shell, writable temp storage, `--deps a,b` paths | dump the environment or a variable's value |
|
|
113
|
+
| `brief` | reduce a log to its shape: `-s` masks digits so repeats collapse, `-o`/`-x` select, `-R` makes a record span lines, `-k` keeps records verbatim; the `[brief]` marker says what was merged and dropped | cut a record in half (the budget drops records), or treat `-R` as a regex |
|
|
114
|
+
| `busybox json` | query a document: `-f FILE`, `-g '.a.b[2]'`, then `-k` keys / `-t` type / `-n` count; `-c` validates (`INVALID_JSON at byte N: …`, exit 1); **write guarded**: `-g PATH --set --value STR` (or `--json-value JSON`), `-g PATH --delete`, `--dry-run` shows without writing — parses first, missing parent refused exit 1, temp+rename | parse JSON with `awk`/`sed`, read YAML as JSON, or hand-roll a python one-liner to edit a document |
|
|
115
|
+
| `busybox mark NAME` | name this moment in the current run's timeline (`<run>/marks`, read with `busybox log <R> --marks`); outside a run it prints | replace timestamps the model needs to compute itself |
|
|
116
|
+
| `busybox outline FILE` | a file's definitions with line, byte offset and a version each (`-f json`) — the index `peek`/`replace` work from | read the whole file to find where a symbol lives |
|
|
117
|
+
| `busybox patchapply` | apply a unified diff with every hunk verified first; `-c PATH=HASH` refuses on drift, `-n` previews, temp+rename | apply a patch whose hunks were never checked (`patch`), or skip `patchcheck` first |
|
|
118
|
+
| `busybox snapshot` | hash a tree in one pass (`<sha256> <bytes> <path>` per file), `-o FILE` to save, `--diff A B` to compare (`added=1 removed=0 changed=0`) | tell you *what* changed inside a file — it compares content hashes |
|
|
119
|
+
| `patchcheck` | check every `*.patch` in a directory parses: `ok <file>` lines and `checked=N bad=M` | prove a patch *applies* — a patch that parses but would conflict still reports `ok` |
|
|
120
|
+
| `busybox bench` | time a command N times with warmup: `run=1 ms=5.530 status=0` lines plus `runs= ok= failed= min_ms= median_ms= max_ms=` | account for what the command printed (it is discarded) |
|
|
121
|
+
| `why` | say whether an applet is in this binary and which config line decided it (`-C .config`, `-p prune list`) | work without a `.config`: with none it answers `unknown … (no GREP entry in .config)` and exits 0 |
|
|
122
|
+
|
|
123
|
+
Bare names (linked into `<agent dir>/busybox-applets`): `peek`, `waitfor`, `doctor`, `brief`, `why`, `patchcheck`. Everything else here — `replace`, `run`, `log`, `json`, `snapshot`, `bench` — needs the `busybox ` prefix; the table above writes them that way.
|
|
124
|
+
|
|
125
|
+
`busybox --caps --format json` reports the version, platform, schema, applet count
|
|
126
|
+
and the features this build actually has, so none of the above has to be guessed.
|
|
127
|
+
|
|
128
|
+
**Fixed in 0.4.0, still worth knowing:** `busybox run --format json` used to emit an invalid
|
|
129
|
+
payload when the view was truncated (head and tail printed as two adjacent quoted strings).
|
|
130
|
+
It now emits one string with an in-band `... [N bytes] ...` marker. On an older build, read
|
|
131
|
+
the scalar fields, use `log RUN` for the view, and never re-run the command to get a
|
|
132
|
+
parseable answer — that repeats its side effects.
|
|
133
|
+
|
|
134
|
+
## Read-only (R)
|
|
135
|
+
|
|
136
|
+
Safe for inspection. These only read input and write to stdout/stderr.
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
[ [[ arch ascii base32 base64 basename bc blkid brief bzcat cal cat chat cksum
|
|
140
|
+
clear cmp column comm crc32 cut dc df diff dirname dnsdomainname doctor du
|
|
141
|
+
echo egrep expand expr factor false fgconsole fgrep fold free fuser getopt
|
|
142
|
+
grep groups hd head hexdump hostid id iostat ipcalc join json less log logname
|
|
143
|
+
ls lsattr lsblk lsof lspci lsscsi lsusb lzcat man mark md5sum mkpasswd more
|
|
144
|
+
mountpoint mpstat netstat nl nmeter nologin nproc nslookup od outline paste patchcheck
|
|
145
|
+
peek pgrep pidof ping ping6 pipe_progress printenv printf ps pscan pstree pwd
|
|
146
|
+
pwdx readahead readlink realpath resize rev rpm2cpio scriptreplay seq sha1sum
|
|
147
|
+
sha256sum sha384sum sha3sum sha512sum sleep stat strings sum svok tac tail
|
|
148
|
+
test top tr tree true ts tsort tty ttysize uname unexpand uptime usleep
|
|
149
|
+
uuencode uuidgen vmstat volname waitfor wc which whoami whois why xxd xzcat
|
|
150
|
+
yes zcat
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Four caveats inside "read-only": `busybox xxd -r` only prints (it cannot write back),
|
|
154
|
+
`busybox find` is read-only **only** with its default `-print`, `busybox mark` writes
|
|
155
|
+
only the current run's own marks artifact (read it back with `busybox log <R> --marks`),
|
|
156
|
+
and `busybox json` is read-only until `--set`/`--delete` — those rewrite the document
|
|
157
|
+
(temp+rename, parsed first; a missing parent path is refused, exit 1).
|
|
158
|
+
|
|
159
|
+
## Writes files or state (M)
|
|
160
|
+
|
|
161
|
+
| applet | what it writes | how |
|
|
162
|
+
|---|---|---|
|
|
163
|
+
| `add-shell` | `/etc/shells` | appends each argument |
|
|
164
|
+
| `awk` | files anywhere | `print > file`, `>> file`, `system()` |
|
|
165
|
+
| `bootchartd` | `/var/log/bootchart.tgz` | `start`, `stop`, `init` |
|
|
166
|
+
| `chattr` | inode attributes | `-,+,=attr`, `-R` |
|
|
167
|
+
| `chgrp` `chmod` `chown` | ownership and mode bits | normal form, `-R` |
|
|
168
|
+
| `dos2unix` | the file, in place | any file argument |
|
|
169
|
+
| `dpkg-deb` | extracted tree | `-e DIR`, `-x DIR`, `-X DIR` |
|
|
170
|
+
| `fallocate` | allocates blocks in a file | `-l LEN`, any file argument |
|
|
171
|
+
| `fatattr` | FAT attributes | `-/+rhsvda` |
|
|
172
|
+
| `flock` | lock file (created if absent) | `FILE`, `FILE -c PROG` |
|
|
173
|
+
| `fsync` | flushes blocks (no content change) | any file argument |
|
|
174
|
+
| `link` | new hard link | `FILE LINK` |
|
|
175
|
+
| `ln` | links; removes an existing target | `-f`, `-b` |
|
|
176
|
+
| `logger` | syslog | always writes |
|
|
177
|
+
| `lpr` | print queue | any file argument |
|
|
178
|
+
| `mesg` | terminal write permission | `y` / `n` |
|
|
179
|
+
| `mkdir` `mkfifo` `mknod` `mktemp` | new filesystem entries | normal form, `-p`, `-m` |
|
|
180
|
+
| `nc` | hex-dump file | `-o FILE` |
|
|
181
|
+
| `nohup` | `nohup.out` | when stdout is a tty |
|
|
182
|
+
| `remove-shell` | `/etc/shells` | rewrites it |
|
|
183
|
+
| `replace` | the file, atomically | `--old/--new`, `--dry-run` to preview |
|
|
184
|
+
| `reset` | terminal modes and screen | any invocation |
|
|
185
|
+
| `snapshot` | a snapshot file | `-o FILE` (stdout without it) |
|
|
186
|
+
| `renice` | nice values of running processes | `PRIORITY ID`, `-p/-g/-u` |
|
|
187
|
+
| `run-parts` | whatever the scripts do | `DIRECTORY` |
|
|
188
|
+
| `rx` | received file | `FILE` |
|
|
189
|
+
| `script` | `typescript` + timing file | `OUTFILE`, `-a` |
|
|
190
|
+
| `sed` | files in place | `-i[SFX]` — without it, stdout only |
|
|
191
|
+
| `shuf` `sort` | output file | `-o FILE` (default stdout) |
|
|
192
|
+
| `split` | `PREFIX*` output files | `INPUT PREFIX`, `-b`, `-l` |
|
|
193
|
+
| `time` | result file | `-o FILE`, `-a` |
|
|
194
|
+
| `touch` | creates/updates timestamps | any file argument |
|
|
195
|
+
| `uniq` | truncated output file | second positional `OUTFILE` |
|
|
196
|
+
| `unix2dos` | the file, in place | any file argument |
|
|
197
|
+
| `uudecode` | output file | `-o FILE` |
|
|
198
|
+
| `wget` | downloads into cwd | `URL`, `-O FILE`, `-P DIR` |
|
|
199
|
+
| `fakeidentd` | network service | daemon mode |
|
|
200
|
+
|
|
201
|
+
## Destructive or system-level (M★)
|
|
202
|
+
|
|
203
|
+
Deletes, overwrites, truncates, formats, kills, mounts, or changes the machine.
|
|
204
|
+
Confirm before running any of these.
|
|
205
|
+
|
|
206
|
+
| applet | what it destroys or changes | how |
|
|
207
|
+
|---|---|---|
|
|
208
|
+
| `rm` `rmdir` `unlink` | deletes files / empty dirs | `-r`, `-f`, `-p` |
|
|
209
|
+
| `mv` | overwrites destination | `-f` |
|
|
210
|
+
| `cp` | overwrites destination | `-f`, `-r`, `-a` |
|
|
211
|
+
| `dd` | block device or file, truncated | `of=`, `seek=`, `conv=notrunc` |
|
|
212
|
+
| `truncate` | truncates and creates | `-s SIZE` (`-c` only stops creation) |
|
|
213
|
+
| `shred` | overwrites then deletes | `-n`, `-z`, `-u` |
|
|
214
|
+
| `tee` | truncates every file named | any file arg (`-a` appends) |
|
|
215
|
+
| `tar` | creates/extracts, overwrites | `c`, `x`, `-C DIR` (`t` only lists) |
|
|
216
|
+
| `unzip` `unxz` `unlzma` `gunzip` `xz` `gzip` `bzip2` `bunzip2` `lzma` `lzop` | write output and **delete the input** unless `-k` | `-f` forces overwrite; `-c`/`-t` are read-only |
|
|
217
|
+
| `patch` | rewrites targets in place | `-i DIFF`, `ORIGFILE` |
|
|
218
|
+
| `patchapply` | the files a patch touches, via temp+rename | applies a unified diff with every hunk verified first; `-c PATH=HASH` refuses on drift, `-n` previews |
|
|
219
|
+
| `ed` `vi` `hexedit` | overwrite the file on save | file argument (`vi -R` is read-only) |
|
|
220
|
+
| `kill` `killall` `killall5` | terminate processes | `-SIG PID`, name |
|
|
221
|
+
| `timeout` | signals the child | `-s`, `-k` |
|
|
222
|
+
| `start-stop-daemon` `svc` | start/kill supervised processes | `-S`, `-K`, `-u -d -o` |
|
|
223
|
+
| `date` `rdate` `hwclock` | set the system clock | `-s`, `-w`, `--systz` |
|
|
224
|
+
| `hostname` | system hostname | `HOSTNAME`, `-F` (`-s/-i/-d` read) |
|
|
225
|
+
| `sysctl` | kernel parameters | `-w`, `-p`, `KEY=VALUE` |
|
|
226
|
+
| `stty` | terminal/device settings | any setting arg (`-a`, `-g` read) |
|
|
227
|
+
| `devmem` `setconsole` `setkeycodes` `chvt` `deallocvt` `resume` `swaplabel` `fdformat` `fbset` `makedevs` `rtcwake` | devices, kernel maps, consoles, RTC alarm and sleep state | positional args, `-s SEC`, `-t TIME` |
|
|
228
|
+
| `microcom` `getty` | writes to a serial/tty device | `TTY` |
|
|
229
|
+
| `dpkg` `rpm` | install/remove packages system-wide | `-i`, `-r`, `-P` |
|
|
230
|
+
| `chroot` | changes root, runs `PROG` | `NEWROOT PROG` |
|
|
231
|
+
| `install` | copies and overwrites, sets owner/mode | always writes |
|
|
232
|
+
| `cpio` | extracts or creates archives | `-i`, `-o -F`, `-p DIR` |
|
|
233
|
+
| `fdisk` | partition table on a block device | `-l` only lists; every other mode writes |
|
|
234
|
+
| `mount` `umount` | mounts and unmounts filesystems | any argument (`mount` alone lists) |
|
|
235
|
+
| `ifconfig` `ip` `route` | interface addressing, links and routes | any mutation form (`ifconfig -a`, `ip a`, `route -n` read) |
|
|
236
|
+
| `pkill` `killall` | terminate processes by name | any invocation |
|
|
237
|
+
| `fuser` | with `-k`: kills what holds the file | `-k` (`-v`/`-u` only report) |
|
|
238
|
+
| `fatlabel` | FAT label on a block device | `BLOCKDEV LABEL` |
|
|
239
|
+
| `ftpd` `ftpput` `ftpget` `tftpd` `tftp` `telnet` `telnetd` `httpd` `inetd` `ssl_server` `tcpsvd` `udpsvd` | serve, upload or run remote-triggered commands | server/upload modes |
|
|
240
|
+
| `find` | deletes or runs commands | `-delete`, `-exec CMD ;` |
|
|
241
|
+
| `mim` | runs shell commands from a spec | `-f FILE` |
|
|
242
|
+
| `ash` `sh` `hush` | anything the script does | `-c SCRIPT`, script file |
|
|
243
|
+
| `sync` | flushes all buffers | no flags needed |
|
|
244
|
+
| `lpq` | cancels print jobs | `-d JOBID` |
|
|
245
|
+
| `lpd` | spool queue files | always writes |
|
|
246
|
+
| `getty` | utmp/wtmp, login | `TTY` |
|
|
247
|
+
|
|
248
|
+
## Runs a program you name (E)
|
|
249
|
+
|
|
250
|
+
Read-only *by themselves*; the effect is entirely the child's. `env`, `envdir`,
|
|
251
|
+
`nice`, `setsid`, `cttyhack`, `xargs` (`-a FILE` only reads), plus `find -exec`,
|
|
252
|
+
`awk system()`, `sed e`, `tar --to-command`, `vi !cmd`.
|
|
253
|
+
|
|
254
|
+
The agent-facing `run` applet belongs here too: it execs whatever follows `--`, or a
|
|
255
|
+
shell line with `--shell`, and keeps the output in artifacts. `bench` runs its command
|
|
256
|
+
N times and `check` runs the cases in its table, so both are E. `chpst`, `envuidgid`,
|
|
257
|
+
`setuidgid` and `softlimit` also run a program, with a changed uid/gid or limits.
|
|
258
|
+
`watch` runs its command repeatedly, so its effect is not once.
|
|
259
|
+
|
|
260
|
+
## BusyBox is not GNU
|
|
261
|
+
|
|
262
|
+
Before reaching for an applet that shadows a GNU tool, remember the flag gaps:
|
|
263
|
+
`grep` has no `-P`, `find` has no `-printf`, `sed -i` exists but `sed` lacks many
|
|
264
|
+
GNU extensions, `tar` has no `--exclude-from` in the same form, `xxd` accepts one
|
|
265
|
+
FILE, `ls` has no `--color=auto` nuance. When the GNU-compatible tool exists in
|
|
266
|
+
this package (`rg`, `fd`, `bat`, `jq`, `scc`, `difft`), use it instead.
|