Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

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.

License

NotificationsYou must be signed in to change notification settings

cheat/cheat

Repository files navigation

Workflow status

cheat

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

The obligatory xkcd

Usecheat withcheatsheets.

Example

The next time you're forced to disarm a nuclear weapon without consultingGoogle, 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" cheatsheetcheat 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 existcheat -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 that are tagged with "networking":

cheat -l -t networking

To list all cheatsheets on the "personal" path:

cheat -l -p personal

To search for the phrase "ssh" among cheatsheets:

cheat -s ssh

To search (by regex) for cheatsheets that contain an IP address:

cheat -r -s'(?:[0-9]{1,3}\.){3}[0-9]{1,3}'

Flags may be combined in intuitive ways. Example: to search sheets on the"personal" cheatpath that are tagged with "networking" and match a regex:

cheat -p personal -t networking --regex -s'(?:[0-9]{1,3}\.){3}[0-9]{1,3}'

Installing

For installation and configuration instructions, seeINSTALLING.md.

Cheatsheets

Cheatsheets are plain-text files with no file extension, and are namedaccording to the command used to view them:

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

Cheatsheet text may optionally be preceeded by a YAML frontmatter header thatassigns tags and specifies syntax:

---syntax: javascripttags: [ array, map ]---// To map over an array:const squares = [1, 2, 3, 4].map(x => x * x);

Thecheat executable includes no cheatsheets, butcommunity-sourcedcheatsheets are available. You will be asked if you would like toinstall the community-sourced cheatsheets the first time you runcheat.

Cheatpaths

Cheatsheets are stored on "cheatpaths", which are directories that containcheatsheets. Cheatpaths are specified in theconf.yml file.

It can be useful to configurecheat against multiple cheatpaths. A commonpattern is to store cheatsheets from multiple repositories on individualcheatpaths:

# conf.yml:# ...cheatpaths:  -name:community# a name for the cheatpathpath:~/documents/cheat/community# the path's location on the filesystemtags:[ community ]# these tags will be applied to all sheets on the pathreadonly:true# if true, `cheat` will not create new cheatsheets here  -name:personalpath:~/documents/cheat/personal# this is a separate directory and repository than abovetags:[ personal ]readonly:false# new sheets may be written here# ...

Thereadonly option instructscheat not to edit (or create) any cheatsheetson the path. This is useful to prevent merge-conflicts from arising on upstreamcheatsheet repositories.

If a user attempts to edit a cheatsheet on a read-only cheatpath,cheat willtransparently copy that sheet to a writeable directory before opening it forediting.

Directory-scoped Cheatpaths

At times, it can be useful to closely associate cheatsheets with a directory onyour filesystem.cheat facilitates this by searching for a.cheat folder inthe current working directory. If found, the.cheat directory will(temporarily) be added to the cheatpaths.

Autocompletion

Shell autocompletion is currently available forbash,fish, andzsh. Copythe relevantcompletion script into the appropriate directory onyour filesystem to enable autocompletion. (This directory will vary dependingon operating system and shell specifics.)

Additionally,cheat supports enhanced autocompletion via integration withfzf. To enablefzf integration:

  1. Ensure thatfzf is available on your$PATH
  2. Set an envvar:export CHEAT_USE_FZF=true

About

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.

Topics

Resources

License

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp