A fully custom shell built from scratch in C. No bash. No PowerShell. No wrappers. Just pure C.
Pick your platform and get running in seconds.
cfd to PATH automaticallyEvery subsystem — the lexer, parser, line editor, scripting engine, and all 70+ commands — is written in C with zero external libraries.
Commands, strings, pipes, variables, and flags are colorized in real time as you type.
Ghost-text completion from history appears after the cursor. Press → to accept instantly.
Incremental reverse history search. Type to filter, Enter to accept, Ctrl+G to cancel.
Arrow keys, Home/End, Ctrl+A/E/K/U/W/Y, word-kill, kill-ring. Works exactly as expected.
cmd1 | cmd2 | cmd3 uses real dup2 pipe chaining — no temp files, no workarounds.
Variables, if/elif/else, while, for, functions, and source — a complete mini-language.
calc sqrt(2) * pi — expression parser with trig, log, sqrt, and constants.
pkg install git auto-detects winget, scoop, choco, apt, or brew and installs.
nano file.txt opens a full terminal text editor with search, cut/paste, and save.
curl and wget built in using WinHTTP (Windows) or BSD sockets (Unix).
md5 and sha256 implemented from scratch — RFC 1321 and FIPS 180-4.
Three built-in themes: default, dark, and minimal. Configurable prompt format.
Every command is a native C function — no forking to an external tool.
| Command | Description |
|---|---|
| ls [-la] [path] | List directory with color-coded entries |
| cd [path] | Change directory; cd - goes back |
| pwd | Print working directory |
| mkdir [-p] <dir> | Create directory, -p creates parents |
| rm [-rf] <path> | Remove files or directories |
| cp [-r] <src> <dst> | Copy files or directories |
| mv <src> <dst> | Move or rename |
| cat [file...] | Print file contents |
| find [dir] [-name pat] | Find files matching pattern |
| tree [-L n] [path] | Visual directory tree with box-drawing chars |
| du [-sh] [path] | Disk usage, -h for human-readable |
| df [-h] | Disk free space for all volumes |
| ln [-s] <target> <link> | Create hard or symbolic link |
| stat <file> | File metadata (size, dates, permissions) |
| realpath <path> | Resolve to absolute path |
| chmod <mode> <file> | Change file permissions |
| Command | Description |
|---|---|
| grep [-rni] <pat> | Search text with regex |
| sort [-rnu] | Sort lines alphabetically or numerically |
| wc [-lwc] | Count words, lines, and characters |
| head / tail [-n N] | Show first or last N lines |
| cut -d <d> -f <n> | Extract delimited fields |
| tr <set1> <set2> | Translate characters |
| uniq [-cd] | Filter adjacent duplicate lines |
| diff [-u] <f1> <f2> | Colorized file diff |
| tee [-a] <file> | Write stdin to stdout and file |
| base64 [-d] | Encode or decode base64 |
| xargs [-n N] <cmd> | Build command from stdin args |
| column [-t] | Format text into aligned columns |
| fold [-w N] | Wrap long lines at width |
| Command | Description |
|---|---|
| help [cmd] | Show all commands or detail on one |
| version | cFd version and platform info |
| clear | Clear terminal screen |
| date | Current date and time |
| uname [-a] | OS name, version, architecture |
| whoami | Current username |
| hostname | System hostname |
| uptime | System uptime in days/hours/minutes |
| env | List all environment variables |
| export [name=val] | Export variable to environment |
| set / unset | Set or unset shell variables |
| alias / unalias | Define and list aliases |
| source <file> | Execute script in current session |
| history [n] | Show command history |
| which <cmd> | Find command in PATH |
| sleep <secs> | Sleep for N seconds (supports decimals) |
| watch [-n s] <cmd> | Repeat command every N seconds |
| test <expr> | Evaluate file/string/integer test |
| read [-p prompt] <var> | Read line from stdin into variable |
| Command | Description |
|---|---|
| curl [-o file] <url> | HTTP/HTTPS client (GET, POST, headers) |
| wget [-O file] <url> | Download file with progress indicator |
| ping [-c n] <host> | Send ICMP echo requests |
| netstat | Show active network connections |
| ipconfig / ifconfig | Network interface configuration |
| Command | Description |
|---|---|
| calc <expr> | Evaluate: +−×÷%, ^, sin, cos, tan, sqrt, log, floor, ceil, pi, e, ans |
| expr <a> <op> <b> | Integer and string expressions (POSIX expr) |
| seq [first [inc]] last | Generate number sequence with optional format |
| md5 [-s str] [file] | MD5 hash (RFC 1321, implemented from scratch) |
| sha256 [-s str] [file] | SHA-256 hash (FIPS 180-4, implemented from scratch) |
| Command | Description |
|---|---|
| ps | List running processes |
| kill [-s sig] <pid> | Send signal to process |
| jobs | List background jobs |
| bg / fg [job] | Resume job in background or foreground |
| exec <cmd> | Replace shell with command |
| wait [pid] | Wait for process or all jobs |
Write scripts in cFd's own language. Variables, control flow, functions, and pipelines all work together.
# ~/.cfdrc — loaded on startup alias ll="ls -la" alias gs="git status" export EDITOR=nano # Function with arguments function mkcd mkdir -p $1 cd $1 end # If / elif / else if test -f config.json echo "Config found" elif test -d config/ echo "Config directory found" else echo "No config" fi # Pipeline + redirection ls -la | grep ".c" | sort | head -10 > sources.txt # For loop over glob for f in *.c echo " $f" done
Every layer is custom. The pipeline from keypress to result is entirely hand-written C.
Memory, strings, hash table, linked list, paths, logging
Win32 + POSIX abstraction for raw mode, processes, I/O
ANSI colors, themes, display helpers, prompt builder
Lexer, token types, recursive descent parser, AST nodes
Line editor, key bindings, history, tab completion
Streams, real pipe chains, I/O redirection via dup2
Variables, control flow, user functions, script runner
Command registry, dispatcher, 70+ built-in commands
Session state, REPL loop, config loader, terminal init
All you need is GCC and Make. No external libraries.
git clone https://github.com/saarors/cFd.git cd cFd
make
Outputs cfd.exe on Windows, cfd on Linux/macOS.
# Windows .\cfd.exe # Linux / macOS ./cfd
# ~/.cfdrc alias ll="ls -la" export EDITOR=nano theme=dark