NallixOS - In-Memory Filesystem Shell
A fully-featured Unix-like shell written in Go that runs entirely in memory with JSON persistence. Simulates a complete filesystem with navigation, file creation, editing, and inspection commands.
Features
- Full filesystem navigation: ls, cd, pwd, mkdir, rm
- File operations: touch, cat, echo > >>, cp, mv
- File inspection: stat, wc, head, tail
- Visualization: tree directory structure
- Utilities: clear, whoami, date, help
- Persistent state: Saves to filesystem.json on exit
Quick Start
go run main.goYour filesystem persists across runs in filesystem.json.
Commands
| Command | Description | Example |
|---|---|---|
| ls | List files & directories | ls |
| cd | Change directory | cd docs, cd .. |
| pwd | Print working directory | pwd |
| mkdir | Create directory | mkdir projects |
| touch [content] | Create file | touch notes "Hello" |
| rm | Delete file/dir | rm notes |
| cat | Show file content | cat notes |
| echo > file | Write to file | echo "Hi" > log.txt |
| echo >> file | Append to file | echo "more" >> log.txt |
| mv | Rename | mv old.txt new.txt |
| cp | Copy file | cp a.txt b.txt |
| tree | Show directory tree | tree |
| stat | File size | stat notes |
| wc | Line/word/char count | wc notes |
| head | First 5 lines | head notes |
| tail | Last 5 lines | tail notes |
| clear | Clear screen | clear |
| whoami | Current user | whoami |
| date | Current time | date |
| help | Show this help | help |
| exit | Save & quit | exit |
Example Session
home $ mkdir docs
home $ cd docs
home/docs $ touch notes "My first file"
home/docs $ echo "Second line" >> notes
home/docs $ cat notes
My first file
Second line
home/docs $ wc notes
Lines: 2 Words: 4 Chars: 20
home/docs $ tree
docs/
notes
home/docs $ exit
Architecture
Directory {
Name, Files[], Directories[], Parent
}
↳ Persisted to filesystem.json
↳ Parent pointers restored on load
- In-memory tree with parent pointers for cd ..
- JSON persistence - survives restarts
- Cross-platform (clear/cls detection)
Future Features
- Multi-user system (adduser, login)
- File ownership & permissions
- Cross-directory mv/cp
- Search (find)
- Text editor (vi, nano)
License
MIT - do whatever you want with it