SilverOS ships a graphical terminal emulator built directly into the desktop shell. It opens as a standard window (640×440 pixels) and provides a command interpreter that can interact with the SilverFS filesystem, query hardware state from the RTC and physical memory manager, and send ICMP packets over the network. The terminal is the primary way to interact with the OS after login.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/pastaboy12345/SilverOS/llms.txt
Use this file to discover all available pages before exploring further.
Opening the terminal
The terminal can be opened in two ways:- Automatically on login — after
user_login()succeeds inside the login window’s key handler,terminal_open()is called immediately so the terminal is ready the moment the desktop becomes interactive. - From the start menu — click the Silver button in the taskbar, then select Terminal.
terminal_open() checks whether a terminal window already exists (by testing term_window_id against window_get()). If it does, the existing window is focused rather than a second instance being created. If no terminal is open, a fresh window is created, the scroll buffer is cleared, and the ASCII art banner is printed.
Available commands
The functionterm_process_command dispatches on the command string using strcmp / strncmp. All commands are case-sensitive and lowercase.
| Command | Usage | Description |
|---|---|---|
help | help | Lists all available commands |
clear | clear | Clears the terminal screen |
ls | ls [dir] | Lists directory contents with type and size |
cat | cat /path/to/file | Prints file contents |
echo | echo some text | Prints text to terminal |
mkdir | mkdir /path/to/dir | Creates a directory |
touch | touch /path/to/file | Creates an empty file |
write | write /path/to/file data | Writes text to a file |
uname | uname | Prints SilverOS v0.1.0 x86_64 |
free | free | Shows free physical pages and MB |
date | date | Shows hardware date/time from RTC |
ifconfig | ifconfig | Shows MAC and IP address of eth0 |
ping | ping 10.0.2.2 | Sends ICMP echo request |
Unknown command: <input>.
Usage examples
Terminal internals
The terminal is implemented entirely insidedesktop/desktop.c. Its state is held in a set of static variables:
| Variable | Type / Size | Purpose |
|---|---|---|
term_lines | char[256][81] | 256-line scroll buffer, each line up to 80 chars |
term_line_count | int | Number of lines currently in the buffer |
term_input | char[256] | Current input line being typed |
term_input_len | int | Length of term_input |
term_window_id | int | WM window ID of the terminal (-1 if closed) |
term_draw is registered as the window’s draw callback and is called every frame:
- The content area is filled with
RGB(15, 15, 25)(near-black). visible_lines = content_height / FONT_HEIGHTdetermines how many lines fit. The font is 8×16 pixels (FONT_HEIGHT = 16).- Lines are rendered from
term_lines[start]toterm_lines[term_line_count - 1], wherestartis adjusted so the most recent lines always fill the bottom of the window. - The prompt
$is drawn in green (RGB(100, 200, 120)); the input text is in light grey (RGB(210, 215, 225)). - A blinking cursor is drawn at the end of the input text using
(timer_get_ticks() / 500) % 2to toggle visibility at roughly 1 Hz.
term_line_count reaches 256, term_add_line shifts all lines up by one and writes the new line at index 255, effectively discarding the oldest line.
Input handling — term_key_handler is the registered key callback. Printable ASCII characters (0x20–0x7E) are appended to term_input. KEY_BACKSPACE (0x08) or 0x7F removes the last character. KEY_ENTER (0x0A) echoes $ <input> to the scroll buffer, passes the input to term_process_command, then clears the input buffer.
File Browser
The desktop also ships a graphical file browser, accessible from the start menu:file_browser_open("/") opens a 500×350-pixel window showing the contents of the given path. Like terminal_open(), if a file browser window is already open it navigates to the new path instead of creating a duplicate.
Inside the browser:
- Directories are shown with a yellow-gold icon and name; files show a white icon, name, and byte size on the right.
- Single-click selects an entry (highlighted in blue).
- Double-click (simulated by clicking an already-selected entry) navigates into a directory.
- The Back button in the toolbar strips the last path component and navigates up. At the root (
/), the Back button is a no-op. - The window title updates dynamically to reflect the current path:
File Browser - /home/user.
The
ping command only sends the ICMP echo request via icmp_send_echo_request(). ICMP replies are logged to the serial port, not to the graphical terminal. Run QEMU with -serial stdio to see reply output in the host terminal.