Files
2026-04-05 20:19:07 +03:00

54 lines
3.0 KiB
Markdown

# Servalias: a shell alias system friendly for your paws
## What is it?
Servalias is a curated, forever free, modular shell alias collection for Unix-like operating systems, designed to make routine tasks much easier.
All the aliases provided in this repo are designed to be POSIX-compatible.
**Note:** for a minimal, barebones alias file built upon the same architecture, see [.luxrc](https://luxferre.top/.luxrc).
## Installation
First, clone the repo and remove the cruft:
```
git clone https://codeberg.org/luxferre/servalias.git ~/.aliases && rm -rf ~/.aliases/.git ~/.aliases/README.md
```
Then, append the following line to your shell's RC file (for Bash, it's usually `.bashrc`):
```
[ -f ~/.aliases/main ] && . ~/.aliases/main
```
## Modules
By default, Servalias is shipped with the following modules:
* `main`: the entry point that contains the alias management framework, **do not touch unless absolutely necessary**;
* `core`: the core commands that can be reused within any other module;
* `sys`: OS-specific stuff that's supposed to be modified according to your distribution (the included alias set is for Void Linux);
* `net`: aliases related to any networking activity;
* `dev`: aliases related to any development or DevOps activity;
* `media`: multimedia-related aliases;
* `custom`: aliases created automatically via other commands, like `savealias` (see below).
Every module can be edited with the `aliases-[modulename]` command (e.g. `aliases-net`). These commands use the `$EDITOR` environment variable to open corresponding files, defaulting to `vim` if such a variable isn't set.
## Custom aliases
Once Servalias is plugged into your shell, you can do all sorts of tricks with custom alias definitions.
Scenario 1: you need to define an alias that uses positional parameters within your command. The standard `alias` would require some sort of function wrapping to achieve this. For this purpose, the `defalias` macro exists here. You just write `defalias myname '...all sorts of crazy stuff...'` and you'll see the alias being saved properly with all the wrappers applied.
Scenario 2: you have come up with a really long command line that you have tested and want to turn into an alias right away. To do this without additional copy-pasting, use the `toalias [name]` macro. It will take the most recent line in your command history and turn it into a ready-to-use alias.
Scenario 3: you have created a new alias (with the usual `alias` command or with Servalias macros like `defalias` or `toalias`) and really liked it, but now you want to save it to reuse in future shell sessions. Again, to avoid any copy-pasting, the `savealias [name]` command allows you to save any live alias of your choice into the `custom` module which will be reloaded alongside the others on the next session.
By the way, in case you prefer editing the files manually and not via `aliases-[modulename]` commands, you can apply your changes after saving the files with `reload-aliases` command.
## Credits
Created by Luxferre in 2026, released into public domain with no warranties.