Pocketterm
v0.12 - Community Hardened. A high-fidelity Linux sandbox & educational engine. Features a custom AST shell, persistent VFS, and hardware-aware system probes. Built for Zero-Infrastructure scale.
Install / Use
/learn @edgaraidev/PockettermREADME
PocketTerm
PocketTerm is a high-fidelity, browser-based Rocky Linux 9 simulation. Unlike typical terminal emulators, it features a custom AST-based shell interpreter and a persistent Filesystem Hierarchy Standard (FHS) engine.
It is designed for educational sandboxing, sysadmin training, and realistic operational workflows without the overhead of a local VM.
🚀 Technical Pillars
1. Custom AST Shell Engine
- Lexical Analysis: Custom lexer/parser that builds an Abstract Syntax Tree (AST) for robust command execution.
- Scripting Support: Native execution of
.shandbashscripts withset -e,set +e, and-xtracing. - Pipes & Redirection: Real-time stream handling for stdout redirection and complex command piping.
2. Filesystem Fidelity (FHS)
- VFS Architecture: A stateful virtual filesystem compliant with the Filesystem Hierarchy Standard (FHS).
- Canonical Pathing: Real resolution for
/usr/bin,/etc,/var, and/home/guest. - Persistence: System state, including installed packages and environment variables, is committed to browser storage and survives
rebootcycles.
3. Integrated Tooling & Service Stack
- Package Management: Stateful
dnfworkflow with dependency resolution and install-to-unlock mechanics. - Hardware Simulation: Authentic
/procfilesystem (uptime,cpuinfo,meminfo) and dynamiclsblkintegration. - Identity Management: Simulated user/group stack with
useradd,passwd, andsudoelevation.
🛠 Project Highlights
- Boot Lifecycle: Complete simulation from BIOS/GRUB through kernel boot to the login prompt.
- Interactive Tools: Full-featured
top,htop,less,tail -f, andjournalctl -xe. - Authentic Documentation: Integrated
mansubsystem with high-fidelity manual pages (tryman pocketterm). - Networking: Browser-backed
curl, proxy-styleping, dynamic/proc/net/dev, and boot-seededifcfg-eth0. - Observability: Includes
hostnamectland dynamiccat /proc/uptime.
🧪 Demo Commands
<details> <summary>Show command cookbook</summary>Core shell
help
man ls
pwd
ls -la
type ll
alias
Package and unlock flow
dnf list available
sudo dnf install htop
htop
Services and diagnostics
systemctl status sshd
sudo systemctl restart nginx
ss -tulpn
hostnamectl
journalctl -xe
cat /proc/uptime
cat /proc/cpuinfo
df -h
lsblk
Scripting and path normalization
# Path normalization
cd ///home//guest/
cd /etc/../..//usr/bin/.
# Script execution
echo "cat /proc/cpuinfo" > script.sh
sh script.sh
# Script tracing and error control
echo "set +e" > demo.sh
echo "falsecmd" >> demo.sh
echo "ls" >> demo.sh
bash -x demo.sh
Notes:
cd /////etc//..//../usr/bin.treatsbin.as a literal directory name and returns "No such file or directory" unless/usr/bin.exists.cd /etc/../..//usr/bin/.resolves to/usr/binas expected.echo "cat /proc/cpuinfo" > script.sh && sh script.shprints the simulated CPU info content.
📂 Project Structure
src/engine/- Core shell engine, VFS, AST parser, and command modules.src/components/- Terminal UI, xterm.js integration, and editor overlays.src/App.tsx- System state machine (BIOS -> GRUB -> Boot -> OS).
🚧 Known Simulation Boundaries
- Networking: Simulated bridge; does not expose host-level sockets for security.
- Permissions: Simplified ownership model optimized for educational workflows.
- Hardware: Block devices are simulated;
fdiskandmkfsare staged but non-destructive to host hardware.
Fidelity Notes (0.12.2)
curlreports realistic error families ((22),(23),(28),(47),(7)).cd -uses$OLDPWDand prints the destination path.cd ~always resolves to the canonical sandbox home (/home/guestfor guest), even if$HOMEis changed.- Default muscle-memory alias
llmaps tols -la. - Exported environment variables persist across shell recreation.
/rootpermission surfaces use bash-style "Permission denied" wording.cat /proc/uptimeis dynamic;/proc/cpuinfoand/proc/meminfoare deterministic simulation seeds./proc/net/devnow tracks simulated RX/TX counters and increments on browser-backed network probes (curl,ping).pinguses fetch-based HEAD probes with timeout handling and RTT measurement for browser-safe realism./etc/sysconfig/network-scripts/ifcfg-eth0is generated at boot and aligned with the active simulated interface address.- Stderr-aware redirection now supports
2>,2>>,2>&1, and|&with bash-like left-to-right intent. - Exit-code behavior is hardened for common shell fidelity paths (
127not found,2misuse,130interrupt). pingandcurlfollow a shared resolver contract: literal IP ->/etc/hosts-> DNS fallback.viis now available as a baseline workstation editor, whilevimremains package-gated.mannow resolves pages with deterministic precedence: VFS -> external man-page library -> command-local docs -> fallback map.- Added
lynxfor text-only webpage rendering (lynx -dump <url>). - Direct non-root
rebootnow reportsreboot: must be superuser. - Terminal fit behavior is hardened to reduce Chrome/macOS bottom-line clipping artifacts.
manrenders PocketTerm note sections (POCKETTERM NOTE(S),CHEATSHEET,EXTRA) in yellow in terminal mode and plain text in pipelines/redirections.viis command-registered baseline behavior (not a fallback alias to package-gatedvim).- Alias parsing now preserves quoted argument groups for shell-like alias ergonomics.
- Command parity now uses a canonical manifest (
src/engine/command-manifest.json) with auto-stub fallback for missing commands. - Manifest stubs follow a consistent runtime contract and roadmap note so workstation command discovery remains predictable.
mannow uses pager flow in terminal mode while remaining stream-safe in pipelines/redirections.lesspager search now supports/(forward),?(backward), andn/Nrepeat navigation for man-page exploration.- Interactive man paging now carries contextual footer labels (for example,
bash(1)), whileman ... | catremains clean stream output. - Unknown command typos now emit shell-native “Did you mean …?” suggestions from registry/manifest candidates.
- Prompt hostname is normalized to
pockettermfor consistent workstation-style PS1 formatting. - Cold-start sessions now run a timed systemd-style boot sequence and structured startup MOTD before interactive prompt handoff.
- Package-gated/stub manual pages now use a standardized 57-character
POCKETTERM NOTEinstall block (dnf install <command>) with yellow terminal rendering and plain-text pipeline output. - Last-login startup messaging now persists prior successful login metadata across cold boots for more realistic shell session continuity.
Intentional Simulator Contracts
- Line model:
wc -landgrep -cboth treat final unterminated text as a line for intuitive sandbox behavior. - Pipeline framing: piped command output is normalized as line-oriented data (trailing newline added when needed).
- Resolution source:
typeis the canonical command-resolution model;whichandcommand -vare path-focused views of the same lookup. - Error strings: core commands prefer exact bash-style wording for high-fidelity immersion.
🤝 Support & Connect
If you find this project useful or enjoy the nostalgia, feel free to connect or support the development!
🚀 PocketTerm: Beyond the Sandbox
PocketTerm now supports two aligned tracks while preserving authentic CLI behavior:
🎓 Interactive Learning & Academic Labs
- Guided Cartridges provide a zero-infrastructure teaching path for instructors who need lab-ready shell scenarios without VM setup.
- Tutorials are the intended place to break the fourth wall with direct instructional language.
- Yellow-note guidance remains visible inside docs where learners naturally look (
man+ tutorial surfaces).
🏢 Technical Narrative & Professional Simulation
- Teams can use PocketTerm for technical onboarding, realistic command rehearsal, and technical storytelling with persistent state and stable command contracts.
- Pager flow, search controls (
/,?,n,N), and shell ergonomics stay terminal-native for muscle-memory transfer. - "Yellow-Note" docs create a safe ramp for new operators while keeping production-like command UX.
📬 Inquire: Partnering for Pilot Programs
Interested in partnering on pilot programs for classrooms, onboarding cohorts, or simulation-led technical enablement? Reach out via LinkedIn or Buy Me a Coffee to start a conversation.
🤝 Contributing
Contributions are welcome. Open an issue for discussion first, then submit focused PRs that keep CLI authenticity and simulator fidelity aligned.
License: MIT
Related Skills
tmux
328.6kRemote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output.
blogwatcher
328.6kMonitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.
product
Cloud-agnostic Kubernetes infrastructure with Terraform & Helm for homelabs, edge, and production clusters.
polyglot-k
My Tech Skill Proficient Javascript, Typescript, Java, Express.js, React.js, Spring boot, Spring Jpa, Mysql, Redis, AWS, Docker Experienced Python, Kotlin, Go, Nest.js, Next.js, Flask, C+
