293 lines
10 KiB
HTML
293 lines
10 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="description" content="MontaukOS manual page: shell(1) - MontaukOS interactive command shell">
|
|
<title>shell(1) - MontaukOS Manual</title>
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap" rel="stylesheet">
|
|
<style>
|
|
body {
|
|
font-family: 'Open Sans', Arial, sans-serif;
|
|
max-width: 960px;
|
|
margin: 0 auto;
|
|
padding: 1em;
|
|
line-height: 1.5;
|
|
display: flex;
|
|
gap: 2em;
|
|
}
|
|
p { margin: 0 0 0.5em; }
|
|
h2 { margin: 0.5em 0; }
|
|
.sidebar {
|
|
width: 160px;
|
|
flex-shrink: 0;
|
|
}
|
|
.sidebar ul {
|
|
list-style: none;
|
|
padding: 0;
|
|
}
|
|
.sidebar li {
|
|
margin: 0.5em 0;
|
|
}
|
|
.sidebar a {
|
|
color: #0066CC;
|
|
text-decoration: none;
|
|
font-weight: 600;
|
|
}
|
|
.sidebar a:hover {
|
|
color: #004499;
|
|
text-decoration: underline;
|
|
}
|
|
.sidebar .current {
|
|
color: #004499;
|
|
}
|
|
.sidebar hr {
|
|
border: none;
|
|
border-top: 1px solid #999;
|
|
margin: 0.75em 0;
|
|
}
|
|
.main {
|
|
flex: 1;
|
|
min-width: 0;
|
|
}
|
|
a { color: #0000EE; }
|
|
a:visited { color: #0066CC; }
|
|
hr { border-style: solid; border-width: 1px 0 0 0; border-color: #999; }
|
|
pre { background: #f0f0f0; padding: 0.5em; overflow-x: auto; }
|
|
code { background: #f0f0f0; padding: 0 0.15em; }
|
|
pre code { padding: 0; }
|
|
.center { text-align: center; }
|
|
.box {
|
|
border: 1px solid #999;
|
|
padding: 0.5em;
|
|
margin: 0.5em 0;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="sidebar">
|
|
<ul>
|
|
<li><a href="../../index.html">Home</a></li>
|
|
<li><a href="../index.html">Documentation</a></li>
|
|
</ul>
|
|
<hr>
|
|
<ul>
|
|
<li><a href="index.html" class="current">Man Pages</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="main">
|
|
<div class="center">
|
|
<h1>shell(1)</h1>
|
|
</div>
|
|
|
|
<hr>
|
|
|
|
<pre><code><strong>NAME</strong>
|
|
shell - MontaukOS interactive command shell
|
|
|
|
<strong>DESCRIPTION</strong>
|
|
The MontaukOS shell is a command interpreter launched by init
|
|
after system services have started. It provides command
|
|
execution, file navigation, shell variables, command chaining,
|
|
tab completion, and command history.
|
|
|
|
Commands are either shell builtins or external programs. When
|
|
a command is not a builtin, the shell searches for a matching
|
|
ELF binary and executes it as a child process.
|
|
|
|
<strong>COMMAND RESOLUTION</strong>
|
|
When a non-builtin command is entered, the shell searches for
|
|
a matching binary in the following order:
|
|
|
|
1. <cwd>/<command> (exact name, e.g. "hello.elf")
|
|
2. <cwd>/<command>.elf
|
|
3. 0:/os/<command>.elf
|
|
4. 0:/os/<command> (no extension)
|
|
5. If on a non-zero drive, the drive root: <drive>:/<command>[.elf]
|
|
|
|
A command containing a "/" (or an explicit drive prefix, or a
|
|
leading "." or "/") is instead treated as a direct path and
|
|
resolved by the kernel against the process CWD, trying the
|
|
path as-is and then with ".elf" appended.
|
|
|
|
The first match is spawned and the shell waits for it to exit.
|
|
If no match is found, the shell prints:
|
|
|
|
<command>: command not found
|
|
|
|
Arguments after the command name are passed to the spawned
|
|
process.
|
|
|
|
<strong>BUILTINS</strong>
|
|
|
|
<strong>help</strong>
|
|
Display a categorized list of available commands.
|
|
|
|
<strong>ls [dir]</strong>
|
|
List files in the current directory, or in the specified
|
|
directory. Directory entries are shown with a trailing slash.
|
|
Examples: ls, ls man, ls os
|
|
|
|
<strong>cd [dir]</strong>
|
|
Change the working directory. With no argument, returns to the
|
|
logged-in user's home directory (0:/users/<user>); with /,
|
|
returns to the drive root. Use cd .. to go up one level.
|
|
The shell prompt reflects the current directory.
|
|
Examples: cd os, cd .., cd
|
|
|
|
<strong>pwd</strong>
|
|
Print the current working directory as an absolute path
|
|
(e.g. "0:/os").
|
|
|
|
<strong>echo [-n] ...</strong>
|
|
Print the arguments. -n suppresses the trailing newline.
|
|
|
|
<strong>set [VAR=value]</strong>
|
|
With no argument, list all shell variables (built-in and
|
|
user-defined). With VAR=value, set a variable. With a bare
|
|
name, print that variable's value.
|
|
|
|
<strong>unset VAR</strong>
|
|
Remove a user-defined shell variable.
|
|
|
|
<strong>true / false</strong>
|
|
Return exit status 0 / 1 without doing anything. Useful with
|
|
&& and ||.
|
|
|
|
<strong>N:</strong>
|
|
A bare "<number>:" (e.g. "1:") switches the current drive to
|
|
drive N and resets the working directory to that drive's root.
|
|
|
|
<strong>exit</strong>
|
|
Terminate the shell process (with the last command's exit code).
|
|
|
|
<strong>SYNTAX</strong>
|
|
<strong>Variables</strong>
|
|
NAME=value Set a shell variable (no leading $)
|
|
$VAR or ${VAR} Expand a variable's value
|
|
$? Exit status of the last command
|
|
$USER, $HOME, $PWD Built-in dynamic variables (session user,
|
|
home directory, current directory)
|
|
\$ Escape a literal '$'
|
|
|
|
<strong>Tilde expansion</strong>
|
|
A leading ~ expands to the session home directory
|
|
(0:/users/<user>) when followed by end-of-string, '/', or a
|
|
space.
|
|
|
|
<strong>Command chaining</strong>
|
|
cmd1 ; cmd2 Run cmd2 unconditionally after cmd1
|
|
cmd1 && cmd2 Run cmd2 only if cmd1 succeeded (exit 0)
|
|
cmd1 || cmd2 Run cmd2 only if cmd1 failed (nonzero exit)
|
|
|
|
Single and double quotes protect ;, &&, and || from being
|
|
treated as separators.
|
|
|
|
<strong>Comments</strong>
|
|
A '#' outside of quotes starts a comment; the rest of the line
|
|
is ignored.
|
|
|
|
<strong>EXTERNAL COMMANDS</strong>
|
|
All external commands live in 0:/os/ (see COMMAND RESOLUTION).
|
|
Where a dedicated man page exists it is noted below; run
|
|
'man <command>' for details.
|
|
|
|
<strong>File commands</strong>
|
|
cat <file> Display file contents
|
|
edit [file] Text editor -- see edit(1)
|
|
copy <src> <dst> Copy a file
|
|
move <src> <dst> Move/rename a file
|
|
rm <file> Remove a file
|
|
touch <file> Create an empty file
|
|
|
|
<strong>System commands</strong>
|
|
man <topic> View manual pages -- see man(1)
|
|
whoami Print the current username
|
|
info / mtkfetch Show system information
|
|
date Show current date and time
|
|
uptime Show system uptime
|
|
proclist List running processes
|
|
power CPU power/thermal status (power [watch [secs]])
|
|
clear Clear the screen and framebuffer
|
|
fontscale [n] Get or set terminal font scale -- see fontscale(1)
|
|
lua Lua interpreter
|
|
tcc TinyCC (in-system C compiler)
|
|
reset Reboot the system
|
|
shutdown Shut down the system
|
|
|
|
<strong>Network commands</strong>
|
|
ping <host> Send ICMP echo requests -- see ping(1)
|
|
nslookup <host> DNS lookup -- see nslookup(1)
|
|
ifconfig Show/set network configuration
|
|
tcpconnect <host> <port> Interactive TCP client
|
|
irc IRC client
|
|
dhcp DHCP client -- see dhcp(1)
|
|
fetch <url> HTTP/HTTPS client (TLS 1.2) -- see fetch(1)
|
|
wiki <title> Wikipedia article viewer -- see wiki(1)
|
|
httpd HTTP server
|
|
|
|
Network commands accept both IP addresses and hostnames.
|
|
Hostnames are resolved via the configured DNS server.
|
|
|
|
<strong>Bluetooth</strong>
|
|
btlist List connected Bluetooth devices
|
|
btbonds List bonded (paired) Bluetooth devices
|
|
|
|
<strong>Software-defined radio</strong>
|
|
sdr [freqMHz [rateHz]] Receive and report basic signal
|
|
statistics from an attached RTL-SDR dongle
|
|
|
|
GUI applications (window server programs, not run from the
|
|
shell prompt as text commands) live under 0:/apps/, one bundle
|
|
per app -- e.g. doom, terminal, texteditor, spreadsheet,
|
|
wordprocessor, paint, calculator, network, bluetooth, audio,
|
|
disks, devexplorer, procmgr, powermgr, printers, timezone,
|
|
weather, wikipedia. There is no 0:/games/ directory.
|
|
|
|
<strong>TAB COMPLETION</strong>
|
|
Pressing Tab completes the word under the cursor against, in
|
|
order: executable names in 0:/os/, shell builtins, and file/
|
|
directory entries in the current directory. A single match is
|
|
completed inline; multiple matches are listed below the prompt.
|
|
|
|
<strong>INPUT</strong>
|
|
The shell uses non-blocking keyboard input via SYS_GETKEY (with
|
|
SYS_INPUT_WAIT to sleep between events) to support arrow key
|
|
detection. Lines are limited to 255 characters.
|
|
|
|
<strong>Editing</strong>
|
|
Backspace Delete character before cursor
|
|
Tab Tab-complete the current word
|
|
Enter Execute the command line
|
|
|
|
<strong>History</strong>
|
|
The shell stores the last 32 unique commands. Duplicate
|
|
consecutive entries are suppressed.
|
|
|
|
Up Arrow Recall previous command
|
|
Down Arrow Recall next command (or clear line)
|
|
|
|
<strong>PROMPT</strong>
|
|
The prompt displays the current drive and working directory:
|
|
|
|
0:/> _ (at root of drive 0)
|
|
0:/os> _ (in os/ directory)
|
|
1:/> _ (at root of drive 1)
|
|
|
|
<strong>SEE ALSO</strong>
|
|
man(1), intro(1), syscalls(2)</code></pre>
|
|
|
|
<hr>
|
|
|
|
<div class="center">
|
|
<a href="../index.html">Back to Documentation Index</a>
|
|
</div>
|
|
|
|
</div>
|
|
</body>
|
|
</html>
|