buninu-linux 0.3.0 → 0.4.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.
Files changed (75) hide show
  1. package/LICENSES/Apache-2.0.txt +202 -0
  2. package/LICENSES/BSD-3-Clause-Skia.txt +29 -0
  3. package/LICENSES/Bitstream-Vera.txt +44 -0
  4. package/LICENSES/MIT-xterm.js.txt +21 -0
  5. package/LICENSES/OFL-1.1.txt +91 -0
  6. package/NOTICE.md +18 -1
  7. package/README.md +226 -22
  8. package/fetch-alpine.sh +9 -4
  9. package/graphics.md +213 -0
  10. package/initramfs/bin/bunterm +66 -0
  11. package/initramfs/bin/ip +2 -1
  12. package/initramfs/bin/mount +2 -1
  13. package/initramfs/bin/poweroff +6 -27
  14. package/initramfs/bin/ps +256 -0
  15. package/initramfs/bin/reboot +10 -0
  16. package/initramfs/bin/tar +169 -0
  17. package/initramfs/bin/top +129 -0
  18. package/initramfs/bin/umount +2 -1
  19. package/initramfs/buninu/CHANGELOG.md +40 -0
  20. package/initramfs/buninu/apps/bunmsh/CHANGELOG.md +36 -0
  21. package/initramfs/buninu/apps/bunmsh/README.md +7 -0
  22. package/initramfs/buninu/apps/bunmsh/package.json +1 -1
  23. package/initramfs/buninu/apps/bunmsh/src/fancy-ls.js +29 -14
  24. package/initramfs/buninu/apps/bunmsh/src/line-edit.js +43 -0
  25. package/initramfs/buninu/apps/bunmsh/src/main.js +15 -1
  26. package/initramfs/buninu/apps/bunmsh/src/mouse.js +29 -4
  27. package/initramfs/buninu/apps/bunmsh/src/shell.js +9 -1
  28. package/initramfs/buninu/apps/bunmsh/test/shell1.test.js +70 -0
  29. package/initramfs/buninu/apps/jsgotty/gotty.js +4 -3
  30. package/initramfs/buninu/apps/jsgotty/package.json +1 -1
  31. package/initramfs/buninu/apps/jsmdcui/CHANGELOG.md +10 -0
  32. package/initramfs/buninu/apps/jsmdcui/README.md +2 -0
  33. package/initramfs/buninu/apps/jsmdcui/package.json +1 -1
  34. package/initramfs/buninu/apps/jsmdcui/runtime/help/commands.md +4 -1
  35. package/initramfs/buninu/apps/jsmdcui/runtime/help/help.md +2 -0
  36. package/initramfs/buninu/apps/jsmdcui/src/index.js +40 -13
  37. package/initramfs/buninu/package.json +1 -1
  38. package/initramfs/init.js +6 -0
  39. package/initramfs/lib/bunterm/glyphs.js +446 -0
  40. package/initramfs/lib/bunterm/images.js +225 -0
  41. package/initramfs/lib/bunterm/input.js +140 -0
  42. package/initramfs/lib/bunterm/renderer.js +424 -0
  43. package/initramfs/lib/bunterm/terminal.js +203 -0
  44. package/initramfs/lib/canvas.js +181 -0
  45. package/initramfs/lib/canvaskit/LICENSE +29 -0
  46. package/initramfs/lib/canvaskit/canvaskit.js +264 -0
  47. package/initramfs/lib/canvaskit/canvaskit.wasm +0 -0
  48. package/initramfs/lib/dlopen.js +14 -11
  49. package/initramfs/lib/document.js +6 -0
  50. package/initramfs/lib/fbdev.js +581 -0
  51. package/initramfs/lib/power.js +35 -0
  52. package/initramfs/lib/xterm/LICENSE +21 -0
  53. package/initramfs/lib/xterm/addon-unicode-graphemes.mjs +44 -0
  54. package/initramfs/lib/xterm/xterm-headless.mjs +46 -0
  55. package/initramfs/usr/share/doc/buninu-linux/bunterm.md +83 -0
  56. package/initramfs/usr/share/doc/buninu-linux/canvas.md +91 -0
  57. package/initramfs/usr/share/doc/buninu-linux/fbdev.md +113 -0
  58. package/initramfs/usr/share/doc/buninu-linux/ps.md +94 -0
  59. package/initramfs/usr/share/doc/buninu-linux/reboot.md +15 -0
  60. package/initramfs/usr/share/doc/buninu-linux/tar.md +73 -0
  61. package/initramfs/usr/share/doc/buninu-linux/top.md +23 -0
  62. package/initramfs/usr/share/fonts/DejaVuSansMono-Bold.ttf +0 -0
  63. package/initramfs/usr/share/fonts/DejaVuSansMono.ttf +0 -0
  64. package/initramfs/usr/share/fonts/LICENSE-Apache-2.0.txt +202 -0
  65. package/initramfs/usr/share/fonts/LICENSE-DejaVu.txt +44 -0
  66. package/initramfs/usr/share/fonts/LICENSE-OFL-1.1.txt +91 -0
  67. package/initramfs/usr/share/fonts/NotoColorEmoji.ttf +0 -0
  68. package/initramfs/usr/share/fonts/NotoColorEmojiFlags.ttf +0 -0
  69. package/initramfs/usr/share/fonts/NotoSansCJK-Regular.ttc +0 -0
  70. package/initramfs/usr/share/fonts/NotoSansSymbols-Regular-Subsetted.ttf +0 -0
  71. package/initramfs/usr/share/fonts/NotoSansSymbols-Regular-Subsetted2.ttf +0 -0
  72. package/initramfs/usr/share/fonts/Roboto-Regular.ttf +0 -0
  73. package/initramfs/usr/share/fonts/fonts.json +28 -0
  74. package/package.json +2 -2
  75. package/run-qemu.sh +1 -1
@@ -0,0 +1,83 @@
1
+ # bunterm — a graphical terminal on the Linux framebuffer
2
+
3
+ `bunterm` runs a program on a pseudo-terminal and draws its screen on
4
+ `/dev/fb0` with Skia (CanvasKit), so a real Linux console gets an
5
+ xterm-compatible terminal with anti-aliased text, CJK, colour emoji, seamless
6
+ box drawing and kitty graphics protocol images — no X11, Wayland or GPU.
7
+
8
+ ```sh
9
+ bunterm # run /bin/sh on the console you are on
10
+ bunterm /dev/tty1 # use virtual console 1 for graphics and keys
11
+ bunterm --font-size 20
12
+ bunterm -e bun /buninu/apps/jsmdcui/src/index.js --demo
13
+ bunterm -h
14
+ ```
15
+
16
+ The program's `TERM` is `xterm-256color`, `COLORTERM=truecolor`,
17
+ `TERM_PROGRAM=bunterm` and `JSMDCUI_KITTY_MODE=extended` (so `jsmdcui` shows
18
+ Markdown images without `--kitty`). When it exits, the console returns to
19
+ text mode and `bunterm` exits with its status.
20
+
21
+ ## Options
22
+
23
+ | Option | Meaning |
24
+ | --- | --- |
25
+ | `/dev/ttyN` | The virtual console to use for graphics and the keyboard. If another console is on screen, the display switches to this one first and back when `bunterm` exits. Without it the process's own console and stdin are used, so run it from a VT (not a serial line or a PTY). |
26
+ | `-e command [argument...]` | The program to run; everything after `-e` belongs to it. Default `/bin/sh`. |
27
+ | `--font-size N` | Font size in pixels (default 16). The cell is 0.6 × N wide and 1.16 × N tall with DejaVu Sans Mono, so 1024×768 at 16 px gives 106 × 41 cells. |
28
+ | `--line-height F` | Multiplies the cell height (default 1). |
29
+ | `--fb /dev/fbN` | The framebuffer device (default `/dev/fb0`). |
30
+ | `--no-blink` | A steady cursor. |
31
+
32
+ ## What is drawn
33
+
34
+ - **Text** comes from `/usr/share/fonts`: DejaVu Sans Mono (regular and
35
+ bold) sets the grid; Noto Sans CJK TC, Noto Color Emoji (+ Flags) and Noto
36
+ Sans Symbols fill in what it lacks. A glyph is centred in the one or two
37
+ cells the terminal assigned it; wide characters take two.
38
+ - **Box drawing, block elements, shades and Powerline symbols** (U+2500–259F,
39
+ U+E0A0–E0BF, U+1FB70–1FB97) are drawn as vectors, ported from xterm.js, so
40
+ they join without seams at any size.
41
+ - **Attributes**: 16 / 256 / 24-bit colours, bold (brighter for the eight base
42
+ colours), italic, dim, underline, strikethrough, inverse, invisible.
43
+ - **Grapheme clusters** such as 🇹🇼 and 👨‍👩‍👧 occupy one cell each (xterm.js's
44
+ unicode-graphemes addon) and are shaped by Skia's paragraph engine.
45
+ - **Images**: the kitty graphics protocol (`ESC _ G … ESC \`) with direct
46
+ transmission (`t=d`), PNG (`f=100`) or raw RGB/RGBA (`f=24`/`32`), zlib
47
+ (`o=z`), chunking (`m=`), cropping (`x,y,w,h`), sizing in cells (`c,r`),
48
+ cell offsets (`X,Y`), placements (`p=`), deletion (`a=d`) and queries
49
+ (`a=q`). An image is anchored to its line and scrolls with the text; on the
50
+ alternate screen it stays at its row and is removed when the program
51
+ leaves that screen. Any encoding Skia decodes (PNG, JPEG, WebP, GIF) is
52
+ accepted under `f=100`, as with jsgotty's `U=` extension.
53
+
54
+ ## Keyboard
55
+
56
+ The console stays in the kernel's translated keyboard mode, so
57
+ `Ctrl-Alt-F2` and friends still switch consoles; coming back repaints the
58
+ screen. A few console-specific
59
+ sequences are rewritten to xterm's (`F1`–`F5`, `Home`, `End`), and arrow keys
60
+ follow the program's application cursor mode.
61
+
62
+ ## Limits
63
+
64
+ - Needs a framebuffer: `linux-lts` has one built in, while the default
65
+ `linux-virt` builds it as modules the image does not ship, so build with
66
+ `--linux-lts` or `--real` (efifb/simpledrm from UEFI).
67
+ - No mouse, no selection, no scrollback viewing (the buffer keeps 1000
68
+ lines for programs that query it).
69
+ - A program that prints a terminal reply while the tty echoes (that is, one
70
+ not in raw mode) will see the reply echoed, as on any terminal.
71
+ - Kitty images are drawn above text; `z` ordering below text and animation
72
+ frames are not implemented, and file transmission (`t=f`/`t=t`) works only
73
+ for files under `/tmp`, `/dev/shm` or `$TMPDIR`.
74
+ - One framebuffer, one session. For panes and tabs run `jsmdcui` inside it.
75
+
76
+ ## See also
77
+
78
+ - `/lib/bunterm/terminal.js` — `createSession()` and `runTerminal()`, the
79
+ pieces `bunterm` is built from
80
+ - `/lib/canvas.js` — CanvasKit on the framebuffer (`canvas.md`)
81
+ - `/lib/fbdev.js` — the framebuffer itself (`fbdev.md`)
82
+ - `/buninu/apps/jsgotty/gotty.js` — the PTY backend and kitty packet parser
83
+ that are reused
@@ -0,0 +1,91 @@
1
+ # canvas — CanvasKit (Skia) on the Linux framebuffer
2
+
3
+ `/lib/canvas.js` runs Skia, compiled to WebAssembly as CanvasKit, on top of
4
+ `/lib/fbdev.js`. Skia rasterizes straight into a buffer that already has the
5
+ framebuffer's pixel layout, so a frame reaches `/dev/fb0` with one `memcpy`
6
+ and no per-pixel conversion in JavaScript.
7
+
8
+ ## Drawing with Skia
9
+
10
+ ```js
11
+ import { runGraphics } from "/lib/fbdev.js";
12
+ import { loadCanvasKit, openCanvas, loadFontSet } from "/lib/canvas.js";
13
+
14
+ const CanvasKit = await loadCanvasKit();
15
+ const fonts = loadFontSet(CanvasKit, "ui");
16
+
17
+ await runGraphics(async (display, { onRestore }) => {
18
+ const screen = openCanvas(CanvasKit, display);
19
+ const paint = new CanvasKit.Paint();
20
+ paint.setAntiAlias(true);
21
+ paint.setColor(CanvasKit.Color(64, 200, 255));
22
+ const font = new CanvasKit.Font(fonts.regular, 32);
23
+
24
+ screen.canvas.clear(CanvasKit.BLACK);
25
+ screen.canvas.drawCircle(display.width / 2, display.height / 2, 120, paint);
26
+ screen.canvas.drawText("Buninu 你好 😀", 40, 60, paint, font);
27
+ screen.flush();
28
+
29
+ await new Promise((resolve) => setTimeout(resolve, 3000));
30
+ screen.close();
31
+ });
32
+ ```
33
+
34
+ `screen.canvas` is a Skia `Canvas` with the full CanvasKit API: paths,
35
+ gradients, shaders, image filters, `drawImage`, `drawGlyphs`, `Paragraph`
36
+ layout with font fallback, PNG/JPEG decoding, and so on.
37
+
38
+ ## Exports
39
+
40
+ | Export | Purpose |
41
+ | --- | --- |
42
+ | `loadCanvasKit()` | Loads `/lib/canvaskit/canvaskit.wasm` once per process and resolves to the `CanvasKit` object. The wasm heap starts at 128 MiB. |
43
+ | `openCanvas(CanvasKit, display)` | Binds a raster surface to an open `Framebuffer`. Returns `{ canvas, surface, width, height, colorType, flush(), close() }`. While open, `display.pixels` is the surface's own memory, so `drawLine()`, `fillPolygon()` and `flush()` from `fbdev.js` keep working on the same frame. `close()` hands the last frame back to the JavaScript buffer. |
44
+ | `pickColorType(CanvasKit, display)` | The Skia `ColorType` matching the framebuffer: `BGRA_8888` for the usual 32-bit XRGB (efifb, simpledrm), `RGBA_8888`, `RGB_565`; `null` for anything else, which `openCanvas` rejects. |
45
+ | `loadFontSet(CanvasKit, name)` | A font set from `/usr/share/fonts/fonts.json` (`"terminal"` or `"ui"`) as `{ regular, bold, fallback, typefaces, fontMgr, families, delete() }`. `fontMgr` and `families` are what `ParagraphStyle` wants; a collection such as Noto Sans CJK registers every face and yields its preferred one (TC). |
46
+ | `fontCatalogue()`, `fontPath(name)`, `loadFontData(name)` | The parsed `fonts.json`, a font's path, and its bytes (cached). |
47
+
48
+ ## Formats
49
+
50
+ The framebuffer reports its channels as bit offsets. Skia can rasterize
51
+ directly into three of the layouts Linux uses:
52
+
53
+ | Framebuffer | Skia |
54
+ | --- | --- |
55
+ | 32 bpp, red@16 green@8 blue@0 (XRGB8888) | `BGRA_8888` |
56
+ | 32 bpp, red@0 green@8 blue@16 (XBGR8888) | `RGBA_8888` |
57
+ | 16 bpp, 5-6-5 | `RGB_565` |
58
+
59
+ For a 24 bpp or paletted framebuffer, draw with the HTML canvas emulation
60
+ instead and copy through `blitImageData()`:
61
+
62
+ ```js
63
+ const canvas = CanvasKit.MakeCanvas(display.width, display.height);
64
+ const ctx = canvas.getContext("2d");
65
+ ctx.fillStyle = "#40c8ff";
66
+ ctx.fillRect(0, 0, 200, 100);
67
+ blitImageData(display, ctx.getImageData(0, 0, display.width, display.height));
68
+ flush(display);
69
+ ```
70
+
71
+ That path converts every pixel in JavaScript and is fine for static screens.
72
+
73
+ ## Fonts
74
+
75
+ `/usr/share/fonts/fonts.json` lists the bundled files and two sets:
76
+
77
+ | Set | Regular | Fallback order |
78
+ | --- | --- | --- |
79
+ | `terminal` | DejaVu Sans Mono (+ Bold) | Noto Color Emoji, Noto Color Emoji Flags, Noto Sans CJK, Noto Sans Symbols, Noto Sans Symbols2 |
80
+ | `ui` | Roboto | Noto Sans CJK, Noto Color Emoji, Noto Color Emoji Flags, Noto Sans Symbols, Noto Sans Symbols2 |
81
+
82
+ Files load on first use and are copied into the wasm heap; the CJK
83
+ collection is 32 MiB, so a program that never draws CJK text should not
84
+ load a set containing it. Each file's license sits beside it.
85
+
86
+ ## See also
87
+
88
+ - `/lib/canvas.js`, `/lib/canvaskit/` (CanvasKit 0.41.1, BSD-3-Clause)
89
+ - `/lib/fbdev.js` — `fbdev.md`
90
+ - `/lib/bunterm/` — the terminal built on this (`bunterm.md`)
91
+ - CanvasKit API: https://skia.org/docs/user/modules/canvaskit/
@@ -0,0 +1,113 @@
1
+ # fbdev — draw directly on the Linux framebuffer
2
+
3
+ `/lib/fbdev.js` is both an importable drawing module and a small executable
4
+ demo. It uses `/dev/fb0`, framebuffer ioctls, a shared `mmap`, and `KDSETMODE`
5
+ through Bun FFI; it does not require X11, Wayland, SDL, or a window manager.
6
+
7
+ ## Demo
8
+
9
+ Run it on Buninu's physical Linux console:
10
+
11
+ ```sh
12
+ bun /lib/fbdev.js
13
+ ```
14
+
15
+ The demo switches the active console to graphics mode, clears the framebuffer,
16
+ draws a cyan triangle, and waits. Press any key to restore text mode and exit.
17
+ Ordinary failures, direct process exit, `SIGHUP`, `SIGINT`, `SIGQUIT`, and
18
+ `SIGTERM` also restore the prior keyboard raw state and attempt to return the
19
+ console to text mode.
20
+
21
+ Each repeatable `-p`/`--points` supplies one polygon as x,y coordinate pairs:
22
+
23
+ ```sh
24
+ bun /lib/fbdev.js -p '100,50 40,250 300,250'
25
+ bun /lib/fbdev.js \
26
+ -p '100,50 40,250 300,250' \
27
+ -p '400,80 350,220 450,220'
28
+ ```
29
+
30
+ Every occurrence draws a separate filled polygon. Comma and whitespace
31
+ separators may be mixed inside its quoted value; the clearest form uses a
32
+ comma within each `x,y` point and spaces between points. If one polygon
33
+ contains an odd number of numeric values, its final unpaired value is ignored.
34
+ A `-p` containing only one number is therefore ignored as a whole. Each
35
+ non-empty polygon needs at least three complete points; more than three points
36
+ remain one polygon rather than starting another. If no drawable `-p` remains,
37
+ the demo draws its default triangle.
38
+
39
+ ## JavaScript API
40
+
41
+ ```js
42
+ import {
43
+ openFramebuffer,
44
+ clear,
45
+ drawPoint,
46
+ drawLine,
47
+ drawLines,
48
+ fillPolygon,
49
+ flush,
50
+ } from "/lib/fbdev.js";
51
+
52
+ const display = openFramebuffer();
53
+ try {
54
+ clear(display);
55
+ fillPolygon(display, [[100, 50], [40, 250], [300, 250]], {
56
+ r: 64, g: 200, b: 255, a: 255,
57
+ });
58
+ drawLine(display, 0, 0, display.width - 1, display.height - 1, {
59
+ r: 255, g: 255, b: 255,
60
+ });
61
+ flush(display);
62
+ } finally {
63
+ display.close();
64
+ }
65
+ ```
66
+
67
+ The API uses short drawing names because it operates on a framebuffer rather
68
+ than an X11 `Display`. Colours are `{ r, g, b, a }` objects.
69
+
70
+ ### Export reference
71
+
72
+ | Export | Purpose |
73
+ | --- | --- |
74
+ | `Framebuffer`, `openFramebuffer(path?)` | Open and describe a packed-pixel framebuffer. |
75
+ | `normalizePoints(values)` | Accept flat numbers, `[x,y]` arrays, or `{x,y}` objects. An unpaired flat value is ignored. |
76
+ | `parsePoints(strings)` | Parse comma/whitespace-separated CLI-style coordinates. |
77
+ | `drawPoint(display, x, y, color?)` | Draw one clipped pixel. |
78
+ | `drawLine(display, x1, y1, x2, y2, color?)` | Draw a clipped Bresenham line. |
79
+ | `drawLines(display, points, color?, close?)` | Join a sequence of points. |
80
+ | `fillPolygon(display, points, color?)` | Fill a polygon with the even-odd scanline rule. |
81
+ | `clear(display, color?)` | Fill the in-memory frame, black by default. |
82
+ | `flush(display)` | Copy the in-memory frame to the shared `/dev/fb0` mapping and synchronize it. |
83
+ | `blitImageData(display, imageData, x?, y?)` | Copy an RGBA `ImageData` (for example from CanvasKit's HTML canvas emulation) into the frame, converting to the framebuffer's format and clipping. |
84
+ | `openConsole`, `setConsoleGraphics`, `setConsoleText` | Explicit Linux virtual-console control for callers that need it. |
85
+ | `activeConsole(console)`, `activateConsole(console, n)`, `consoleNumber(path)` | `VT_GETSTATE` / `VT_ACTIVATE` + `VT_WAITACTIVE`, and the number in a `/dev/ttyN` path. |
86
+ | `watchConsoleSwitches(console, onAcquire)` | `VT_SETMODE` with `VT_PROCESS`: answers the kernel's switch-away and switch-back signals and calls `onAcquire` when the display returns. Returns a function restoring automatic switching. |
87
+ | `runGraphics(draw, { device, console, switchConsole }?)` | Open the framebuffer, put the console in graphics mode, run `await draw(display, { console, onRestore, onAcquire })`, and restore text mode however the call ends (return, throw, `process.exit()`, `SIGHUP`/`SIGINT`/`SIGQUIT`/`SIGTERM`). `console` lists console devices to try, such as `["/dev/tty1"]`; when the one opened is a `/dev/ttyN` other than the console on screen, the display is switched to it first and back afterwards (`switchConsole: false` disables this). Console switches with Ctrl-Alt-Fn keep working; `onAcquire(callback)` runs when the display comes back so the caller can repaint, and `onRestore(callback)` registers cleanup to run before text mode returns. |
88
+ | `runDemo({ polygons, device }?)` | Run the CLI demo through `runGraphics()`. Each item in `polygons` is drawn separately. |
89
+
90
+ The module supports 16-, 24-, and 32-bit packed-pixel framebuffers and uses
91
+ the kernel-reported stride, offsets, and RGB bitfields. Paletted and unusual
92
+ non-packed framebuffer formats are rejected rather than drawn incorrectly.
93
+
94
+ ## Operational limits
95
+
96
+ - Run the demo from a real Linux virtual console. A PTY, serial console, SSH
97
+ session, or terminal pane cannot accept `KDSETMODE`.
98
+ - The framebuffer device and active virtual console must be accessible to the
99
+ process; Buninu normally runs as root.
100
+ - Imported drawing calls modify an in-memory frame until `flush()` is called.
101
+ - Importing the module does not switch console mode. Only `runDemo()` or an
102
+ explicit `setConsoleGraphics()` call does so.
103
+ - No userspace cleanup can run after `SIGKILL`, a kernel panic, power loss, or
104
+ a native runtime crash. If one leaves the virtual console in graphics mode,
105
+ switch to another VT or reboot to recover it.
106
+
107
+ ## See also
108
+
109
+ - Source: `/lib/fbdev.js`
110
+ - Shared native binding: `/lib/dlopen.js`
111
+ - Skia on this framebuffer: `/lib/canvas.js` (`canvas.md`); the terminal
112
+ built on both: `bunterm`
113
+ - Linux UAPI: `linux/fb.h` and `linux/kd.h`
@@ -0,0 +1,94 @@
1
+ # ps — list processes
2
+
3
+ `/bin/ps` is a small Bun script that reads `/proc`. Its primary interface is
4
+ the full-command-line table consumed by bunmsh's `pspa` and coloured `pspac`
5
+ builtins.
6
+
7
+ The file is also an importable module. It exports `readProcessSnapshot()`,
8
+ `prepareProcessFormat()`, `formatProcessHeader()`, and
9
+ `formatProcessLine()`. `/bin/top` uses these exports, so process discovery and
10
+ single-row formatting have one implementation.
11
+
12
+ ## Synopsis
13
+
14
+ ```sh
15
+ ps
16
+ ps -e | -A [-o pid,args]
17
+ ps -eo pid,args
18
+ ps -ef | ps aux | ps ax
19
+ ps -h | --help # this page
20
+ ```
21
+
22
+ ## Options
23
+
24
+ | Option | Meaning |
25
+ |---|---|
26
+ | `-e`, `-A`, `--all` | List every process instead of the default same-UID/same-TTY selection. |
27
+ | `-o FIELDS` | Select and order comma- or space-separated output fields. See below. |
28
+ | `-ef` | Full Unix view: UID, PID/PPID, CPU, start, TTY, accumulated time, and command. |
29
+ | `-eF` | Extra-full Unix view, adding `SZ`, `RSS`, and current processor (`PSR`). |
30
+ | `aux`, `-aux` | BSD view with user, CPU/memory percentages, VSZ/RSS, TTY, state, start, time, and command. |
31
+ | `ax`, `-ax` | Compact BSD view with PID, TTY, state, time, and command. |
32
+ | `-h`, `--help` | Render this page. |
33
+
34
+ `-e` and `-o` may be combined as `-eo pid,args`, which is the form bunmsh
35
+ uses. Rows are sorted numerically by PID. A process with an empty cmdline is
36
+ shown using its `/proc/PID/comm` name in brackets, as for a kernel thread.
37
+ With no `-o` or extended view, the standard columns are `PID TTY TIME CMD`,
38
+ and `CMD` is the short process name. The default selection is the caller's
39
+ effective UID and terminal, excluding session leaders. `-e`/`-A` selects all;
40
+ `a`, `x`, `-a`, and `-x` apply their usual BSD or Unix selection rules.
41
+
42
+ Plain `ps` excludes processes carrying Linux's `PF_KTHREAD` flag. This matters
43
+ on boot consoles where the shell and kernel threads may all be UID 0 without a
44
+ controlling TTY. Explicit all-process forms such as `ps -e`, `ps -A`, and
45
+ `ps -eo ...` include kernel threads.
46
+
47
+ ### `-o` fields
48
+
49
+ Supported names are:
50
+
51
+ ```text
52
+ pid ppid uid user euser comm args cmd command tty tt stat state c
53
+ %cpu pcpu %mem pmem vsz rss sz time etime etimes
54
+ start stime lstart ni nice pri psr
55
+ ```
56
+
57
+ They may be combined and reordered, for example:
58
+
59
+ ```sh
60
+ ps -eo pid,ppid,user,comm
61
+ ps -eo pid,stat,%cpu,%mem,rss,args
62
+ ps -o pid,tty,time,comm
63
+ ```
64
+
65
+ `comm` is the kernel's short process name; `args` is the complete command
66
+ line. The exact `pid,args` layout remains the interface consumed by bunmsh.
67
+
68
+ ## Examples
69
+
70
+ ```sh
71
+ ps
72
+ ps -eo pid,args
73
+ ps -ef # common LLM/tutorial spelling
74
+ ps aux
75
+ pspac # bunmsh: the same table with syntax colours
76
+ ```
77
+
78
+ ## Limits
79
+
80
+ Values come from `/proc/PID/stat`, `/proc/PID/status`, `/proc/uptime`, and
81
+ `/proc/meminfo`; user names come from `/etc/passwd`. CPU percentages are the
82
+ process's average since it started, and memory percentage is resident memory
83
+ over `MemTotal`. Forest display, custom column headings, and less common
84
+ procps fields remain outside this minimal command. `/proc` must be mounted.
85
+
86
+ ## Exit status
87
+
88
+ `0` success, `1` bad usage or `/proc` could not be read.
89
+
90
+ ## See also
91
+
92
+ - `ip --help`
93
+ - Source: `initramfs/bin/ps` in
94
+ [buninu-linux](https://github.com/jjtseng93/buninu-linux)
@@ -0,0 +1,15 @@
1
+ # reboot — restart Buninu Linux
2
+
3
+ `reboot` flushes pending filesystem writes with `sync(2)`, then requests
4
+ `LINUX_REBOOT_CMD_RESTART` through Linux `reboot(2)`. It shares its
5
+ implementation with `poweroff` and does not invoke a service manager.
6
+
7
+ ## Usage
8
+
9
+ ```sh
10
+ reboot
11
+ reboot --help
12
+ ```
13
+
14
+ The caller needs the kernel's `CAP_SYS_BOOT` capability. Buninu's root shell
15
+ has it; otherwise the command reports `Operation not permitted` and exits.
@@ -0,0 +1,73 @@
1
+ # tar — create and extract archives
2
+
3
+ `/bin/tar` is a small Bun script over `Bun.Archive`. It handles uncompressed
4
+ tar archives plus gzip and zstd without invoking another program.
5
+
6
+ ## Synopsis
7
+
8
+ ```sh
9
+ tar -cf ARCHIVE FILE...
10
+ tar -czf ARCHIVE FILE...
11
+ tar --zstd -cf ARCHIVE FILE...
12
+ tar -xf ARCHIVE [-C DIR] [MEMBER...]
13
+ tar -tf ARCHIVE [MEMBER...]
14
+ tar -h | --help # this page
15
+ ```
16
+
17
+ Use `-` as ARCHIVE to read from standard input or write to standard output.
18
+
19
+ ## Options
20
+
21
+ | Option | Meaning |
22
+ |---|---|
23
+ | `-c` | Create an archive. |
24
+ | `-x` | Extract an archive. |
25
+ | `-t` | List archive members. |
26
+ | `-f ARCHIVE`, `--file=ARCHIVE` | Archive file, or `-` for standard input/output. |
27
+ | `-C DIR`, `--directory=DIR` | Read input files from DIR, or extract into DIR. |
28
+ | `-z`, `--gzip` | Create gzip-compressed tar, or explicitly identify gzip input. |
29
+ | `--zstd` | Create or read a zstd-compressed tar. A `.zst` or `.tzst` input is also detected by name. |
30
+ | `-v` | Print names while creating/extracting; with `-t`, also show each regular file's size and modification time. |
31
+
32
+ Short options can be combined, for example `-xzvf` or `-czf`.
33
+ For the traditional first option word, the leading hyphen is optional, so
34
+ `tar tf`, `tar xf`, and `tar cf` are equivalent to `tar -tf`, `tar -xf`, and
35
+ `tar -cf`.
36
+
37
+ ## Examples
38
+
39
+ ```sh
40
+ tar -czf source.tar.gz src README.md
41
+ tar -xzf source.tar.gz -C /tmp/source
42
+ tar -tf source.tar.gz
43
+ tar --zstd -cf backup.tar.zst home
44
+ tar --zstd -xf backup.tar.zst -C /mnt/restore
45
+ ```
46
+
47
+ ## Current Bun.Archive limits
48
+
49
+ Creation stores regular files only. Symbolic links are rejected rather than
50
+ silently archived as the wrong type; modes, ownership, hard links, and empty
51
+ directories are not preserved. Bun 1.4.3 also requires file contents to be
52
+ materialized in memory before archive creation.
53
+
54
+ Extraction restores directories and symbolic links, but Bun 1.4.3 skips hard
55
+ links. Listing and verbose extraction use `Archive.files()`, so they report
56
+ regular files only. Verbose listing can show their size and modification time,
57
+ but not the unavailable mode or owner. Bun provides gzip and zstd codecs but no xz or bzip2 codec,
58
+ so this command does not accept `.tar.xz` or `.tar.bz2`.
59
+
60
+ Appending with `-r`/`rvf` is not supported. `Bun.Archive` has no append API;
61
+ rebuilding an existing archive through `Archive.files()` would silently lose
62
+ its directories, links, ownership, and modes, so this command refuses instead.
63
+
64
+ ## Exit status
65
+
66
+ `0` success, `2` bad usage or an archive/file operation failed.
67
+
68
+ ## See also
69
+
70
+ - [Bun.Archive](https://bun.com/docs/runtime/archive)
71
+ - [tar(1)](https://man7.org/linux/man-pages/man1/tar.1.html)
72
+ - Source: `initramfs/bin/tar` in
73
+ [buninu-linux](https://github.com/jjtseng93/buninu-linux)
@@ -0,0 +1,23 @@
1
+ # top
2
+
3
+ `top` periodically reads the process snapshot exported by `/bin/ps`. Process
4
+ discovery and row formatting are shared with `ps`; `top` only calculates CPU
5
+ changes between refreshes, sorts rows, and redraws the screen.
6
+
7
+ ## Usage
8
+
9
+ ```sh
10
+ top
11
+ top -d 1
12
+ top -b -n 1
13
+ ```
14
+
15
+ - `-d SECONDS` sets the refresh interval (default: 3).
16
+ - `-n COUNT` exits after that many snapshots.
17
+ - `-b` uses batch output without terminal control sequences.
18
+ - `-h`, `--help` displays this document.
19
+
20
+ While running interactively, press `q` to quit, `P` to sort by CPU, `M` to
21
+ sort by memory, or `N` to sort by PID. The first screen shows the lifetime CPU
22
+ average available from `ps`; later screens show usage during the refresh
23
+ interval.