File System Simulator

A Simple File System Simulator for people wanting to learn some basic linux commands
By
Report Bug · Request Feature

GitHub issues GitHub forks GitHub stars

About The Project

Hello, this is a simple file simulation where people can learn how to use some of the basic linux commands.

Built With

forthebadge

Hardware Requirements

  • RAM-2GB
  • Memory-500 MB
  • HDD/SDD- 4 GB

Getting Started

Installation - Linux

  1. Install java
   sudo apt update
   sudo apt install default-jre
  1. Setup MySQL
   sudo apt-get install sudo apt-get install mysql-server-8.0 mysql-client-core-8.0
   sudo mysql
  1. Add new user with superuser capabilities
   CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
   GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' WITH GRANT OPTION;
  1. Run the jar file given in the folder using
    java -jar File_System_Simulator.jar

Installation - Windows

  1. Install Java from https://www.java.com/en/

  2. Download MySQL (mysql-installer-community-8.0.30.0.msi) server from https://dev.mysql.com/downloads/installer/ (Version)

  3. In the select products to install select Server(Or Default option) and proceed with default options

  4. For Types and Networking and Authentication method do next. In the next section Enter the new root password and in the add user section add useruser with username as 'username' and password as 'password'.

  5. Now proceed to the next section and after the successfull installation open the MySQL 8.0 Command Line Client

  6. Enter the root password and paste the below command

   GRANT ALL PRIVILEGES ON . TO 'username'@'localhost';

Note: If the user 'username' doesn't exist type the below command before grating privilages

    CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';

Some Sample Commands Usages

1. mkdir

mkdir is used to make a new directory

Usage

 mkdir dirname

2. cd

cd is a command can be used to change a directory

Usage

cd dirname

3. ls

ls command is used to list all files of an directory

Usage

ls

or

ls dirname

4. touch

touch is used to create a regular file

Usage

touch filename

5. cat

cat is used to display contents of a file

Usage

cat filename

6. rmdir

rmdir is used to delete a directory

Usage

rmdir filename

7. rm

rm is used to delete a file

Usage

rm file

8. lnk

link is used to create shortcuts of a file or directory

Usage

lnk srcname destname

9. mv

mv is used to move a file from one location to another. If the srcname is the same as destname then it is similar to renaming

Usage

mv srcname destname

10. grep

grep can be used for pattern matching

Usage

grep pattern text

11. Traversal through '/', '..', '.'

Multilevel traversal is possible using '/' to specify the path as we go from each outer directory to inner directory. The name for the root folder is '/' which can be accessed from any folder. The parent can be accessed using '..' meanwhile the current folder by '.' .This can be used for any command where path is used

Some Example Usages

1. Move to root
cd /
  1. Make a directory in parent directory
mkdir ../dirname
  1. Make a in a inner directory from root (Note that all the directory except the outer ones must exist)
mkdir /dir1/dir2/dir3/dirname

12. Piping

Piping can be used here to send the output of one command as a parameter to the next one

Usage (Here the content of the file is given as the 2nd parameter to the grep command)

cat filename | grep pattern