A fully functional browser-based Linux terminal simulator built with Next.js 16, React, and TypeScript. ShellPlay brings a complete Linux environment to your browser with 100+ commands, a full shell script interpreter, and a virtual filesystem. All state lives in memory only—when you close the browser, everything is wiped clean. Perfect for learning, experimenting, and playing with Linux safely.
- 100+ Linux Commands: Full support for navigation, file operations, text processing, system info, process management, networking, storage, user management, and more
- Comprehensive Command Catalog: Click "Commands" button to browse all available commands with descriptions and usage, organized by 9 categories
- Full Shell Script Interpreter: Execute bash scripts with variables, loops, conditionals, functions, command substitution, arithmetic, and trace mode
- In-Memory Virtual Filesystem: Realistic Linux directory structure with files, permissions, ownership, timestamps, and full CRUD operations
- Authentic Terminal Feel: Dark aesthetic with green (#00ff88) or amber (#ffb700) text on black background (#0d0d0d), blinking cursor, realistic prompts
- Interactive Features: Command history (↑↓ arrows), Tab autocomplete, real-time command descriptions, theme toggle
- Safe Learning Environment: No persistence, no side effects—experiment fearlessly
- Responsive & Mobile-Friendly: Works perfectly on desktop and mobile devices
- Current Path Display: Shows
user@linux-sim: /current/pathon the left - Commands Button: Opens a comprehensive modal showing all 40+ commands organized by category (Navigation, File Operations, Text Processing, System Info, Process Management, Networking, Utilities) with descriptions. Click any command to auto-fill the input!
- Theme Toggle: Switch between green (#00ff88) and amber (#ffb700) terminal colors
- Help Button: Quick cheatsheet with common command examples
- Displays command history and output with proper syntax highlighting (errors in red)
- Blinking cursor indicates ready-to-accept input
- Scrollable output area with smart scroll-locking (stops at bottom when new commands arrive)
- Realistic prompt format:
user@linux-sim:/path$ - Placeholder text with keyboard hints (↑/↓ for history, Tab for autocomplete)
- Blinking cursor at the end of input
/lib/
filesystem.ts # Virtual filesystem data structure and operations
commandExecutor.ts # 50+ Linux command implementations
shellInterpreter.ts # Bash script interpreter
/components/
TerminalSimulator.tsx # Main React UI component with modals and responsive design
/app/
page.tsx # Entry point
layout.tsx # Root layout with metadata
globals.css # Global styles
ls [path] [-l] [-a]- List directory contentscd [path]- Change directory (supports ~, .., ., absolute/relative paths)pwd- Print working directorymkdir [-p] path- Create directoryrmdir path- Remove empty directoryrm [-r] [-f] file- Remove file/directorycp [-r] src dst- Copy file/directorymv src dst- Move/renamecat file- Print file contentstouch file- Create or update filehead [-n N] file- First N linestail [-n N] file- Last N linesfind path -name pattern- Search files
grep [-r] [-i] [-n] pattern [file]- Search with highlightingawk '{print $N}' file- Text parsingsed 's/old/new/g' file- Substitutionsort [-r] [-n] [file]- Sort linescut -d',' -f1,2 file- Cut fieldswc [-l] [-w] [-c] file- Count lines/words/charsdiff file1 file2- File differencescmp file1 file2- Binary comparison
chmod [octal|symbolic] file- Change permissionschown user:group file- Change ownergetfacl file- Show ACLsetfacl -m u:user:rwx file- Set ACL
whoami- Current user ("great dhanush")id- User/group infouname [-a]- System informationdate- Current date/timecal- Calendarfree [-h]- Memory usagedf [-h]- Disk usagedu [-h] [-s] path- Directory sizeps [aux]- Process listtop- Process monitor (interactive)kill [PID]- Terminate processpkill [name]- Kill by name
ifconfig- Network interfacesping -c 4 host- ICMP pingcurl URL- HTTP requestwget URL- Download filenetstat- Open portsss- Socket statisticsnslookup domain- DNS lookupdig domain- DNS querytraceroute host- Route trace
su [user]- Switch usersudo cmd- Run as rootuseradd [-m] user- Add useruserdel user- Delete userpasswd user- Change passwordgroups user- Show groupscrontab [-e|-l]- Cron jobs
bash [script.sh]- Run bash script or shellsh [script.sh]- Run shell scriptsleep N- Pause N seconds- Pipe operator:
cmd1 | cmd2 | cmd3 - Output redirection:
cmd > file,cmd >> file
echo text- Print textclear- Clear screenhelp- Command helpman [command]- Manual pageshistory- Command historyenv- Environment variablesexport VAR=value- Set variablealias name='cmd'- Create aliaswhich cmd- Find commanddmesg- Kernel messagesvmstat- Virtual memory statsiostat- I/O statisticsw- Logged-in usersexit- Exit terminal
The simulator initializes with a realistic Linux directory tree:
/ (root)
├── home/
│ └── user/
│ ├── documents/
│ ├── downloads/
│ └── README.txt
├── etc/
│ ├── passwd (full system user list)
│ └── hostname
├── var/
│ └── log/
│ └── syslog (fake kernel logs)
├── proc/
│ ├── cpuinfo (Intel Core i5 specs)
│ └── meminfo (8GB RAM details)
├── tmp/
├── bin/
│ ├── bash
│ └── sh
└── usr/
└── bin/
Files support:
- Content (string)
- Permissions (Unix-style: rwxr-xr-x)
- Owner and group
- Size and timestamps
- Directory/symlink types
- Dark background (#0d0d0d) with green or amber text
- Top bar showing current path, username, and theme toggle
- Blinking cursor ▮ for authenticity
- Scrollable output with automatic scroll-to-bottom
- Help overlay with command cheatsheet (click ?)
- Theme toggle between green (#00ff88) and amber (#ffb700)
- Command input at bottom (always focused)
- History navigation with ↑ and ↓ arrow keys
- Tab autocomplete for common commands
- Enter to execute commands
- Responsive design works on desktop and mobile
- Node.js 18+ or compatible runtime
- pnpm, npm, or yarn
# Clone or download the project
cd linux-terminal-simulator
# Install dependencies
pnpm install
# or: npm install
# Start the dev server
pnpm dev
# or: npm run devThe terminal will be available at http://localhost:3000.
pnpm build
pnpm startuser@linux-sim:~$ pwd
/home/user
user@linux-sim:~$ ls -la
drwxr-xr-x user user 4096 documents
drwxr-xr-x user user 4096 downloads
-rw-r--r-- user user 76 README.txt
user@linux-sim:~$ cd documents
user@linux-sim:~/documents$ pwd
/home/user/documents
user@linux-sim:~$ cat README.txt
Welcome to the Linux Terminal Simulator!
Type "help" to see all available commands.
user@linux-sim:~$ echo "Hello, World!" > greeting.txt
user@linux-sim:~$ cat greeting.txt
Hello, World!
user@linux-sim:~$ cp greeting.txt backup.txt
user@linux-sim:~$ ls
greeting.txt backup.txt
user@linux-sim:~$ grep -n "Linux" README.txt
1:Welcome to the Linux Terminal Simulator!
user@linux-sim:~$ cat /etc/passwd | grep "user"
user:x:1000:1000:user:/home/user:/bin/bash
user@linux-sim:~$ whoami
user
user@linux-sim:~$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.1 0.5 48099 5429 ? S 10:23 00:00:05 /sbin/init
...
user@linux-sim:~$ free -h
total used free shared buff/cache available
Mem: 8048M 3500M 2000M 0M 1500M 6200M
user@linux-sim:~$ ps
PID TTY TIME CMD
768 ? 00:00:45 bash
1024 ? 00:01:30 apache2
user@linux-sim:~$ kill 1024
[1] Terminated
The filesystem is implemented as a nested JavaScript object where each node contains:
name: The node nametype: 'file', 'directory', or 'symlink'content: File content (for files)children: Child nodes (for directories)permissions: Unix-style permission stringownerandgroup: Ownership infosize: File size in bytesmodifiedandcreated: Timestamps
All operations are in-memory with no disk I/O, making them instant and safe for learning.
The CommandExecutor class implements 50+ commands. Each command:
- Parses arguments and options
- Operates on the virtual filesystem
- Returns formatted output
- Handles errors gracefully with realistic error messages
The ShellInterpreter supports:
- Variable assignment and substitution (
VAR=value,$VAR) - Command substitution (
$(cmd)) - Basic loops (for, while, until)
- Conditionals (if/then/elif/else)
- Piping and redirection
Two carefully chosen terminal color schemes:
- Green: Classic CRT terminal look (#00ff88 on #0d0d0d)
- Amber: Vintage monochrome aesthetic (#ffb700 on #0d0d0d)
Both use JetBrains Mono font for authentic monospace rendering.
- No actual network access (curl, wget, ping are simulated)
- No actual process creation (top, ps show fake data)
- Shell script support is simplified (basic features only)
- No persistence between sessions
- No file size limits
- Terminal resizing not fully responsive
- Full shell script interpreter with regex and complex patterns
- Custom commands via JavaScript snippets
- File upload/download simulation
- Multi-user session support
- Command timing and performance simulation
- Syntax highlighting for output
- Scrollback buffer limits
- Keyboard macro support
This is a Next.js 16 application with:
- React 19 for the UI component
- TypeScript for type safety
- Tailwind CSS for styling
- No external dependencies for the filesystem/command engine
All core logic (filesystem, commands, shell interpreter) is pure TypeScript with no external libraries, making it lightweight and portable.
This terminal simulator was built as an educational tool for learning Linux commands and shell scripting in a safe, browser-based environment.
Happy terminal exploring! Type help to begin.