{
  "version": "0.9.0",
  "groups": [
    {
      "name": "files",
      "commands": [
        {
          "name": "ld",
          "usage": "ld [path]",
          "about": "Lists the directory at [path], the current directory if none is given. Directories end with /. On file systems with owners (ext2) the mode bits and owner:group follow, and where a symbolic link points.",
          "builtin": false
        },
        {
          "name": "cd",
          "usage": "cd [dir]",
          "about": "Changes the current directory, to your home (~) without [dir].",
          "builtin": true
        },
        {
          "name": "read",
          "usage": "read <path>",
          "about": "Prints the contents of the file at <path>.",
          "builtin": false
        },
        {
          "name": "write",
          "usage": "write <file>",
          "about": "Full-screen editor for the text file <file>. Arrow keys, Home/End and Page Up/Down move the cursor, typing inserts, Backspace/Delete remove. Ctrl+S saves and exits, Esc exits without saving. Create the file first with 'create <file>'.",
          "builtin": false
        },
        {
          "name": "reydit",
          "usage": "reydit <file>...",
          "about": "Modal editor like vi. Normal mode: h j k l / arrows, w b e, 0 ^ $, gg G move (with a count, e.g. 3j); x, dd, D, yy, p P; d, c, y with a motion (dw, c$, y3j); i a I A o O insert; v selects (then d, x, c, y); u undoes, Ctrl+R redoes; / and ? search, n N repeat. Insert mode: type, Esc back. :w saves, :q quits, :wq or :x both, :q! quits without saving; :e <file> opens another file, :bn :bp switch, :ls lists, :bd closes. Rust, C and Markdown files are colored (:syntax off stops it). Files are created on the first :w. F1 or :help shows the keys.",
          "builtin": false
        },
        {
          "name": "create",
          "usage": "create <path>",
          "about": "Creates an empty file at <path>, or a directory if <path> ends with /. Names can be up to 64 characters long and keep their case.",
          "builtin": false
        },
        {
          "name": "copy",
          "usage": "copy <from> <to>",
          "about": "Copies the file <from> to <to>, or into <to> if it is a directory. An existing <to> is replaced, once the copy is complete.",
          "builtin": false
        },
        {
          "name": "rename",
          "usage": "rename <path> <new name>",
          "about": "Renames the file or directory at <path> to <new name> in the same directory. Quote names with spaces: rename \"Meeting notes.txt\" meeting.txt",
          "builtin": false
        },
        {
          "name": "delete",
          "usage": "delete <path>",
          "about": "Deletes the file or empty directory at <path> after asking for confirmation (y). Names with spaces may be quoted. There is no undo.",
          "builtin": false
        },
        {
          "name": "link",
          "usage": "link <target> <path>",
          "about": "Creates a symbolic link at <path> that points to <target>: relative to the link's directory, or absolute within the link's file system. Only on file systems that have links (ext2, not FAT).",
          "builtin": false
        }
      ]
    },
    {
      "name": "shell",
      "commands": [
        {
          "name": "help",
          "usage": "help",
          "about": "Lists all commands: the programs in the directories of PATH (see 'set'). Run '<command> -h' for details on one.",
          "builtin": false
        },
        {
          "name": "echo",
          "usage": "echo [text]",
          "about": "Prints [text] followed by a new line.",
          "builtin": false
        },
        {
          "name": "find",
          "usage": "find <text>",
          "about": "Prints the lines of its input that contain <text>, ignoring case. Meant behind a pipe, e.g. 'ld /apps | find re'; without one it reads typed lines until Ctrl+D. Exits with 1 if no line matched.",
          "builtin": false
        },
        {
          "name": "count",
          "usage": "count",
          "about": "Counts the lines of its input, e.g. 'ld /apps | count'; without a pipe it counts typed lines until Ctrl+D.",
          "builtin": false
        },
        {
          "name": "time",
          "usage": "time <program> [args]",
          "about": "Runs <program> with [args], then shows how long it took and its exit code.",
          "builtin": false
        },
        {
          "name": "set",
          "usage": "set [NAME [value]]",
          "about": "Lists the environment variables, shows one, or sets one for this shell and the programs it starts. PATH lists where programs are looked for (':' between directories). /user/environment.txt sets them for every new shell (NAME=value lines).",
          "builtin": true
        },
        {
          "name": "unset",
          "usage": "unset NAME",
          "about": "Removes an environment variable of this shell.",
          "builtin": true
        },
        {
          "name": "clear",
          "usage": "clear",
          "about": "Clears the screen.",
          "builtin": false
        },
        {
          "name": "session",
          "usage": "session save|restore|forget",
          "about": "Sessions: 'save' keeps all tabs and panes with each pane's directory and running program (in /user/session.txt), and ReyaOS brings them back at every boot. 'restore' opens them now, after the current tabs. 'forget' deletes the saved session, so the next boot starts with one pane again.",
          "builtin": false
        }
      ]
    },
    {
      "name": "users",
      "commands": [
        {
          "name": "switch",
          "usage": "switch <user>",
          "about": "Asks for <user>'s password, then this shell runs as <user>: in their home, with a new environment (USER and HOME set), and so do the programs it starts. 'exit' goes back.",
          "builtin": true
        },
        {
          "name": "exit",
          "usage": "exit",
          "about": "Ends the latest 'switch': this shell runs as the user it was before, in their directory and environment.",
          "builtin": true
        },
        {
          "name": "adm",
          "usage": "adm <command>",
          "about": "Runs <command> (a program or a pipeline) as root after asking for your own password; for 5 minutes after it this pane doesn't ask again. Only members of the group admin in /system/groups may.",
          "builtin": true
        },
        {
          "name": "passwd",
          "usage": "passwd [name]",
          "about": "Changes your password after asking for the current one. Root (through adm) sets anyone's, without the current one: adm passwd <name>.",
          "builtin": false
        },
        {
          "name": "adduser",
          "usage": "adduser <name>",
          "about": "Adds the user <name> with the next free id from 1000, a group of their own and a home in /user/<name> only they may enter; asks for their password. Root's, through adm.",
          "builtin": false
        },
        {
          "name": "chmod",
          "usage": "chmod <mode> <path>",
          "about": "Sets the mode of <path>, in octal like 750: read 4, write 2, execute 1 for the owner, the group and everyone else. The owner and root may. Only on file systems that have modes (ext2, not FAT).",
          "builtin": false
        },
        {
          "name": "chown",
          "usage": "chown <user>[:<group>] <path>",
          "about": "Gives <path> to <user> and, if given, <group>; both by name or number. Root's, through adm. Only on file systems that have owners (ext2, not FAT).",
          "builtin": false
        }
      ]
    },
    {
      "name": "system",
      "commands": [
        {
          "name": "ps",
          "usage": "ps",
          "about": "Lists all threads with their id, user, name and state. Use 'kill <id>' to stop one.",
          "builtin": false
        },
        {
          "name": "kill",
          "usage": "kill <id>",
          "about": "Stops the thread with <id> (see 'ps'). Thread 0, the shell, can't be stopped.",
          "builtin": false
        },
        {
          "name": "mem",
          "usage": "mem",
          "about": "Shows usable RAM and the state of the kernel heap.",
          "builtin": false
        },
        {
          "name": "uptime",
          "usage": "uptime",
          "about": "Shows the time since boot in seconds.",
          "builtin": false
        },
        {
          "name": "date",
          "usage": "date",
          "about": "Prints the date and time from the machine's real-time clock, in the time zone of /system/timezone.txt (a POSIX TZ rule, e.g. CET-1CEST,M3.5.0,M10.5.0/3 for Germany).",
          "builtin": false
        },
        {
          "name": "disks",
          "usage": "disks",
          "about": "Lists the disks ReyaOS can reach (SATA, NVMe) with size and model. \"in use\" marks disks with a mounted file system, which install won't touch.",
          "builtin": false
        },
        {
          "name": "lspci",
          "usage": "lspci",
          "about": "Lists the PCI devices: bus:slot.function, vendor:device id and what kind of device it is.",
          "builtin": false
        },
        {
          "name": "dmesg",
          "usage": "dmesg",
          "about": "Shows the kernel log: the boot messages and the network's lines (DHCP, router).",
          "builtin": false
        }
      ]
    },
    {
      "name": "network",
      "commands": [
        {
          "name": "get",
          "usage": "get <url> [file]",
          "about": "Downloads <url> (http://<address or name>[:port]/<path>; no https) and saves it as [file], or prints it. Shows the status, the size and the SHA-256. [file] only changes once the download is complete. Ctrl+C stops it.",
          "builtin": false
        },
        {
          "name": "host",
          "usage": "host <name>",
          "about": "Looks up the IPv4 address of <name> through the DNS server the network named (DHCP).",
          "builtin": false
        },
        {
          "name": "tcp",
          "usage": "tcp <address> <port> [text]",
          "about": "Connects to <address>:<port> over TCP, sends [text] and a new line, and prints what comes back until the other side closes.",
          "builtin": false
        }
      ]
    },
    {
      "name": "updates and installing",
      "commands": [
        {
          "name": "fetch",
          "usage": "fetch [root]",
          "about": "Checks the update server for a newer ReyaOS and says what 'update' would change. [root] checks another installation, e.g. /ahci0p1 when booted from the USB stick; the result is stored there.",
          "builtin": false
        },
        {
          "name": "update",
          "usage": "update [root] | update --from <source> [root]",
          "about": "Installs the release 'fetch' found on the update server onto [root] (default: the running system), or with --from the system in <source>, e.g. 'update --from / /nvme0p1' from the USB stick. Replaced files are kept as <name>.old for 'rollback', edited ones stay and get the new version as <name>.new. Asks for confirmation (y).",
          "builtin": false
        },
        {
          "name": "verify",
          "usage": "verify [root]",
          "about": "Checks the system files against /system/manifest.txt (SHA-256) and lists the changed and missing ones. [root] checks another installation, e.g. /nvme0p1 when booted from the USB stick.",
          "builtin": false
        },
        {
          "name": "rollback",
          "usage": "rollback [root]",
          "about": "Restores the previous version: every <name>.old in /EFI/BOOT, /system and /apps (and their counterparts in /boot on an ext3 root) replaces <name>, files the update added are deleted. [root] rolls back another installation, e.g. /nvme0p2 from the USB stick when the new version doesn't boot. Asks for confirmation (y).",
          "builtin": false
        },
        {
          "name": "install",
          "usage": "install <disk>",
          "about": "Installs ReyaOS onto <disk> (see 'disks'). ERASES THE WHOLE DISK: writes a new GPT with a 128 MB EFI system partition (FAT32, the loaders and the kernel) and an ext3 root on the rest, plus BIOS boot code, and copies the running system onto them; it then boots on UEFI and BIOS machines. Asks you to type the disk name to confirm, then for root's password and the name and password of the first user (/system/users, homes in /user), who becomes an admin (/system/groups, see 'adm').",
          "builtin": false
        },
        {
          "name": "migrate",
          "usage": "migrate",
          "about": "Moves this installation from its single FAT32 partition onto a new ext3 root in the free space behind it (64 MB at least), without a reinstall: copies /system, /apps and /user over and checks them; the FAT32 partition keeps the loaders and the kernel and becomes /boot. Reboot afterwards. Run it again after booting from ext3 to remove the old copies from the EFI partition. Asks first (y).",
          "builtin": false
        }
      ]
    },
    {
      "name": "console",
      "commands": [
        {
          "name": "scale",
          "usage": "scale <n>|auto",
          "about": "Draws the console font n times as large (1 = 8x16 pixels per character), or picks the scale from the screen size with 'auto'; until the next boot. Capped so the terminal keeps at least 80x25 characters; text mode can't scale. To keep a scale, put it into /system/font-scale.txt.",
          "builtin": false
        },
        {
          "name": "size",
          "usage": "size",
          "about": "Prints the terminal's size and again whenever it changes. + and - change the font scale (on a framebuffer), which resizes the terminal; q quits.",
          "builtin": false
        },
        {
          "name": "keys",
          "usage": "keys",
          "about": "Shows the bytes each key sends, e.g. 'ESC [ A' for Up and 'ESC' for Esc: one line per key, escape sequences spelled out, control codes as ^X. q quits.",
          "builtin": false
        },
        {
          "name": "motd",
          "usage": "motd",
          "about": "Prints the message of the day from /system/motd.txt ({version} becomes the system's version; a line with it gives up leading spaces to stay within the widest line).",
          "builtin": false
        }
      ]
    },
    {
      "name": "power",
      "commands": [
        {
          "name": "reboot",
          "usage": "reboot",
          "about": "Restarts the machine.",
          "builtin": false
        },
        {
          "name": "shutdown",
          "usage": "shutdown",
          "about": "Powers the machine off (QEMU, Bochs and VirtualBox only so far).",
          "builtin": false
        }
      ]
    },
    {
      "name": "test programs",
      "commands": [
        {
          "name": "hello",
          "usage": "hello",
          "about": "Test program: greets three times, half a second apart. Try 'hello &' a few times.",
          "builtin": false
        },
        {
          "name": "spin",
          "usage": "spin",
          "about": "Test program: loops forever without syscalls, only preemption gets the CPU back. Stop it with Ctrl+C, or run 'spin &' and then 'kill <id>'.",
          "builtin": false
        },
        {
          "name": "evil",
          "usage": "evil",
          "about": "Test program: reads kernel memory, which must kill it with a page fault.",
          "builtin": false
        },
        {
          "name": "fstest",
          "usage": "fstest <dir> [seconds]",
          "about": "Stresses the file system under <dir> with random file, directory and link changes, forever or for [seconds], checking every file it finds against its name. Prints CORRUPT for any file that holds something else. For power-cut tests (test/power-cut.py), on a disk you can spare.",
          "builtin": false
        },
        {
          "name": "colors",
          "usage": "colors",
          "about": "Color test: the 16 standard colors, all 256 colors, 24-bit gradients, bold and inverse.",
          "builtin": false
        },
        {
          "name": "unicode",
          "usage": "unicode",
          "about": "Unicode test: umlauts, box drawing, Greek, Cyrillic, symbols and wide CJK characters, which take two cells each.",
          "builtin": false
        },
        {
          "name": "vt",
          "usage": "vt",
          "about": "Terminal test: moves the cursor, erases regions, scrolls a region and switches to the\nalternate screen and back, all with escape codes. Each screen says what it should\nshow; a key goes on.",
          "builtin": false
        },
        {
          "name": "traps",
          "usage": "traps",
          "about": "Test program: makes a system call with the trap flag set and one with a non-canonical pointer; both have to return.",
          "builtin": false
        }
      ]
    }
  ]
}
