Linux bash aliases generator
Project description
topalias
topalias - Linux bash/zsh alias generator and statistics from command history, written on Python.
Features
- Generate short alias for popular command from bash/zsh shell history
- Command history statistics & analytics
- Parametrised input
- Console help for all commands, options and arguments
- Shell workflow hints
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
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:
- directory from execution parameter
- .bash_history in . current directory
- .bash_history in ~ user home directory
- example development files in topalias/data
You can change dot files search path to another user home directory:
topalias -f /home/user # or topalias --path /home/user
- Write your software review and add you awesome aliases to Insights topic or .bash_aliases example.
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
- multiline command in history
- check if alias name already used
- check if alias already added
- add any another acronym algorithm with semantic
- more statistics & analytics (used dir, utils, parameters, time)
- alias max length parameter
- command ignore list flag: top, emacs, vim
- often used command "ssh username@servername" suggest add to .ssh/config/
- find password and other sensitivity data in history and suggest clean (now print "Hint: add space ' ' before sensitive command in terminal for skip save current command in history!")
- добавить локализацию на русский язык в зависимости от локали ОС
Please add you feature requests: https://github.com/CSRedRat/topalias/issues/new
License
Contributors ✨
Thanks goes to these wonderful people (emoji key):
Sergey Chudakov 💻 🚇 🤔 🚧 📦 |
Sergey Morozik 💻 |
GitLab repository mirror with CI/CD: https://gitlab.com/CSRedRat/topalias
GitHub Pages: https://csredrat.github.io/topalias/
Version history
We follow Semantic Versions.
Version 2.0.13
Version 2.0.0
- Add zsh shell support (-z/--zsh flag)
- Add version check (version/--version)
- --filter flag exclude used alias from command top chart
- --debug mode
- -f change dot files search path
- -c count suggestion parameter
- Add "example" command for give aliases example
- Add aliases usage statistic
Version 1.1.7
- Build and publish working package
Version 0.1.0
- Initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file topalias-2.0.20.tar.gz
.
File metadata
- Download URL: topalias-2.0.20.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.0 importlib_metadata/3.7.3 packaging/20.9 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb1932d44622ea9fad3f095ef361481400b6b58fae88decf3ae8efa3ed4aced9 |
|
MD5 | 0050f3d89f592e19538fa197f3ec065d |
|
BLAKE2b-256 | ca1d979e34fa5329375c5f4a99d5621cff5f9f653704f9249cb447ae7611bcb3 |
File details
Details for the file topalias-2.0.20-py2.py3-none-any.whl
.
File metadata
- Download URL: topalias-2.0.20-py2.py3-none-any.whl
- Upload date:
- Size: 23.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.0 importlib_metadata/3.7.3 packaging/20.9 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7aaf51ae0b07756f716fa4d3dae12a20c23d48a5217f4feb66db1c0bf9d7cf91 |
|
MD5 | 777ca2b4000d0afd3f5825a8a08e7ec6 |
|
BLAKE2b-256 | 0847a17d9a655fbf5d26289e65a73203650a0920c6d162f6dec3dbe4cdbf7ac7 |