Appendix B
Complete Command Reference
Every command in cshw, organized by category. For each entry: a one-line description and (where useful) the canonical syntax. Use man COMMAND from inside cshw for the full documentation including all flags, examples, and notes.
This appendix is intentionally exhaustive. You'll never use most of these commands, but knowing they exist matters for the rainy day when you do. Skim once now; come back when you need to remember "what was that command for…?"
Navigation
| Command |
Description |
cd PATH (alias chdir) |
Change current working directory. cd - flips back; cd alone goes home. (Ch 3) |
pwd |
Print current working directory. (Ch 3) |
pushd PATH |
Push current directory onto stack and change to PATH. (Ch 4) |
popd |
Pop top of directory stack and change to that directory. (Ch 4) |
dirs |
Display the current directory stack. (Ch 4) |
Files and Directories
| Command |
Description |
ls / dir |
List directory contents. -l long, -a all, -R recursive, -S size, -t time. (Ch 4) |
cp / copy SRC DST |
Copy files or directories. (Ch 4) |
mv / rename SRC DST |
Move or rename files. (Ch 4) |
rm / del FILE |
Delete files. /recycle to Recycle Bin, /secure to overwrite, /s recursive. (Ch 4) |
mkdir / md PATH |
Create directory. /p for intermediate dirs. (Ch 4) |
rmdir / rd PATH |
Remove directory. /S recursive, /Q quiet. (Ch 4) |
touch FILE |
Create empty file or update timestamps. (Ch 4) |
mklink LINK TARGET |
Create symbolic or hard link. (App-specific) |
find PAT [dir] [/s] |
Search for files by glob pattern. /s recurses into subdirectories. (Ch 4) |
stat FILE |
Show file metadata (size, mtime, attributes). |
file FILE |
Identify file type by contents. |
attrib FILE |
Display or change file attributes (read-only, hidden, archive). |
chmod MODE FILE |
Change file permissions. |
chown USER FILE |
Change file owner. |
umask MASK |
Set file creation mode mask. |
du PATH |
Estimate file space usage. |
df |
Display free disk space per drive. |
glob PATTERN |
Expand a filename pattern; show what it matches. |
lc FILE (alias linecount) |
Count lines in a file. |
fileblob FILE |
Encode a file as a single base64-style text blob. |
unfileblob BLOB FILE |
Decode a blob back into a file. |
readfile FILE VAR |
Read file contents into a shell variable. |
writefile VAR FILE |
Write a shell variable's value to a file. |
Viewing File Contents
| Command |
Description |
cat / type FILE |
Display file contents. (Ch 6) |
tac FILE |
Display file contents in reverse line order. (Ch 6) |
head -n N FILE |
First N lines (default 10). (Ch 6) |
tail -n N FILE |
Last N lines. (Ch 6) |
hexdump FILE |
Display file contents as hex bytes. |
strings FILE |
Extract printable strings from binary files. |
Text Processing
| Command |
Description |
grep PAT FILE |
Search for patterns. -i case, -r recursive, -n line numbers, -v invert, -E extended regex. (Ch 6) |
sed -e EXPR FILE |
Stream editor; transform text. (Ch 6) |
awk 'PROG' FILE |
Pattern-action language; column-oriented data. (Ch 6) |
sort FILE |
Sort lines. -r reverse, -n numeric, -u unique, -f ignore case. (Ch 6) |
uniq FILE |
Remove (or count) adjacent duplicate lines. -c count, -d only dups, -u only uniques. (Ch 6) |
cut -d DELIM -f N |
Extract fields from each line. (Ch 6) |
tr 'A' 'B' |
Translate or delete characters from stdin. -d delete. (Ch 6) |
wc FILE |
Count words/lines/characters. -l lines, -w words, -c chars. (Ch 6) |
rev FILE |
Reverse each line character by character. |
diff FILE1 FILE2 |
Compare two files line by line. |
tee FILE |
Copy stdin to stdout AND file (split a pipeline). For a whole session on both streams, see record. (Ch 6) |
seq START END |
Print a sequence of numbers. |
tokenize STRING |
Show how cshw parses an input string into tokens. |
base64 |
Encode/decode base64. |
xargs CMD |
Build command lines from stdin and run them. |
Hashing
| Command |
Description |
md5sum FILE |
Compute MD5 hash. |
sha1sum FILE |
Compute SHA-1 hash. |
sha256sum FILE |
Compute SHA-256 hash. |
sha512sum FILE |
Compute SHA-512 hash. |
shasum [-a N] FILE |
SHA hash; N is 1/256/384/512, default 256. -c verifies a checksum file. |
Calculators
| Command |
Description |
bc [-e EXPR] [-f FILE] [-i] [-l] [-x] |
Arbitrary-precision calculator language (POSIX bc). -e inline expression, -f script, -i force REPL, -l math library (always loaded), -x exact rational + Power tier. (Ch 5 ref, Ch 12) |
dc [-e EXPR] [-f FILE] |
Reverse-Polish arbitrary-precision calculator. RPN sibling of bc. |
base RADIX NUMBER |
Print NUMBER in RADIX (2-36). Reads 0x/0b/0o prefixes on input, so it converts either way: base 10 0x100 is 256, base 16 255 is 0xFF. |
@ var = EXPR |
csh-style arithmetic assignment. Full operator precedence, float-typed variables, math primitives (sqrt/pow/sin/cos/log/floor/round/abs/min/max/…). (Ch 5) |
Archive
| Command |
Description |
tar c/x/t FILE |
Create, extract, or list archive contents. |
zip FILE PATHS |
Create a ZIP archive. |
unzip FILE |
Extract a ZIP archive. |
| Command |
Description |
date |
Display current date and time. |
time CMD |
Measure how long CMD takes to run. (Ch 13) |
tc CMD |
Time how long CMD takes (alternate name for time). |
uptime |
Show how long the system has been running. |
hostname |
Display system hostname. |
whoami |
Display current user name. |
uname |
Print system information (kernel, version). |
winver |
Display Windows version. |
version |
Display cshw version. |
iswindows |
Check (or assert) that we're on Windows. |
say [/datetime|/diskinfo|/meminfo|/cpuinfo] |
System information with formatting options. |
peinfo FILE |
Display PE-format (Windows executable) file information. |
about |
Display cshw "About" information. |
ver |
Alias for version. |
Process Management
| Command |
Description |
processlist / ps |
List running processes. /v verbose, /s NAME sort. (Ch 13) |
kill PID |
Terminate a process. -9 force, /f force, /t tree. (Ch 13) |
killanddel / kad PATH |
Kill processes and securely delete the executable. |
nice -n N CMD |
Run command with modified priority. |
nohup CMD |
Run command immune to hangups. |
exec CMD |
Replace current shell with command. |
timeout N CMD |
Run CMD with a time limit (seconds). (Ch 13) |
watch CMD |
Execute CMD periodically, refreshing the display. |
Job Control
| Command |
Description |
CMD & |
Launch CMD as a background job. (Ch 13) |
jobs |
Display status of background jobs. (Ch 13) |
bg %N |
Resume job N in background. (Ch 13) |
fg %N |
Bring job N to foreground. (Ch 13) |
stop %N |
Suspend a specific job (Ctrl+Z equivalent for a named job). |
start CMD |
Launch a new process in a separate window. |
wait |
Wait for all running coroutines to finish (alias for cowait /all). |
notify on/off |
Enable/disable async job-completion notifications. (Ch 13) |
onintr LABEL |
Set interrupt (Ctrl+C) handler. |
Power and Sessions
| Command |
Description |
shutdown |
Shut down, restart, or log off. /s, /r, /l, /h. |
suspend |
Manage system power state (sleep/hibernate). Not job control — use stop %N for that. |
service NAME |
Start, stop, query, install Windows services. |
login USER |
Log in as a different user. |
logout |
Exit a login shell. |
exit [N] |
Exit the current shell with status N. |
install |
Run a system installation routine. |
Scheduling and Timing
| Command |
Description |
sleep DURATION |
Pause for a duration (30s, 5m, 1h). |
crontab |
Manage scheduled cron-style jobs. |
crond [start/stop/status] |
Control the cron daemon. |
time CMD |
Measure command execution time. |
timeout N CMD |
Cap command runtime. |
watch CMD |
Repeat a command at intervals. |
Variables and Environment
| Command |
Description |
set var = value |
Set or display shell variables. (Ch 5) |
unset var |
Remove a shell variable. (Ch 5) |
setenv VAR value |
Set an environment variable (exported to child processes). (Ch 5) |
unsetenv VAR |
Remove an environment variable. (Ch 5) |
env |
Display all environment variables. |
printenv [VAR] |
Print one or all environment variables. |
vartype var |
Display the type of a variable. |
declare -a/-A NAME |
Declare an array (-a) or hash (-A). (Ch 5) |
local var |
Declare a local variable inside a procedure. (Ch 10) |
readonly var |
Mark a variable as read-only. (Ch 5) |
share var = value |
Inside a coroutine, write through to main's globals. (Ch 14) |
shift [N] |
Shift positional parameters left by N (default 1). |
Collections (Arrays and Hashes)
| Command |
Description |
array push NAME VALUE |
Append to array. (Ch 5, 11) |
array set NAME I VALUE |
Set array element at index I. (Ch 5, 11) |
array get NAME I |
Get array element at index I. (Ch 5, 11) |
array size NAME |
Get array length. (Ch 5, 11) |
array list NAME |
List all array elements with indices. (Ch 5, 11) |
hash set NAME KEY VALUE |
Set hash entry. (Ch 5, 11) |
hash get NAME KEY |
Get hash value (sets $result). (Ch 5, 11) |
hash keys NAME |
List all keys in sorted order. (Ch 5, 11) |
hash list NAME |
List all key/value pairs. (Ch 5, 11) |
hash has NAME KEY |
Check whether a key exists. (Ch 5, 11) |
Aliases and Completion
| Command |
Description |
alias NAME "command args" |
Define a command alias. (Ch 7) |
unalias NAME |
Remove an alias. (Ch 7) |
complete CMD ... |
Define tab-completion rules for a command. (Ch 7) |
uncomplete CMD |
Remove completion rules. |
rehash |
Rebuild the command lookup hash table. |
unhash CMD |
Remove a specific command from the hash table. |
hashstat |
Display command-hash-table statistics. |
Help, Lookup, and Diagnostics
| Command |
Description |
help [CMD] |
Display command help. (Ch 3) |
man CMD |
Display a manual page. (Ch 3) |
where CMD |
Locate all instances of a command (built-in, alias, on PATH). |
which CMD |
Locate the first matching command. |
history [N] |
Display command history (most recent N). (Ch 7) |
record [-a] FILE | record off | record |
Record stdout AND stderr to FILE while still showing them; -a appends, off stops, bare record reports state. A mode, not a filter — never in a pipeline. cshw -record FILE covers a whole session including the startup files. (Ch 6) |
Scripting and Flow
| Command/Keyword |
Description |
source FILE (or .) |
Execute commands from FILE in the current shell. (Ch 8) |
exit [N] |
Exit shell with status N. |
return [N] |
Return from a procedure with status N; sets $result. (Ch 10) |
retproc |
Pop the current procedure frame (no return value). (Ch 8) |
retshell [N] |
Exit a sourced script without killing the parent shell. (Ch 8) |
if/then/else/endif |
Conditional execution. (Ch 9) |
else if (...) |
Chained conditions. (Ch 9) |
while (COND)/end |
Loop while condition true. (Ch 9) |
do/while (COND) |
Run loop body at least once. (Ch 9) |
foreach v (LIST)/end |
Iterate over a list. (Ch 9) |
loop N as i/endloop |
Repeat N times with optional counter. (Ch 9) |
switch ($v)/case/breaksw/endsw |
Multi-way branch. (Ch 9) |
break / continue |
Loop control. (Ch 9) |
proc NAME/endproc |
Define a procedure. (Ch 10) |
library FILE |
Load a .cshw script as a procedure library. (Ch 10) |
nop |
No-op; does nothing successfully. |
true / false |
Always-succeed / always-fail commands. |
limit / unlimit |
Display resource limits. Read-only: Windows has no per-process rlimit to set. |
msgbox "MESSAGE" ["TITLE"] ["TYPE"] |
Display a graphical message box; the button pressed lands in $result. |
messagebox |
Alternate spelling of msgbox. |
passworddlg / password |
Prompt for a password via dialog. |
progressdlg |
Show a progress-bar dialog. |
splash / endsplash / testsplash |
Show or end a splash-screen window. |
cls |
Clear the console screen. |
echo "text" |
Display text. -n no newline. (Ch 6) |
prompt "FORMAT" |
Set the prompt string. (Ch 7) |
title "STRING" |
Set the console window title. |
Coroutines
| Command |
Description |
corunproc PROC [args] |
Launch PROC as a coroutine; $coid = new ID. (Ch 14) |
cowait $coid [...] |
Wait for one or more coroutines. /all, /any, /timeout:MS. (Ch 14) |
coresult $coid |
Retrieve the coroutine's $result. (Ch 14) |
cocancel $coid |
Cancel a running coroutine. /all to cancel everything. (Ch 14) |
cosuspend $coid |
Pause a running coroutine. (Ch 14) |
coresume $coid |
Resume a suspended coroutine. (Ch 14) |
colist |
List all coroutines and their states. (Ch 14) |
coclean |
Remove records of completed/cancelled coroutines. (Ch 14) |
Synchronization Primitives
| Command |
Description |
mutex NAME lock/unlock/trylock |
Mutual-exclusion lock. (Ch 15) |
event NAME create/signal/reset/wait/destroy |
One-to-many signaling. -autoreset for queue-style. (Ch 15) |
semcreate NAME INITIAL [MAX] |
Create a counting semaphore. MAX defaults to INITIAL. (Ch 15) |
semaphore NAME acquire/release |
Acquire/release semaphore permit. (Ch 15) |
barrier NAME create COUNT |
Create a rendezvous barrier. (Ch 15) |
barrier NAME wait |
Block until COUNT coroutines arrive. (Ch 15) |
chancreate NAME [CAPACITY] |
Create a message channel. Capacity 0 = unbounded (send never blocks). (Ch 15) |
channel NAME send/receive/tryreceive/close |
Channel I/O. (Ch 15) |
sync list/destroy/destroyall |
Inspect or tear down sync objects. (Ch 15) |
Atomic Variables
| Command |
Description |
coset NAME VALUE |
Atomic write to a shared cross-coroutine variable. (Ch 15) |
coget NAME |
Atomic read; stores value in $result. (Ch 15) |
coincr NAME [BY] |
Atomic increment; $result = OLD value. (Ch 15) |
codecr NAME [BY] |
Atomic decrement; $result = OLD value. (Ch 15) |
cocas NAME EXPECTED NEW |
Compare-and-swap; $? = 0 if swap happened. (Ch 15) |
Networking
| Command |
Description |
fetch URL |
HTTP/HTTPS client. -o FILE, -I headers only, -X METHOD, -d DATA, -q quiet; --http2/--http3 force the protocol via the native nghttp2 / msquic+nghttp3 client. (Ch 16) |
ftpfetch URL |
FTP client. Credentials go in the URL (ftp://user:pass@host/path); -u LOCAL for upload, -o FILE to save, /A for active mode (default is passive). (Ch 16) |
tcpclient HOST PORT |
One-shot TCP client. /send:DATA, /recv, /timeout:MS. (Ch 16) |
tcpserver PORT HANDLER |
TCP server with handler procedure. /max:N, /timeout:MS, /once. (Ch 16) |
socket create tcp/udp NAME |
Create a socket. -4/-6, --dual. (Ch 16) |
socket bind NAME [ADDR] PORT |
Bind socket to address/port. (Ch 16) |
socket listen NAME |
Listen for connections. (Ch 16) |
socket accept NAME |
Accept connection (sets $result to client socket ID). (Ch 16) |
socket connect NAME HOST PORT |
Connect outbound. (Ch 16) |
socket send/recv NAME [DATA] |
I/O on socket. (Ch 16) |
socket close NAME / /all |
Close socket(s). (Ch 16) |
socket list/info NAME |
Inspect open sockets. (Ch 16) |
socket select NAME r/w/e |
Poll for readiness without blocking. (Ch 16) |
Server Daemons
| Command |
Description |
tsrvd start PORT [HANDLER] [flags] |
Launch a supervised out-of-process server; $result = daemon ID. /dll:PATH runs a native protocol plugin, /dllcfg:FILE its config, /stream for streaming handlers, plus /workers:N, /norestart, /onrestart:PROC. (Ch 19) |
tsrvd status ID |
Show a daemon's accepted/active/running counts. (Ch 19) |
tsrvd stop ID |
Gracefully stop a daemon. (Ch 19) |
tsrvd list |
List all daemons (ID, port, PID, state, restart count). (Ch 19) |
tsrvd recv/send/close CONN |
Connection I/O inside a /stream handler. (Ch 19) |
quicsrv start PORT [flags] |
Launch a supervised QUIC/HTTP-3 worker (UDP); $result = daemon ID. /dllcfg:FILE gives the cert + document root (same serving core as http.dll), /norestart opts out of auto-restart. (Ch 19) |
quicsrv status/stop/list ID |
Manage QUIC workers — the UDP sibling of tsrvd. (Ch 19) |
checkmail |
Force an immediate $mail mailbox check. (Ch 19) |
The bundled protocol plugins, loaded via tsrvd start /dll:: smtp.dll (SMTP receiver), pop3.dll and imap.dll (mail retrieval over a shared Maildir spool), ftp.dll (FTP/FTPS), and http.dll (an HTTP/1.1 + HTTP/2 static-file + CGI server, HTTPS via TLS). HTTP/3 is served by the separate quicsrv worker over QUIC/UDP, through the same static + CGI engine. They ship with the installer's optional server component.
AI Integration
| Command |
Description |
genai register NAME TYPE KEY |
Register an AI provider. TYPE: openai/anthropic/azure/ollama/lmstudio/custom. (Ch 17) |
genai remove NAME |
Remove a registered provider. (Ch 17) |
genai list |
List all registered providers. (Ch 17) |
genai default [NAME] |
Show or set the default provider. (Ch 17) |
genai test [NAME] |
Test provider connectivity. (Ch 17) |
genai models [NAME] |
List available models for a provider. (Ch 17) |
genai settings [KEY] [VAL] |
Show or update genai settings (stream, temperature, max-tokens). (Ch 17) |
genai ask "PROMPT" |
Send a prompt. -n NAME, -t TEMP, --max-tokens N, -m MODEL. Accepts piped input. (Ch 17) |
genai analyze FILE "PROMPT" |
Send a file plus prompt to the AI. (Ch 17) |
genai code [-l LANG] "PROMPT" |
Code-tuned generation (temp 0.3, code-only output). (Ch 17) |
Plugin Management
| Command |
Description |
rcl PATH [PREFIX] (alias registercmdlib) |
Load a plugin DLL. /prefixonly requires prefix; -- ARGS... passes args to plugin's InitializeLibrary. (Ch 18) |
urcl NAME/PATH (alias unregistercmdlib) |
Unload a plugin. /all to unload everything. (Ch 18) |
cmdliblist [/v] |
List loaded command libraries. /v shows each library's commands. (Ch 18) |
Windows API and DLLs
| Command |
Description |
rundllproc DLL FUNC [args] |
Call any Win32 function dynamically. Arg type prefixes: i:, u:, p:, b:, s:, a:, obufw:, obufa:, obuf:, obufd:, obufq:. --ret:int/hex/bool/hresult/wstr/astr/ptr/void. (Ch 18) |
winapi FUNC [args] |
Auto-resolve which DLL hosts a Win32 function and call it. -d to just print resolution. (Ch 18) |
dllimport PATH [ALIAS] |
Preload a DLL into the shell process. (Ch 18) |
dlllist |
List currently loaded DLLs. (Ch 18) |
dllunload ALIAS |
Unload a DLL. (Ch 18) |
Windows Integration
| Command |
Description |
reg op KEY [args] (alias registry) |
Read, write, list, find, copy, compare, export Windows registry keys/values. |
sudo COMMAND |
Run a command as Administrator (via UAC elevation). /system for SYSTEM-level. |
clip |
Copy stdin to / paste from the Windows clipboard. |
mklink LINK TARGET |
Create a symbolic or hard link. |
msgbox "MESSAGE" ["TITLE"] ["TYPE"] |
Display a Windows message box; $result holds the button (6 = Yes, 7 = No). |
peinfo FILE |
Show PE-format details for a Windows executable. |
pathmap [/UNIX WINDOWS | -d /UNIX] |
Maintain a user-editable Unix-to-Windows path-translation table. (Ch 4) |
Scriptable Windows (GUI plugins)
| Command |
Description |
createwindow CLASS TITLE |
Create a script-bound window (typically used inside plugin scripts). |
addcontrol PARENT TYPE ... |
Add a child control to a scripted window. |
bindevent HWND MSG PROC |
Bind a window event to a cshw procedure. |
unbindevent HWND MSG |
Remove an event binding. |
sendmessage HWND MSG WPARAM LPARAM |
Send a Win32 message to a window. |
postmessage HWND MSG WPARAM LPARAM |
Post a Win32 message (async). |
Recognized Aliases
A handful of commands have shorter or alternate spellings that resolve to the same implementation:
| Alias |
Resolves to |
ls |
dir |
cp |
copy |
md |
mkdir |
rd |
rmdir |
del |
rm |
chdir |
cd |
ver |
version |
kad |
killanddel |
rename |
mv |
linecount |
lc |
messagebox |
msgbox |
registry |
reg |
registercmdlib |
rcl |
unregistercmdlib |
urcl |
ps |
processlist |
type |
cat (for "show file contents" — distinct from cmd.exe's type which is identical) |
A Note on Command Counts
cshw ships with 245 built-in commands as of 1.0.8.4: 244 registered across the source tree, plus help, which the shell dispatches specially rather than registering. The exact number changes as the project evolves — new ones get added, old ones occasionally get renamed or consolidated. Run help from inside the shell for the live list as of your installed version.
Two footnotes, because the count is easy to get wrong and this book has done so before:
help prints 244 lines and does not list itself. Earlier printings of this book said 222/221 and explained the difference by iswindows being registered under two spellings; that is no longer true — only isWindows is registered now, and every name in the list is distinct.
reg is not a cshw built-in. Typing it runs Windows' own reg.exe, exactly as cmd.exe would. The cshw built-in for registry work is registry.
For commands that ship with full manual pages, man NAME gives you the canonical reference — usage, options, examples, exit codes, related commands. For commands without separate man pages (most of the scripting keywords and concurrency primitives), help NAME gives the inline summary.
Where to Read More
Most commands appear in one or more chapters of this book:
- Filesystem and navigation — Ch 3, Ch 4
- Text processing — Ch 6
- Variables and environment — Ch 5, Ch 7
- Scripts and procedures — Ch 8, Ch 9, Ch 10
- Collections — Ch 5, Ch 11
- Job control — Ch 13
- Coroutines and synchronization — Ch 14, Ch 15
- Networking — Ch 16
- AI integration — Ch 17
- Plugins and Win32 APIs — Ch 18
- Standalone servers (tsrvd, quicsrv, mail, FTP, HTTP/1.1+2+3) — Ch 19
- Greatest hits and daily-use patterns — Ch 20, Ch 21, Ch 22
When in doubt, search this book for the command name; chances are there's a worked example.