Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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


Release history Release notifications

Download files

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

Files for term-cheat, version 0.1.12
Filename, size File type Python version Upload date Hashes
Filename, size term_cheat-0.1.12-py3-none-any.whl (9.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page