# Command and tool list

The nosh toolset comprises these commands. See their manual pages for documentation.

## Script interpreters

The eponymous `nosh` is a minimal non-shell script interpreter, for use in `run` scripts (and elsewhere) where desired. Its operation is akin to that of Laurent Bercot's `execline`. The idea of it is to eliminate even the startup cost of the Almquist shell from service scripts (c.f. Debian's switch from the Bourne Again to the Almquist shell to reduce shell overhead in system scripts). `nosh` isn't a shell at all, does no parsing (only lexing), and incorporates most of the package's chain-loading tools as built-ins (to even eliminate the cost of `execve` and runtime library setup/teardown).

`exec` is, similarly, a simple tool for chain-loading.

## Commands for manipulating process state and then chain loading something else

### General process state

- `appendpath` — append a value to the end of a path-style environment variable, handling the separator characters for you

- `background` — run a child process asynchronously

- `chdir` — change working directory to a named directory

- `chdir` — change working directory to the home directory

- `chroot` — change root directory

- `clearenv` — clear the environment, selectively or totally

- `create-control-group` — create a given control group, absolute or relative to the current one

- `delegate-control-group-to` — delegate the current control group to an(other) account, preparatory to becoming that user with `setuidgid` or similar

- `envdir` — process a daemontools-style envdir to set/unset environment variables

- `envgid` — set `GID` and `GIDLIST` environment variable values from the system account database

- `envuidgid` — set `UID`, `GID`, and `GIDLIST` environment variable values from the system account database

- `fdmove` — copy/move file descriptors around

- `fdredir` — open file descriptors for reading, writing, append, and so forth

- `find-default-jvm` — find the `JAVA_HOME` for the default JVM

- `find-matching-jvm` — find the `JAVA_HOME` for a matching JVM

- `foreground` — run a child process synchronously, before continuing

- `getuidgid` — set the `UID`, `GID`, and `GIDLIST` environment variables from the effective UID+GID and supplementary groups of the process

- `hardlimit` — change hard resource limits

- `local-reaper` — set the local "Grim Reaper" status on/off

- `machineenv` — initialize "machine" environment variables such as `HOSTNAME`, `MACHINEID`, and `DOMAINNAME`

- `make-private-fs` — mount private filesystems in various places to hide the global filesystems from view

- `make-read-only-fs` — mount read-only filesystems in various places

- `move-to-control-group` — change into a given control group, absolute or relative to the current one

- `oom-kill-protect` — set the protection level against the kernel's Out Of Memory Killer

- `pipe` — run a child process asynchronously, connected to the current process's standard input or standard output via a pipe

- `prependpath` — prepend a value to the beginning of a path-style environment variable, handling the separator characters for you

- `read-conf` — process a BSD `rc.conf` style file to set environment variables

- `set-control-group-knob` — change a knob in the current control group

- `set-mount-object` — set the state of a mount object, in the process' mount namespace

- `setenv` — set an environment variable

- `setgid-fromenv` — set GID and supplementary groups from environment variables

- `setlock` — obtain an open file descriptor for a lock file

- `setlogin` — set the account name/user ID of the current login session, if permitted

- `setpgrp` — become a process group leader, if permitted

- `setsid` — become a session leader, if permitted

- `setuidgid-fromenv` — set UID, GID, and supplementary groups from environment variables

- `setuidgid` — set UID, GID, and supplementary groups from the system account database

- `softlimit` — change soft resource limits

- `time-env-add` — add an offset to a TAI64N time held in an environment variable

- `time-env-set` — set a TAI64N time held in an environment variable

- `time-env-set-if-earlier` — overwrite a TAI64N time held in an environment variable with another value if it is earlier

- `time-env-unset-if-earlier` — unset an environment variable if the TAI64N time held there is earlier than another value

- `time-env-unset-if-later` — unset an environment variable if the TAI64N time held there is later than another value

- `ulimit` — change soft or hard resource limits

- `umask` — change the umask

- `unsetenv` — unset an environment variable

- `unshare` — unshare Linux namespaces

- `userenv` — initialize "login" environment variables such as `HOME`, `SHELL`, `USER`, and `LOGNAME` based upon the effective UID+GID and supplementary groups of the process

- `userenv-fromenv` — initialize "login" environment variables such as `HOME`, `SHELL`, `USER`, and `LOGNAME` based upon the values of the `UID`, `GID`, `GIDLIST`, and `LOGNAME` environment variables

### Construction tools for terminal login services and pseudo-terminal tools

- `login-banner` — display an `/etc/issue` style banner

- `login-envuidgid` — present an interactive TUI dialogue for user login, and set `UID`, `GID`, `GIDLIST`, and `LOGNAME` environment variable values from the system account database

- `login-giveown-controlling-terminal` — give away ownership of the device named by `TTY to the user given by `UID``

- `login-process` — write a "login"/"getty" entry in the login accounting database for the controlling terminal (inapplicable on the BSDs, superseded by PAM elsewhere)

- `login-prompt` — wait for a newline from the terminal, serial terminal login style, to prevent unnecessary service churn when `login` has a timeout that cannot be turned off

- `open-controlling-terminal` — open the device named by `TTY` as the controlling terminal and set the standard file descriptors

- `pty-run` — a noddy NVT client

- `pty-allocate` — open the back end of a new pseudo-terminal and set `TTY` to the name of the attached front-end device

- `pty-run` — perform all I/O beween the back end of a pseudo-terminal and standard input/output, and spawn a child as the front end

- `vc-get-terminal` — set `TTY` to the name of a kernel/user space virtual terminal device, and set `TERM` to an appropriate terminal emulator type

- `vc-reset-terminal` — emit, without need for any termcap/terminfo database to be accessible, the control sequences to reset a kernel/user space virtual terminal (Logout causes terminal hangup and `console-terminal-emulator` to reset the terminal, making this largely unnecessary with user space virtual terminals.)

### Interacting with UCSPI servers

- `line-banner` — print the initial greeting that some UCSPI-TCP services do not print for themselves

- `fifo-listen` — open a listening FIFO

- `local-datagram-socket-listen` — open a listening AF_LOCAL datagram socket

- `local-seqpacket-socket-accept` — accept connections on an AF_LOCAL sequential packet socket, with concurrency control

- `local-seqpacket-socket-listen` — open a listening AF_LOCAL sequantial packet socket

- `local-stream-socket-accept` — accept connections on an AF_LOCAL stream socket, with concurrency control

- `local-stream-socket-connect` — connect to an AF_LOCAL stream server

- `local-stream-socket-listen` — open a listening AF_LOCAL stream socket

- `netlink-datagram-socket-listen` — open a listening AF_NETLINK datagram socket

- `recordio` — a UCSPI filter that records all I/O traffic to file

- `tcp-socket-accept` — accept connections on a TCP socket, with concurrency control

- `tcp-socket-connect` — connect to a TCP server

- `tcp-socket-listen` — open a listening TCP socket

- `tcpserver` — open a listening TCP socket and accept connections on it

- `ucspi-socket-rules-check` — check the peer (i.e. client) end of the open socket against an access control rules database

- `udp-socket-connect` — connect to a UDP server

- `udp-socket-listen` — open a listening UDP socket

### Others

- `monitored-fsck` — invoke `fsck` so that its progress information is directed to a monitoring service

## Log management

- `cyclog` — a tool to run (simple) logging services that write a size-limited, nanosecond timestamped, and automatically-rotated set of log files

- `klog-read` — a UCSPI server that expects stream input, which it decodes from the old syslog message format and writes to its own log output

- `syslog-read` — a UCSPI server that expects datagram input, which it decodes from the old syslog message format and writes to its own log output

- `tai64n` — a Unix-style filter to prepend nanosecond timestamps to each line of its input and send the result to its output

- `tai64nlocal` — a Unix-style filter to substitute local format local timezone timestamps for nanosecond timestamps in its input and send the result to its output

- `export-to-rsyslog` — post-process one or more log directories, sending log data to an RSYSLOG server

