Skip to main content

Create and view interactive cheatsheets on the command-line

Project description

cheat

cheat allows you to create and view interactive cheatsheets on the command-line. It was designed to help remind *nix system administrators of options for commands that they use frequently, but not frequently enough to remember.

Example

The next time you're forced to disarm a nuclear weapon without consulting Google, you may run:

cheat tar

You will be presented with a cheatsheet resembling the following:

# To extract an uncompressed archive:
tar -xvf '/path/to/foo.tar'

# To extract a .gz archive:
tar -xzvf '/path/to/foo.tgz'

# To create a .gz archive:
tar -czvf '/path/to/foo.tgz' '/path/to/foo/'

# To extract a .bz2 archive:
tar -xjvf '/path/to/foo.tgz'

# To create a .bz2 archive:
tar -cjvf '/path/to/foo.tgz' '/path/to/foo/'

Usage

To view a cheatsheet:

cheat tar      # a "top-level" cheatsheet
cheat foo/bar  # a "nested" cheatsheet

To edit a cheatsheet:

cheat -e tar     # opens the "tar" cheatsheet for editing, or creates it if it does not exist
cheat -e foo/bar # nested cheatsheets are accessed like this

To view the configured cheatpaths:

cheat -d

To list all available cheatsheets:

cheat -l

To list all cheatsheets on the "personal" path:

cheat -l -p personal

To search for the phrase "ssh" among cheatsheets:

cheat -s ssh

Cheatsheets

Cheatsheets are plain-text files with optional file extensions. When the extension is excluded, they are named according to the command used to view them:

cheat tar     # file is named "tar" or "tar.EXTENSION"
cheat foo/bar # file is named "bar" or "bar.EXTENSION", in a "foo" subdirectory

Cheatpaths

Cheatsheets are stored on "cheatpaths", which are directories that contain cheatsheets. Cheatpaths are specified in the conf.yml file.

It can be useful to configure cheat against multiple cheatpaths. A common pattern is to store cheatsheets from multiple repositories on individual cheatpaths:

# conf.yml:
# ...
cheatpaths:
  - name: community                   # a name for the cheatpath
    path: ~/documents/cheat/community # the path's location on the filesystem
    tags: [ community ]               # these tags will be applied to all sheets on the path
    readonly: true                    # if true, `cheat` will not create new cheatsheets here

  - name: personal
    path: ~/documents/cheat/personal  # this is a separate directory and repository than above
    tags: [ personal ]
    readonly: false                   # new sheets may be written here
# ...

The readonly option instructs cheat not to edit (or create) any cheatsheets on the path. This is useful to prevent merge-conflicts from arising on upstream cheatsheet repositories.

If a user attempts to edit a cheatsheet on a read-only cheatpath, cheat will transparently copy that sheet to the first writeable directory in 'cheatpaths' before opening it for editing.

Project details


Download files

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

Source Distribution

cheatcheat-0.1.1.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cheatcheat-0.1.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file cheatcheat-0.1.1.tar.gz.

File metadata

  • Download URL: cheatcheat-0.1.1.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for cheatcheat-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fde6e451380e4374c1c0c616cbfa0b1985020b1ae321cf953127467ad899e2b0
MD5 a2dd51e9a8d5009d929d2d47a872838d
BLAKE2b-256 5553c0b56c51de8bb54598f536305a68ce089e60ce01cc051a2fbfb10111f4b2

See more details on using hashes here.

File details

Details for the file cheatcheat-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cheatcheat-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for cheatcheat-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e658eaf755ce9908595e16ed06b00ec6056066f89782f3fd3d90fa0b97010359
MD5 bcd0e8684eb133b127f54ac9aef3a97f
BLAKE2b-256 9239656b525c5d29e116d8f00ab57de075151d36cb07b6e46923d0d9dfe7f674

See more details on using hashes here.

Supported by

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