PROPHET/OS

NAME

cat: writes the contents of a file to out, one after another for several files

SYNOPSIS

cat <file> ...

DESCRIPTION

Writes the contents of a file to out, one after another for several files. On the screen a byte that is not printable becomes a dot, so a binary file does not take the console apart; into a file or a pipe every byte goes as it is, so cat a > b is a copy.

Reading happens in pieces of 512 bytes: a program has no heap here and should not need one.

The output goes to out and not to the console directly. That is the difference that makes cat file | wc work: what a program produces belongs in the stream, and it is the one who did not redirect the stream who sees it on screen.

An error in the middle of a file is an error, not the end of the file. A read that returns less than nothing has failed; only a read that returns nothing is the end.

EXAMPLE

$ cat /system/config/shell.conf
# ProphetOS, the settings of the shell.
#
# Three steps, and the user's own file wins:
#
#   <home>/.shell.conf          the user's own, if it is there
#   /system/config/shell.conf   otherwise this one
#   in the program              otherwise the default
#
# Which step held is what the built-in `prompt` says. Read once when the
# shell starts, because the prompt is drawn from it on every line.
#
# One line is a key, a space, a value. Everything behind # is comment.
# The value keeps the spaces inside it and loses those at the edges, so
# a prompt may carry spaces but not a trailing one.
#
# Until 2026-09-30 this stood as `shell.prompt` in kernel.conf and as a
# node in the kernel's control tree. A prompt is the shell's business
# (R9-KNOTEN-01).

# The prompt. Placeholders:
#
#   %T  the terminal's number in brackets and a space, [1], a remote one [p3]; dropped when there is only one
#   %h  the name of the machine
#   %w  the working directory
#   %d  only its last name
#   %u  the user this shell runs as
#   %$  # for root, > for every other user
#   %?  the last command's value in red, only when it failed (nothing when it went well)
#   %t  how long the last command ran, only past two seconds
#   %c  how many lines this shell ran
#   %n  slash and number of the console, dropped when there is only one
#   %%  a percent sign
#
# Only what is of use stands in it by default (the owner, 2026-11-21): which terminal and machine, where one is,
# whether the last command failed or took long; > at its end, for root as well (the owner chose it).
#
# The colours hang on the placeholders and not on fixed positions: the
# name is bright, what follows is dimmed. Whoever reorders the line gets
# the same colours at the new places. A space always follows the prompt
# and is not written here.

prompt %T%h:%w%?%t>

# Graphics of the shell: plain draws text only, cell binds the terminal
# graphics library and lets the prompt live while the shell waits for a
# key. The effect: gradient, glow, fire or smoke; none or a missing key
# keeps the prompt still. The first key paints everything back.

# Where it lives: prompt (on the whole prompt until the first key) or
# cursor (the flame rises from the cursor and follows it; under review
# until the console is drawn outside the kernel, R13-CON-01).

gfx plain
prompt_effect none
prompt_effect_on prompt

# The terminal of a console: consolev (drawn in user space with its own
# cursor out of consolev.conf) or kernel (the kernel draws the console).
# consolev is the default; only the disks of the runs take kernel, because
# the runs read the prompt on the serial line and consolev draws a screen.

terminal kernel

SEE ALSO

more, head, tail, grep, writefile