This is a simple shell made for fun. It is written in the C programming language and is following the gnu17 standard. Use it to interact with your Linux system. It is configured with a resource file at ~/.kosmosrc
. The shell supports basic autocompletion of filenames. Any program can be run in it, including some built-in functions.
Install the shell with these simple steps. This shell is for Linux systems only!
Install kosmos by running these commands, or download it from the release page.
git clone https://github.com/Potato-git13/kosmos.git
cd kosmos/
make all install
It is recommended to download from the repository to get the latest updates and fixes. If you download the shell from the release page, you will have to manually copy the binary to /bin
.
Run these commands to clone the repository and to change the current directory to it:
git clone https://github.com/Potato-git13/kosmos.git
cd kosmos/
Program files are located in the src/
directory. Most functions are defined in their separate header file located in the src/components/
or src/util/
subdirectory.
Compile the project with make compile-debug
for more information when debugging.
- readline
- gcc
- make
To install those on ubuntu-based distros, run: sudo apt install libreadline-dev gcc make
.
If you already installed it, run kosmos
from the terminal, otherwise you can find the compiled binary in the bin/
directory. This will drop you directly to the shell. If you want more information about the program usage, run kosmos -h
.
There are built-in functions to add aliases and set environment variables. Example:
alias ls "ls --color"
export PATH /bin:$PATH
By editing the HISTSIZE
and SAVEHIST
variables in the src/components/defvars.h
file, you can customize how many lines are saved to history and how many lines are written to the history file located at ~/.kosmos_history
.
After editing the file, you will have to recompile the shell.
The resource file is located at ~/.kosmosrc
and is read on shell startup. The commands are executed line by line. Any errors will be written to standard error (stderr).
The history file is located at ~/.kosmos_history
. Everything entered into the shell is logged here, besides the empty inputs.
The command prompt is made from the PS1 environment variable. If the variable is empty a default prompt will be used. Set your prompt in the resource file with the export command. To colorize text use these symbols to represent a color:
\b\ - Blue
\bb\ - Blue Bold
\c\ - Cyan
\cb\ - Cyan Bold
\g\ - Green
\gb\ - Green Bold
\m\ - Magenta
\mb\ - Magenta Bold
\r\ - Red
\rb\ - Red Bold
\reset\ - Reset(reset the color)
And these are the variables you can use in the prompt:
\u\ - User
\h\ - Host
\s\ - Current working directory
This is an example of a prompt:
export PS1 "\reset\[\yb\\u\\reset\@\b\\h\\reset\]:\m\\s\\reset\\$ "
Contributing is as easy as:
- creating a fork of the repository,
- adding your changes,
- opening a pull request.
These are some loose guidelines for contributing to make it easier for everyone.
Please add comments to your code, so everyone can understand what's happening.
In your pull request, explain the issue you fixed/what you added. If you are fixing an issue, reference the issue number in the pull request message.
Be kind and civil when communicating with others.