
Create and view interactive cheatsheets on the command-line - dsr12
https://github.com/cheat/cheat
======
627467
I finally learned the basic tar command from this menemonic:

[https://www.reddit.com/r/ProgrammerHumor/comments/1x0qwh/hav...](https://www.reddit.com/r/ProgrammerHumor/comments/1x0qwh/having_trouble_remembering_tar_syntax/)

~~~
jolmg
`tar -xfj foo.tar.bz2` would extract the file `foo.tar.bz2` from inside the
archive `j`. IOW, it's providing `j` as the argument to the option `-f` that's
used to specify the archive file. It should rather be `-xjf`. Also, case
matters, `-J` is for .xz files, not .bz2.

`tar` has a pretty simple calling syntax, probably simpler than most
utilities. I encourage people to use the manpages instead of cute but wrong or
misleading mnemonics.

------
RulerOf
I've been using this tool for a while. It's great for when you're familiar
with a command but would prefer a list of common examples instead of a
detailed man page for whatever reason.

Resizing an image with imagemagick's convert utility is extremely common, but
invoking the binary with -? or bringing up the man page will get you way more
information than you're actually looking for, whereas the cheatsheet[1] has
exactly what you need right there.

[1]:
[https://github.com/cheat/cheatsheets/blob/master/convert](https://github.com/cheat/cheatsheets/blob/master/convert)

~~~
simonebrunozzi
> would prefer a list of common examples instead of a detailed man page

This. I have always complained to myself that man pages should have had this
option.

~~~
ColeyG
I want to echo what you are saying a little bit. I have never learned
something from a man page. Maybe it is because they provide full documentation
but that is very rarely actually useful when using commands.

That is what excited me about this. Maybe cli apps will see this example and
try to document how to use it in this way. Infinitely more usable in my
opinion.

------
npmisdown
Isn't it a perfect case for aliases?

If you don't remember the particular command, why not to look it up for the
first time and then assign personalized alias, which is easy to remember?

Like with `tar` example and `zsh` you can even define suffix alias (`alias
-s`), so you can just type `./your-file.tgz` and `zsh` will invoke `tar -xzf
./your-file.tgz` or whatever you prefer.

~~~
mxuribe
Funny, i actually created my own alias which points to
[http://cheat.sh/](http://cheat.sh/)

...that of course assumes I have an internet connection. Otherwise, fall back
to man pages as well as my own directory of text files with reference info on
commonly used commands - employing my own examples.

------
INTPenis
This is what I've been looking for. I might have come across it before and
ignored it, but I really need this.

They're far apart but those moments when you want to cut a video, or set id3
tags, and you rely 100% on Google to find out the CLI args for you.

Much better to store them locally, or in a git repo shared by your devices,
and look them up on the CLI.

Even better, I'd like them to be already stored in bash's ctrl+r "history" and
be displayed with comments. That would be amazing, to just hit ctrl+r and
start typing ffmpeg, regardless of how long since you ran that command.

------
mxuribe
This seems a nifty utility...but I've slowly migrated to depending on
manpages, my own directory of text files, and with an alias to
[http://cheat.sh/](http://cheat.sh/) (while online, that is). Looking at this
tool, mnemonic, navi, etc., i almost prefer navi and mnemonic over
cheatsheets, but obviously that is only personal taste, and with no offense to
the makers of any of these utilities.

Specific to man pages, it actually took me a while to learn how to read them
in order to gain maximum benefit from them. Surely, the quality of manpages is
not the same across all or even most applications...but i guess i've gotten
used to manpages enough that between them, and my own text files, with a rare
dive into something like [http://cheat.sh/](http://cheat.sh/) or good ol' DDG
search, seems to have me covered.

~~~
trey-jones
I learned more about how to use man pages in the 3 (4?) hours of LFCS exam
than I did in nearly 10 years of using unix/linux every day. It's amazing what
being forced to work without a web browser to hand can do.

~~~
mxuribe
Very interesting; thanks for sharing!!

I've not been interested in pursing that cert. (my day job has been lots more
pointy-haired boss type of work rather than sysadmin, dev, or devops, etc.).
However, i do have a colleague who is pursuing this cert., plus your note
about learning manpages (as one benefit), and other anecdotes that i've heard
similar to yours...makes me think that maybe i should pursue this cert even if
only for my own personal improvement. Thanks again for that interesting
tidbit!

~~~
trey-jones
Since you may be interested I would add that it didn't take much preparation
after having worked as a sysadmin/dev/linux user for nearly 10 years, and my
employer paid for it so there wasn't really investment from me. There are some
targeted questions (there was a Docker question for example) that might throw
you if you don't typically use the tech, but also a lot of general linux usage
(grep, find, stdin/out/err manipulation, etc) so that even if you have to skip
something (I didn't finish completely) you still stand a good chance of
passing.

I did find it to be a good exercise in some things that I don't do often (and
things like using man pages), and I also would say that I feel a bit more
confident and validated walking around with the cert than I did before.

I also got a T-Shirt!

~~~
mxuribe
Very helpful; thanks again!

------
codesections
I've written a similar tool — with the additional feature of syntax
highlighting of the output. (And a shorter command name, which might actually
matter for a tool like this!)

[https://github.com/codesections/mnemonic](https://github.com/codesections/mnemonic)

------
kissgyorgy
Is this the same as [https://tldr.sh/](https://tldr.sh/) ?

~~~
usepgp
doesn't look like it. tldr.sh seems to pull from the web, while this cheat
project looks to be more of a similar too to collect knowledge you build
yourself over time.

------
trey-jones
It's funny that when I saw this headline I thought, "That would be great for
tar!" Admittedly I do have the ability to disable the bomb and can both create
and execute archives (gzipped or not!) without a cheat sheet. But for pretty
much anything else, I never have the confidence to do it without looking at
the manpage, or my own cheat sheet.

------
lionkor
I remember it like this:

x - extract

c - create

z - zip (like, compress)

v - verbose

f - file

when I write the command I just say in my head what I want to do: Say I want
tar xzvf:

tar extract zip verbose file

makes sense to me

------
tijn
So, we now have tldr, and navi, and mnemonic, and cheat, and maybe some more
similar tools. But why don't we add these examples to the respective man
pages? There's clearly a need for them.

I guess if you wanted you could make a new command that only prints the
EXAMPLES section of a man page. It could turn out to be an improvement even
since you get all the nice things that man provides like colours and
consistent formatting for free.

------
wjdp
I needed the tool to install the tool. It ships as a `.gz` file. The standard
`tar zxvf cheat-linux-amd64.gz` doesn't work. Tried `7z x cheat-linux-
amd64.gz` which works.

~~~
weitzj
gunzip is probably what you were looking for

~~~
wjdp
Ah yes, that's the one. By the time I need to do the same again I'll have
definitely forgotten again!

------
petargyurov
Similar tool:
[https://github.com/denisidoro/navi](https://github.com/denisidoro/navi)

------
simonebrunozzi
The real test would be: can you do this?

    
    
      $cheat cheat

------
yonrg
Oh no, here it comes, the next generation of superduper admins. Fast,
efficient, no experience nor education. "Erm.. Boss, we have leaked our
database into the wild, because .. erm .. yeah .. I mouse-pasted first search
result and it worked :thumbsup: .. it wasn't me .. just an unfortunate
accident .. blame the software!"

~~~
emptyparadise
I heard some of those new admins even use man pages or personal notes. Curse
those amateurs, back in my day we kept all of POSIX in our heads and we liked
it!

