Skip to main content

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

  • 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

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:

  • 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

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

  • 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/

License

GPLv3

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Sergey Chudakov

💻 🚇 🤔 🚧 📦

Sergey Morozik

🚧 📦💻

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

Metadata

Release files for topalias 4.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for topalias 4.3.1
File Size Uploaded
topalias-4.3.1.tar.gz 30.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for topalias 4.3.1
File Interpreter ABI Platform
topalias-4.3.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 64.2 kB

Release files / topalias-4.3.1.tar.gz

Download URL topalias-4.3.1.tar.gz
Size 30.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7cf5daeebca419b0a4ea5715f7da3f79d507694108675cfbb2012f1da037ec3b
BLAKE2b-256 checksum
How to use checksums
fbdcc3cbff0be0cad5be6b915c99f8565f71bb7b9dbe37a277b4d93383d0ea5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.10.11 Windows/10

Release files / topalias-4.3.1-py2.py3-none-any.whl

Download URL topalias-4.3.1-py2.py3-none-any.whl
Size 33.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
f99a24b620249bc3f9539b05682fa6e9970fde094745d65c76916750eef2a06c
BLAKE2b-256 checksum
How to use checksums
d48e2af8c78619ab7522229aa6bc168a0b7e16c322220ef418b0b32150df954d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.10.11 Windows/10

Release history Release notifications | RSS feed

This release

4.3.1 This release

2 release files

4.3.0

2 release files

4.1.0

2 release files

4.0.0

2 release files

3.2.0

2 release files

3.0.0

2 release files

2.0.26

1 release file

2.0.25

1 release file

2.0.24

1 release file

2.0.22

1 release file

2.0.20

2 release files

2.0.15

2 release files

2.0.14

2 release files

2.0.13

2 release files

2.0.12

2 release files

2.0.11

2 release files

2.0.10

2 release files

2.0.9

2 release files

2.0.8

2 release files

2.0.7

2 release files

2.0.6

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.1

2 release files

1.2.9

2 release files

1.2.8

2 release files

1.2.7

2 release files

1.2.6

3 release files

1.2.5

3 release files

1.2.4

3 release files

1.2.3

3 release files

1.2.2

3 release files

1.2.1

3 release files

1.2.0

3 release files

1.1.6

2 release files

1.1.3

2 release files

1.0.7

2 release files

1.0.5

2 release files

1.0.4

1 release file

0.1.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page