Skip to content

aleixbermudez/cline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cline - Mini Shell in C

Personal project to learn and practice C by building a custom interactive shell.


Description

cline is a simple shell (command interpreter) written in C, created as an educational tool to get hands-on experience with core concepts of the C language and system programming.

This project simulates a simplified Unix/Linux console, allowing command execution, directory changes, and exiting with the exit command. It is designed to be cross-platform, working on both Linux/WSL and Windows (MinGW/MSYS2), adapting execution based on the operating system.


Current Features

  • Dynamic prompt showing username, hostname, and current directory with ANSI colors.
  • Support for built-in commands:
    • cd to change directories.
    • exit to quit the shell.
  • Execution of external commands via execvp (Linux) or system() (Windows).
  • Simple input tokenization.
  • Basic error handling and input cleanup.

Technologies Used

  • Pure C language.
  • POSIX APIs for Linux/Unix.
  • Adapted functions for Windows compatibility.
  • Makefile for easy compilation.

Future Improvements

This project is a starting point and has plenty of room to grow. Some ideas for upcoming versions include:

  • Command history: save and navigate through previous commands with arrow keys.
  • Command and path autocompletion.
  • Input/output redirection (>, <, >>).
  • Pipes (|) to chain commands.
  • Custom environment variables support.
  • Background process handling.
  • Better signal handling (Ctrl+C, Ctrl+Z).
  • Graphical interface or improved integration with modern terminals.
  • Code modularization and cleanup for easier extension.

How to Compile and Run

On a compatible terminal (Linux, WSL, MinGW/MSYS2):

make
./cline

On Windows, the executable will be cline.exe and can be run directly from the command prompt.


Contributions

This project is mainly for personal learning, but if you'd like to contribute ideas or improvements, pull requests and suggestions are very welcome!


License

MIT License © Aleix


Thanks for checking out this project! I hope cline is as useful to you as it has been for my C and systems programming learning journey.

About

Simple, customizable shell implemented in C. A learning project focused on understanding core system programming concepts, command execution, and process management. Great for anyone interested in exploring C and building foundational tools.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors