Home

Awesome

topalias

Test Status Coverage GitLab pipeline Python Version Downloads Code style: black Imports: isort DeepSource

topalias - Linux alias generator from bash/zsh command history with statistics, written on Python.

Features

Installation

From pypi.org repository:

pip3 install -U --user topalias

From source:

git clone https://github.com/CSRedRat/topalias
python3 topalias/setup.py install --user

Run as python script without install:

git clone https://github.com/CSRedRat/topalias
python3 topalias/topalias/cli.py -h

Install requirements

sudo apt install python3 python3-pip -y

Add PATH environment variable for run Python tools as Linux utility:

echo "export PATH=$PATH:$HOME/.local/bin" >> ~/.bashrc
source ~/.bashrc

Usage

generated bash aliases

Without parameters utility check if you use alias in ~/.bash_aliases - analyze and print usage statistics, then find new simple aliases

python3 -m topalias  # run as python module
topalias  # check aliases and print suggestion bash command history
topalias -h  # print help
topalias --zsh  # work with zsh shell command history
topalias --min=2  # set minimal length for generated acronym filter, so that exclude some short command and find long, hard, usable command
topalias --debug history  # only analyze local bash history and print filtered rows

Files path search order:

You can change dot files search path to another user home directory:

topalias -f /home/user  # or topalias --path /home/user

Also you can use topalias utility in Bash for Git on Windows and in WSL.

Documentation

Usage: topalias [OPTIONS] COMMAND [ARGS]

Options:
  -l, --min INTEGER     Print alias acronym not less that value. Default: 1
  -c, --count INTEGER   Print specified number acronym suggestions. Default:
                        20

  --filter              Filter used aliases in history. Default: False
  -z, --zsh             Use zsh shell history file .zsh_history. Default:
                        False

  -f, --path TEXT       Change custom directory for files: .bash_aliases,
                        .bash_history, .zsh_history

  --version             Print current program version and check latest on
                        pypi.org.

  --debug / --no-debug  Enable debug strings in output.
  -h, --help            Show this message and exit.

Commands:
  hint     Print all hints.
  history  Print bash history file.
  version  Get program current and available version.

TODO

License

GPLv3

Contributors ✨

Thanks goes to these wonderful people (emoji key):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore-start --> <!-- markdownlint-disable --> <table> <tr> <td align="center"><a href="https://github.com/CSRedRat"><img src="https://avatars1.githubusercontent.com/u/1287586?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sergey Chudakov</b></sub></a><br /><a href="https://github.com/CSRedRat/topalias/commits?author=CSRedRat" title="Code">💻</a> <a href="#infra-CSRedRat" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#ideas-CSRedRat" title="Ideas, Planning, & Feedback">🤔</a> <a href="#maintenance-CSRedRat" title="Maintenance">🚧</a> <a href="#platform-CSRedRat" title="Packaging/porting to new platform">📦</a></td> <td align="center"><a href="https://github.com/morozsm"><img src="https://avatars2.githubusercontent.com/u/4393731?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sergey Morozik</b></sub></a><br /><a href="https://github.com/CSRedRat/topalias/commits?author=morozsm" title="Code">💻</a></td> </tr> </table> <!-- markdownlint-restore --> <!-- prettier-ignore-end --> <!-- ALL-CONTRIBUTORS-LIST:END -->

GitLab repository mirror with CI/CD: https://gitlab.com/CSRedRat/topalias