Skip to content

mr-70da/Command-Line-Interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 

Repository files navigation

Command Line Interpreter (CLI)

This project is a basic Command Line Interpreter (CLI) inspired by Unix/Linux shells. The CLI allows users to execute common system commands and includes internal commands for additional functionality.

Features

1. Command Execution

The CLI supports executing standard system commands, enabling users to interact with the file system and manage files. Supported commands include:

  • pwd: Prints the current working directory.
  • cd <directory>: Changes the current directory to the specified path.
  • ls: Lists files in the current directory.
    • ls -a: Lists all files, including hidden files.
    • ls -r: Lists files in reverse order.
  • mkdir <directory>: Creates a new directory.
  • rmdir <directory>: Removes an empty directory.
  • touch <file>: Creates a new file or updates the timestamp of an existing file.
  • mv <source> <destination>: Moves or renames files and directories.
  • rm <file>: Removes a specified file.
  • cat <file>: Displays the content of a specified file.
  • Redirection and Pipes:
    • >: Redirects output to a file, creating it if it doesn't exist.
    • >>: Appends output to an existing file.
    • |: Pipes output from one command to another (if applicable).

2. Internal Commands

The CLI also includes internal commands:

  • exit: Terminates the CLI session.
  • help: Displays a list of available commands and usage instructions.

Getting Started

Prerequisites

  • Java Development Kit (JDK) version 8 or higher.

Installation

  1. Clone the repository:
    git clone https://github.com/your-username/cli-project.git
  2. Navigate to the project directory:
    cd cli-project
  3. Compile the Java files:
    javac *.java
  4. Run the program:
    java CLI

Usage

  1. After running CLI, you’ll be presented with a command prompt.
  2. Enter any of the supported commands listed above to interact with the CLI.
  3. Use help for a list of available commands.
  4. Use exit to close the CLI session.

Examples

  • To print the current directory:
    pwd
  • To create a new directory named test:
    mkdir test
  • To display contents of a file named example.txt:
    cat example.txt
  • To redirect the output of ls to a file:
    ls > output.txt

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages