Linux file system is the hard disk space format into a number of node and block data blocks, the creation of general files, directory creation, will occupy a node, if the creation of a file, the specific data stored in a number of block data block, node record data block number, All node and block are numbered in the file system; If you create a directory, it takes a node, and a Block,block records all the file names in that directory, and the block number is recorded in node.
According to the general structure of the Linux file system, using the C + + language to simulate some of the commands executed in the shell in the form of a file: CD, mkdir, Touch, clear, vim, cat, ls
Engineering Structure:
1, node's simulation class file: Node.cpp node.h
2, Block's simulation class file: Block.cpp block.h
3, permissions of the simulation class file: Authority.cpp authority.h
4, Shell simulation class file: Shell.cpp shell.h
5. Initialization class: Init.cpp init.h
6. Project start File: Start.cpp
Command directory:
Cat:cat.cpp cat.h main.cpp Makefile
Ls:ls.cpp ls.h main.cpp Makefile
Mkdir:mkdir.cpp mkdir.h main.cpp Makefile
Touch:touch.cpp touch.h main.cpp Makefile
Rm:rm.cpp rm.h main.cpp Makefile
Cd:cd.cpp cd.h main.cpp Makefile
Vim:vim.cpp vim.h main.cpp Makefile
The specific code in the blog file, the name is Shellmodel.tar, the code rough, their own in order to deepen the understanding of the Linux file system to write the simulation of small works!
Linux mimics Shell operations