Skip to main content

A text base UI for collecting and finding termial commands.

Project description

TermCheat: your terminal cheat sheet

Synopsis

TermCheat is a searchable library of commands that you can copy remix and extend.

TermCheat screenshot

Usage

term-cheat

Even better if you add a keyboard shortcut to start TermCheat e.g. Ctrla

Add this to your .bashrc or .zshrc or ...

bindkey -s '^A' 'term-cheat --filter^M'
  • -s simulate keyboard input
  • ^A Ctrla
  • ^M Enter key to run the command

Keyboard Shortcuts

In list mode

  • enter execute command
  • / to fuzzy filter / search for a command
  • a add new command
  • e edit selected command
  • d delected the selected command

In edit mode

  • esc to leave edit mode without saving
  • ctrl o to save the command to your database

In filter mode

  • esc to clear the filter

Installation

While the package is waiting for approval from the snap store you can install it by downloading it from here and installing it with snap.

curl -OL https://github.com/select/term-cheat/releases/download/0.1.11/term-cheat-0.1.11_amd64.snap
sudo snap install --classic --dangerous term-cheat-0.1.11_amd64.snap

To install it from source do the following.

git clone https://github.com/select/term-cheat.git
cd term-cheat
pipenv install
pipenv shell
python3 term-cheat-app

Related Tools and Projects

Reveser History Search
Search through your shell history with CtrlR

Alias
Create a file that contains aliases for your most used commands. Create a the aliases file with touch ~/.aliases and add some aliases like

alias lt='ls -ltr'
alias df='pydf -h -B'

now source the file in your .bashrc or .zshrc

source $HOME/.aliases

You could write all aliases directly in you rc file but this way it's more portable if you switch from e.g. bash to zsh.

Another trick is to sort your history for the commands you use the most and created aliases for these commands to save you time. Here is a command to get your top ten most used commands:

history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl |  head -n10

Autosuggestions
If you are using zsh there is a neat plugin called zsh-autosuggestions which will automatically show you suggestions of commands you used before that you can complete using the right arrow key.

More Related Projects \

If you got other suggestions I would love to include them here.

Motivation

There are two reasons why I created TermCheat. First of all I love using the terminal and lately I have been learning more things like systemd and just could not remember all the commands on the first go. While I use the zsh-autosuggestions plugin and reverse history search (ctrlr) I still had sometimes problems to recall commands. Furthermore both of these options to not give any additional information about the commands. Most modern editors (sublime-text, atom, ...) now have the option to search for commands with ctrl p which I find super helpful.

The second reason which is even more important for me is that I find text base user interface (tui) very cool. They give you a proper hacker feeling and if done right are beautiful and fast. I wanted to challenge myself and see if I could build such an interface, and voila two weekends later I had the first version of TermCheat running. After working many years on web based interfaces building a tui is a really nice experience because it's pure minimalism.

License

TermCheat is released under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

term_cheat-0.1.12-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file term_cheat-0.1.12-py3-none-any.whl.

File metadata

  • Download URL: term_cheat-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

File hashes

Hashes for term_cheat-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 b37e8e3f99d8c7f10e97a46aae0a3e9ea2b480161fc37dcf2727d00e119fa800
MD5 46a79c1277cd5ca8a0973db7d96824e0
BLAKE2b-256 cd9422a969053537708cea0e107db9bc6d0700ae257c46f32ae4c889a7bf6ab6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page