Easy Alias is a lightweight and user-friendly command-line tool designed to simplify the creation and management of shell aliases. This script allows users to quickly define new aliases, view existing ones, and immediately use them in their shell environment.
- Create New Aliases: Prompt-based alias creation with real-time feedback.
- List Existing Aliases: Display all defined aliases in a color-coded format for easy reading.
- Alias names are displayed in blue.
- Alias commands are displayed in green.
- Auto-Installation: The script automatically adds itself as:
alias-new
: For creating new aliases.alias-list
: For listing all existing aliases.
- Backup Configuration: Creates a backup of the shell configuration file (
~/.zshrc
or~/.bashrc
) before making changes. - Shell Compatibility: Supports Zsh and Bash shells.
- Immediate Usage: Sources the shell configuration file so aliases are available immediately.
-
Clone the Repository:
git clone https://github.com/KukicVidan/easy-alias.git
-
Navigate to the Directory:
cd easy-alias
-
Make the Script Executable:
chmod +x alias_builder.sh
To start the alias builder, simply execute the script:
./alias_builder.sh
- The script will prompt you to enter the alias name.
- Then, you’ll be prompted to enter the command the alias should execute.
- The alias will be saved and made immediately available in your shell.
Alternatively, once the script is run for the first time, you can use:
alias-new
This command performs the same functionality as running the script.
To list all currently defined aliases, use the command:
alias-list
This will display a color-coded list of aliases, where:
- Alias names are in blue.
- Alias commands are in green.
A backup of your shell configuration file is created at ~/.zshrc.backup
or ~/.bashrc.backup
during the first run.
To remove Easy Alias and its associated functionality:
- Open your shell configuration file (
~/.zshrc
or~/.bashrc
) in a text editor:nano ~/.zshrc # or nano ~/.bashrc
- Delete the following lines:
alias alias-new='bash /path/to/alias_builder.sh' alias alias-list='bash /path/to/alias_builder.sh --list'
- Save the file and exit the editor.
- Source the shell configuration file to apply changes:
source ~/.zshrc # or source ~/.bashrc
- Optionally, delete the script and repository folder:
rm -rf /path/to/easy-alias
- Run the script to initialize it:
./alias_builder.sh
- Create an alias for listing files:
- Enter alias name:
lsf
- Enter command:
ls -lh
- Enter alias name:
- Use the alias immediately:
lsf
- List all aliases:
Output:
alias-list
lsf=ls -lh
- The script modifies your shell configuration file (
~/.zshrc
or~/.bashrc
) to store aliases and add thealias-new
andalias-list
commands. - If you switch shells, rerun the script to configure the aliases for the new shell.
Contributions are welcome! Please open an issue or submit a pull request with your improvements.
This project is licensed under the MIT License. You are free to use, modify, and distribute this software.