A small UNIX-like shell written in C++ that simulates an in-memory file system with persistence. The file tree is held in memory while the shell is running and serialized to filesystem_state.txt on exit, so it is restored on the next launch.
Requires a C++11 compiler (tested with g++).
make compileOr directly:
g++ -std=c++11 -Wall -Wextra -o shell main.cppmake alone will clean, compile, and launch the shell.
./shellA prompt like 02:47:32 /> is shown — the current time and the working directory inside the simulated file system.
Type help to see the command list, or exit to save state and quit.
- Three file types: regular files, directories, and soft links.
- Persistence: on
exit, the entire tree (including soft links) is written tofilesystem_state.txtand restored on startup. - Per-directory disk quota: each directory is capped at 10 MB of direct content;
addFilerejects with an error if the limit is exceeded. - Broken-link detection: if a soft link's target is removed with
rm, the link is marked broken andcatreports it instead of crashing. - Duplicate-name protection: creating two entries with the same name in the same directory is rejected.
.
├── main.cpp # all shell, file-system, and serialization code
├── makefile # clean/compile/run targets
├── .gitattributes
├── .gitignore
└── README.md
