Linux mimics Shell operations

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.