Teach Terminal
I made Teach Terminal - a browser-based Linux terminal simulator for learning basic Linux commands.
The main problem I wanted to solve is that learning Linux from documentation can be very passive. You read what cd or chmod does, but you don’t really remember it until you use it yourself. Also, using a real Linux system can be a little scary for beginners because one wrong command can cause problems.
Teach Terminal gives you a fake Linux filesystem where you can practice without breaking a real computer. You can log in, choose a mode, and start learning. There are 25 lessons in 5 sections: Introduction, Navigation, Files, Text & Redirection, and Permissions.
Every lesson has a small lecture and then practice. In the practice you need to type commands yourself, for example pwd, ls -la, chmod 755, or sudo chown root file.txt. The terminal gives output and errors similar to what you can get in a real Ubuntu terminal.
Note: This is a simulation. It does not enforce all Linux permissions and security rules, so some commands may behave differently than on a real system.
What was challenging
The fake filesystem was one of the harder parts.
I made two classes for it. FileSystem handles the filesystem tree and navigation, and file represents the individual files and folders. It also stores things like permissions, owner, size and modification date.
Getting absolute paths working was also a little difficult. I needed to go from the current file or folder to its parents until I reach the root. It is kind of like following a linked list backwards.
Another problem was checking commands in multi-step practices. For example, when a user runs sudo chown root file.txt, the practice checker needs to check the whole command and not only chown root file.txt.
I also had problems with resetting the practice state. If I make a folder with mkdir projects and then start the same practice again, it will fail because the folder already exists. So I needed to reset the practice filesystem when starting it again.
Things I am happy with
The lesson engine is probably the part I worked most on. It handles the lecture, practice, success state, and the progress for each step.
I also made the lesson window draggable and minimizable. Pressing Escape can toggle the window.
The terminal currently supports 16 commands and some extra features like flags, redirection (>, >>, <, 2>), tab autocomplete, arrow-key command history, and sudo with password checking.
I also added 3 themes: Ubuntu, Hacker and Kali. The themes are used across the different pages.
How to test
- Open the demo link.
- Go to Settings and choose a theme: Ubuntu, Hacker, or Kali.
- Log in with a valid username, machine name and password.
- Choose Guided Path if you want to try the lessons, or Free Exploration if you just want to use the terminal.
- In a lesson, read the lecture and click Start Practice.
- Type the commands in the terminal and follow the steps.
Some commands you can try:
pwdls -lamkdir testcd testtouch file.txtchmod 755 file.txtsudo chown root file.txt
The project is made with plain HTML, CSS and JavaScript. I didn’t use frameworks or external dependencies.
- 7 devlogs
- 42h
- 18.43x multiplier
- 351 Stardust
- Frictionless