- `follow-log-directories` — post-process one or more log directories, writing log data to standard error

## User space virtual terminal services and terminal tools

### User space virtual terminals

- `console-convert-kbdmap` — create a full ISO 9995-3 keyboard map from a BSD `kbdmap` file

- `console-evdev-realizer` — "realize" a user-space virtual terminal onto a HID via a evdev character device

- `console-fb-realizer` — "realize" a user-space virtual terminal onto a framebuffer display device, with specified fonts

- `console-input-method-control` — control input method user-space virtual terminals

- `console-input-method` — layer an input method over a user-space virtual terminal, providing CJK and other input

- `console-kvt-realizer` — "realize" a user-space virtual terminal onto a keyboard input event device and a framebuffer display device, via a kernel virtual terminal device, with specified fonts and keyboard maps

- `console-multiplexor-control` — control multiplexed user-space virtual terminals

- `console-multiplexor` — multiplex several user-space virtual terminals into one, using the conventional `alt`-plus-function-key hotkeys

- `console-ncurses-realizer` — "realize" a user-space virtual terminal onto another terminal using Wide NCurses

- `console-pcat-keyboard-realizer` — "realize" a user-space virtual terminal onto a mouse HID via a kbd character device

- `console-pcat-mouse-realizer` — "realize" a user-space virtual terminal onto a mouse HID via a sysmouse character device

- `console-ps2-mouse-realizer` — "realize" a user-space virtual terminal onto a mouse HID via a ps2 character device

- `console-terminal-emulator` — provide the internal workings of a user-space virtual terminal, compatible with the Linux/FreeBSD/SCO kernel terminal emulators or a DEC VT

- `console-termio-realizer` — "realize" a user-space virtual terminal onto another terminal using straight terminal I/O

- `console-ugen-hid-realizer` — "realize" a user-space virtual terminal onto a USB HID via a ugen character device

- `console-uhid-realizer` — "realize" a user-space virtual terminal onto a USB HID via a uhid character device

### Terminal utilities

- `console-clear` (a.k.a. `clear_console`) — clear a terminal's display, and its scroll back buffer if it has one (a replacement for the Bourne Again shell's external command of the same name) that uses (de facto) standard control sequences (supported by xterm, PuTTY, the Linux kernel terminal emulator, and `console-terminal-emulator`) rather than kernel-specific virtual terminal mechanisms (Logout causes terminal hangup and `console-terminal-emulator` to clear the display buffer, making this largely unnecessary with user space virtual terminals.)

- `console-control-sequence` (a.k.a. `setterm`) — emit various standard and conventional control sequences

- `console-decode-ecma48` — decode ECMA 48 sequences into human-readable form

- `console-resize` (a.k.a. `resizecons`) — resize a terminal's display using DEC VT control sequences, which can properly pass over remote connections and don't need superuser privileges

## Login services

- `emergency-login` — a minimal superuser login program that only uses the system account database, suitable for use in emergency mode when there is no remote authentication available, there are no non-root filesystems mounted, and the TTY "secure" flag needs to be ignored

- `ttylogin-starter` — auto-start `ttylogin@` services (on demand on Linux) for kernel virtual terminals

- `login-update-utmpx` — invoke a shell, using the Unix convention to tell it that it is a login shell

- `login-update-utmpx` — update the active terminal login database for bootstrap and shutdown

- `list-logins` — list the active terminal login database

## Other services

- `monitor-fsck-progress` — a UCSPI "accepting" server that expects instances of `fsck` to connect to it as clients, and that displays fancy progress information on the console it is attached to

- `plug-and-play-event-handler` — a UCSPI server to read Plug and Play events and invoke a Plug and Play manager utility, one at a time and in order, for each event

- `time-pause-until` — wait until a specified TAI64N time has passed

## Other system utilities

- `console-docbook-xml-viewer` — view DocBook XML reference manuals

- `console-tty37-viewer` — view text that contains Teletype Model 37 effects

- `console-flat-table-viewer` — view tables from variable-length-record flat file databases

