1
1
mirror of https://github.com/chubin/cheat.sh.git synced 2024-11-30 10:03:13 +03:00
cheat.sh/README.md

227 lines
7.0 KiB
Markdown
Raw Normal View History

2017-05-09 00:21:52 +03:00
2017-06-02 19:32:15 +03:00
![cheat.sh logo](http://cheat.sh/files/big-logo.png)
2017-05-24 23:40:48 +03:00
2017-06-05 16:10:52 +03:00
Unified read, search and write access to the popular cheat sheets repositories.
2017-05-09 00:21:52 +03:00
## Features
* simple curl/browser interface
* available everywhere, no installation needed
2017-06-05 16:10:52 +03:00
* selected popular well maintained community driven cheat sheets repositories
* search (on a cheat sheet and in all cheat sheets)
2017-05-09 00:21:52 +03:00
* tab completion
* syntax highlighting
2017-06-05 16:10:52 +03:00
* editors integration
2017-05-09 00:21:52 +03:00
2017-06-05 16:10:52 +03:00
## Usage
2017-05-09 00:21:52 +03:00
2017-06-05 16:10:52 +03:00
To read a cheat sheet:
2017-05-09 00:21:52 +03:00
2017-06-05 16:30:36 +03:00
```
2017-06-05 16:10:52 +03:00
curl cheat.sh/sudo
2017-06-05 16:30:36 +03:00
```
2017-06-02 19:31:44 +03:00
2017-06-05 16:10:52 +03:00
Here `sudo` is the name of the cheat sheet you are looking for.
2017-05-09 00:21:52 +03:00
2017-06-05 16:10:52 +03:00
If you don't know the name of the topic you need,
you can search for it using the ~KEYWORD notation.
For example, to see how you can make snapshots, you make the following query
2017-05-09 00:21:52 +03:00
2017-06-05 16:30:36 +03:00
```
2017-06-05 16:10:52 +03:00
~snapshot
2017-06-05 16:30:36 +03:00
```
2017-05-09 00:21:52 +03:00
2017-06-05 16:10:52 +03:00
and get the list of snapshot creation examples commands.
Programming languages cheat sheets are located in correspondent namespaces,
named after the name of the language:
2017-06-05 16:30:36 +03:00
```
2017-06-05 16:10:52 +03:00
scala/Functions
2017-06-05 16:30:36 +03:00
```
2017-06-05 16:10:52 +03:00
Read more about the programming languages cheat sheets below.
There are several special pages, those name are always starting with a colon,
that are not cheat sheets and have special meaning. For example:
2017-05-09 00:21:52 +03:00
2017-05-09 00:17:26 +03:00
```
2017-06-05 16:10:52 +03:00
:help
:list list all cheat sheets
/perl/:list list all perl cheat sheets
2017-05-09 00:17:26 +03:00
```
2017-05-09 00:21:52 +03:00
2017-06-05 16:10:52 +03:00
cheat.sh supports tab completion in a shell and in a browser.
All major shells are supported. Read more on it in the *Tab completion* section.
cheat.sh uses syntax highlighting by default.
You can switch it off, or choose other color scheme for it.
Use URL options for that. More on it in the *Options* section below.
Usage examples:
2017-05-09 00:21:52 +03:00
2017-05-09 00:17:26 +03:00
```
2017-06-05 16:10:52 +03:00
$ curl cheat.sh/cpio
$ curl cheat.sh/~snapshot
$ curl cheat.sh/go/range
$ curl cheat.sh/rust/hello
$ curl cheat.sh/rust/hello?T
2017-05-09 00:17:26 +03:00
```
2017-05-09 00:21:52 +03:00
2017-06-05 16:10:52 +03:00
![cheat.sh usage](http://igor.chub.in/download/cheatsh-en.gif)
2017-05-09 00:21:52 +03:00
## Search
To search for a keyword, use the query:
2017-05-09 00:17:26 +03:00
```
2017-05-09 00:21:52 +03:00
/~keyword
2017-05-09 00:17:26 +03:00
```
2017-05-09 00:21:52 +03:00
In this case search is not recursive — it is conducted only in a pages of the specified level.
For example:
2017-05-09 00:17:26 +03:00
```
2017-05-09 00:21:52 +03:00
/~snapshot look for snapshot in the first level cheat sheets
/scala/~currying look for currying in scala cheat sheets
2017-05-09 00:17:26 +03:00
```
2017-05-09 00:21:52 +03:00
For a recursive search in all cheat sheets, use double slash:
2017-05-09 00:17:26 +03:00
```
/~snapshot/r look for snapshot in all cheat sheets
```
2017-05-09 00:21:52 +03:00
You can use special search options after the closing slash:
2017-05-09 00:17:26 +03:00
```
2017-05-09 00:21:52 +03:00
/~shot/bi case insensitive (i), word boundaries (b)
2017-05-09 00:17:26 +03:00
```
2017-05-09 00:21:52 +03:00
List of search options:
2017-05-09 00:18:11 +03:00
```
2017-05-09 00:21:52 +03:00
i case insensitive search
b word boundaries
2017-05-09 00:17:26 +03:00
r recursive search
2017-05-09 00:18:11 +03:00
```
2017-05-09 00:21:52 +03:00
2017-06-05 16:10:52 +03:00
## Special URLs
Special URLs:
```
:help this page
:list list all cheat sheets
:post how to post new cheat sheet
:bash_completion bash function for tab completion
:bash bash function and tab completion setup
:fish fish function and tab completion setup
:zsh zsh function and tab completion setup
:emacs cheat.sh function for emacs
:styles list of color styles
:styles-demo show color styles usage examples
```
## Tab completion
Tab completion is a very important part of cheat.sh.
Having more than a thousand cheat sheets, it's very hard to learn all their names.
If you use a cheat.sh shell functions, it's enough to include it
in `~/.bashrc`:
```
$ curl cheat.sh/:bash > ~/.bash.d/cheat.sh
$ . ~/.bash.d/cheat.sh
$ # add . ~/.bash.d/cheat.sh to ~/.bashrc
```
If you want to use cheat.sh with curl
and don't create any special functions, include `:bash_completion`:
```
$ curl cheat.sh/:bash_completion > ~/.bash.d/cheat.sh
$ . ~/.bash.d/cheat.sh
$ # add . ~/.bash.d/cheat.sh to ~/.bashrc
```
## Options
?OPTIONS
```
q quiet mode, don't show github/twitter buttons
T text only, no ANSI sequences (can be pasted in an editor)
style=STYLE color style
```
Options can be combined together in this way:
```
$ curl cheat.sh/for?qT\&style=bw
```
(note the `\` before `&`: it is escaping `&`, which has in shell special meaning).
## Programming languages support
Cheat sheets related to the programming languages
are organized in namespaces (subdirectories), that are named according
to the programming languages.
For each supported programming languages
there are several special cheat sheets: it own sheet, `hello`, `:list` and `:learn`.
Say for lua it will look like:
```
lua
lua/hello
lua/:list
lua/:learn
```
* `hello` describes how you can start with the language — install it if needed, build and run its programs, and it shows the "Hello world" program written in the language;
* `:list` shows all topics related to the language
* `:learn` shows a learn-x-in-minutes language cheat sheet perfect for getting started with the language.
2017-05-09 00:21:52 +03:00
## Cheat sheets sources
2017-06-05 16:10:52 +03:00
Instead of creating yet another mediocre cheat sheet repository,
we are concentrating our efforts on creation of a unified
mechanism to access selected existing well developed and good maintained
cheat sheet repositories covering topics of our interest:
programming and operating systems usage.
2017-05-09 00:21:52 +03:00
cheat.sh uses several community driven repositories
2017-06-05 16:30:36 +03:00
of cheat sheets
(in the popularity column number of contributors/number of stars are shown):
2017-05-09 00:21:52 +03:00
2017-06-05 16:10:52 +03:00
|Cheat sheets |Repository | Popularity | Creation Date |
|-----------------------|------------------------------------------------------|------------|---------------|
|UNIX/Linux, programming|[cheat.sheets](https://github.com/chubin/cheat.sheets)| 2/20 | May 1, 2017 |
|UNIX/Linux commands |[tldr-pages/tldr](https://github.com/tldr-pages/tldr) | 336/9449 | Dec 8, 2013 |
|UNIX/Linux commands |[chrisallenlane/cheat](https://github.com/chrisallenlane/cheat)|93/3231|Jul 28, 2013|
|Programming languages |[adambard/learnxinyminutes-docs](https://github.com/adambard/learnxinyminutes-docs)|999/4513|Jun 23, 2013|
|Go |[a8m/go-lang-cheat-sheet](https://github.com/a8m/go-lang-cheat-sheet)|23/2086|Feb 9, 2014|
2017-05-09 00:21:52 +03:00
2017-06-05 16:19:58 +03:00
Pie diagram reflecting cheat sheets sources distribution (by number of cheat sheets on cheat.sh originating from a repository):
2017-05-09 00:21:52 +03:00
2017-06-05 16:10:52 +03:00
![cheat.sh cheat sheets repositories](http://cheat.sh/files/stat-2017-06-05.png)
2017-05-09 00:21:52 +03:00
## How to add a cheat sheet
If you want to add a cheat sheet, you have one of the following
ways:
* Add it to one of the external cheat sheets repositories; you should decide on your own what is the best repository for your cheat sheet;
* Add it to the local cheat.sh repository ([cheat.sheets](https://github.com/chubin/cheat.sheets)) on github (fork, commit, pull request);
* Post it on cheat.sh using curl or a web browser ([cheat.sh/:post](http://cheat.sh/:post)).
2017-05-09 00:21:52 +03:00
If you want to change an existing cheat sheet,
you have to find the original repository (when you open a cheat sheet in a browser,
you see the repository's github button in the bottom of the cheat sheet),
the cheat sheet is coming from, and change it there.
After some time the changes will be synchronized on cheat.sh.