This project is a simple command-line interface (CLI) implemented using Java and Swing. It simulates a terminal/command prompt experience with a few basic commands like ls, cd, pwd, and exit. The program is designed to be used as a terminal emulator with the following features:
- Directory Navigation: Change directories and list files.
- Command Execution: Execute simple terminal commands.
- Simple UI: A graphical user interface (GUI) that mimics a Linux terminal.
-
Directory Navigation:
cd <directory>: Change the current directory.pwd: Display the current directory path.ls: List files in the current directory.touch: Creates a new empty file.rmvf: Deletes the file in the directory.
-
Exit the Program:
exit: Exit the terminal.
-
Keyboard Shortcuts:
- Enter: Submit a command.
- Ctrl + q: Exit the application.
To use the Command Prompt, you'll need to have Java installed on your machine.
Clone the project to your local machine:
git clone https://github.com/your-username/command-prompt.gitNavigate to the project directory and compile the Java file:
javac CommandPrompt.javaAfter compiling, run the application using the following command:
java CommandPromptOnce the program starts, a window will appear that simulates a terminal. The current directory will be displayed followed by the % prompt. You can type commands like:
-
lsto list the files in the current directory. -
cdto change the current directory. -
pwdto show the current directory path. -
touchto create a new file. -
rmvfdeletes the file. -
exitto close the terminal.
Contributions
Feel free to fork the project and submit pull requests with any improvements or bug fixes.
This project is licensed under the MIT License.