- `erase-machine-id` — erase the system machine ID and (BSD) host ID

- `false` — do nothing, and exit with a failure code

- `ifconfig` — configure network interfaces, with the command-line syntax of the FreeBSD tool and fully capable of handling IPv6 on Linux

- `procstat` — output the process table

- `pause` — do nothing forever, until signalled

- `printenv` — print the values of specified environment variable, or the whole environment

- `procstat` — output the process table, with the command-line syntax of the FreeBSD tool

- `ps` — output the process table, with the command-line syntax of the FreeBSD tool

- `set-dynamic-hostname` — initialize the system hostname

- `setup-machine-id` — initialize the system machine ID and (BSD) host ID

- `time-print-tai64n` — print a specified time in TAI64N form

- `true` — do nothing, and exit with a success code

## Service and system management

- `system-manager` — the system manager

- `per-user-manager` — the per-user manager

- `service-manager` — the service manager

## Service and system control/status

### daemontools-style raw service control and status commands

- `service-control` — the service control utility through which one sends low-level commands to an individual service via its control API in the `supervise` directory

  - daemontools-compatible form: `svc -u` service

  - native form: `service-control --down` service

  including a whole load of signals not supported by the original daemontools tool

  - `svc -q` / `service-control --quit`

  - `svc -1` / `service-control --usr1`

  - `svc -2` / `service-control --usr2`

  - `svc -w` / `service-control --window`

  - `svc -z` / `service-control --suspend`

- `service-dt-scanner` (a.k.a. `svscan`) — scan a daemontools-style services directory and command the service manager accordingly

- `service-status` (a.k.a. `svstat`) — service status query tool with human-readable output

- `service-show` (a.k.a. `svshow`) — service status query tool with machine-readable (.INI or JSON) output

- `service-is-up` (a.k.a. `svup`) — test that a service is in the "running" state

- `service-is-ok` (a.k.a. `svok`) — test that a service is loaded and managed by the service manager

- `service-is-enabled` — test that a service is enabled

### `system-control`

The `system-control` utility provides native service control and status that takes account of service orderings and dependencies. Its subcommands include:

- `system-control enable` — enable a service to be autostarted at bootstrap
- `system-control disable` — disable a service from being autostarted at bootstrap
- `system-control start` — start a service
- `system-control stop` — stop a service
- `system-control preset` — set the enable/disable state according to native (as well as systemd-compatible) preset information supplied by packages or the system administrator
- `system-control reset` — reset to the autostart status: start an enabled service, stop a disabled one
- `system-control is-active` — determine whether a service is in the "running" state
- `system-control is-loaded` — determine whether a service is loaded by the service manager
- `system-control is-enabled` — determine whether a service is enabled
- `system-control condrestart` — restart a service, if and only if it is currently running
- `system-control hangup` — send session hangup to a service's main process
- `system-control status` — display the status of a service, including the last few lines of its log (if readable via `./log/main/current`) and whether it is enabled
- `system-control show` — output the status of a service, in a machine-readable .INI form
- `system-control show-json` — output the status of a service, in a machine-readable JSON form
- `system-control cat` — display the execution scripts for a service
- `system-control find` — locate a service's service bundle directory
- `system-control unload-when-stopped` — instruct the service manager to unload the service when next it is stopped
- `system-control print-service-env` — retrieve environment variables from the service's environment variable template (a daemontools-style envdir in `./service/env/`)
- `system-control set-service-env` — set environment variables in the service's environment variable template (a daemontools-style envdir in `./service/env/`)

The `system-control` utility also provides native system control, with the subcommands:

- `system-control init` — bring the system up in whatever mode the boot loader specified
- `system-control normal` — bring the system up in normal mode (full multi-user login, with all workstation and server services)
- `system-control rescue` — bring the system up in rescue mode (console-only login using the normal `login` program, with filesystems mounted and basic system initialized)
- `system-control emergency` — bring the system up in emergency mode (console-only login using `emergency-login`, with no initialization)
- `system-control halt` — shutdown all services, unmount all filesystems, and halt the machine
- `system-control reboot` — shutdown all services, unmount all filesystems, and reboot the machine
- `system-control poweroff` — shutdown all services, unmount all filesystems, and power down the machine

With the systemd compatibility package, `system-control` can also be invoked under the name `systemctl`.

## Import from other systems' configuration files

- `system-control convert-systemd-units` — convert a systemd target unit, a systemd service unit, or a pair of a service unit and a systemd socket unit, into a native service bundle
- `system-control convert-fstab-services` — generate `swap@`, `dump@`, `fsck@`, and `mount@` service bundles from the contents of `/etc/fstab`
- `system-control write-volume-service-bundles` — generate the `swap@`, `dump@`, `fsck@`, and `mount@` service bundles for a single volume

## Miscellaneous system utilities

- `system-control load-kernel-module` — simple and portable shim for the operating system's kernel module loading tool, used to make portable `kmod@` service bundles
- `system-control unload-kernel-module` — simple and portable shim for the operating system's kernel module unloading tool, used to make portable `kmod@` service bundles
- `system-control nagios-check-service` — a very simple Nagios passive check plug-in that raises critical alerts for non-running enabled services and warnings for disabled services
- `system-control get-mount-where` — find the mount "where" from its "what"
- `system-control get-mount-what` — find the mount "what" from its "where"
- `chkservice` — list the status information of one or more service bundles

## Compatibility shims

### Generic

System 5 and BSD compatibility tools are complicated by the fact that both traditional toolsets include options that can turn several of the tools into one another, allowing cruel system administrators to give computers self-contradictory and impossible to execute as stated commands such as `reboot -p` and `halt --reboot`.

- `shutdown` — halt/reboot/poweroff/powercycle, optionally after a period and writing warning messages to logged-on users

- `reboot` — halt/reboot/poweroff/powercycle

- `fastboot` — halt/reboot/poweroff/powercycle, bypassing shutdown

- `halt` (a.k.a. `haltsys`) — halt/reboot/poweroff/powercycle

- `fasthalt` — halt/reboot/poweroff/powercycle, bypassing shutdown

- `poweroff` — halt/reboot/poweroff/powercycle

- `fastpoweroff` — halt/reboot/poweroff/powercycle, bypassing shutdown

- `powercycle` — halt/reboot/poweroff/powercycle

- `fastpowercycle` — halt/reboot/poweroff/powercycle, bypassing shutdown

- `telinit` — halt/reboot/poweroff/powercycle or rescue/normal

- `service` — a limited shim supporting the subset of conventional subcommands that are common to both System 5 and BSD

  - `start` — start a service

  - `stop` — stop a service

  - `status` — display the status of a service

### OpenRC

- `rc-update` — preset/disable a service, providing a simple OpenRC workalike that consults native and systemd-compatible preset information

- `rc-service` — start/stop a service, providing a simple OpenRC workalike

### OpenBSD

- `rcctl` — a limited shim supporting the subset of conventional rcctl subcommands that are common

  - `get` — retrieve environment variables from the service's environment variable template (a daemontools-style envdir in `./service/env/`)
  - `set` — set environment variables in the service's environment variable template (a daemontools-style envdir in `./service/env/`)
  - `enable` — enable a service
  - `disable` — disable a service

### IRIX

- `chkconfig` — a limited shim with subcommands

  - `on` — enable a service

  - `off` — disable a service

  - `reset` — preset a service

### Debian

- `update-rc.d` — preset/disable a service, providing a simple Debian workalike that consults native and systemd-compatible preset information rather than Debian-only "policy" mechanisms

- `invoke-rc.d` — reset/stop a service, providing a simple Debian workalike that simply relies upon the already-determined preset status

### Solaris

- `svcadm` — a limited shim with subcommands

  - `enable` — start (sic!) a service

  - `disable` — stop (sic!) a service

  - `version` — return version information

### Upstart

- `initctl` — a limited shim with subcommands

  - `start` — start a service

  - `stop` — stop a service

  - `status` — show the status of a service

  - `show-config` — list the configuration of a service

  - `version` — return version information