1

Ask HN: Can I see your cheatsheet?

 1 year ago
source link: https://news.ycombinator.com/item?id=31928736
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Ask HN: Can I see your cheatsheet?

Ask HN: Can I see your cheatsheet?
58 points by fastily 3 hours ago | hide | past | favorite | 38 comments
Almost everyone I know keeps a list of (easily forgettable) command line snippets somewhere. I can't imagine that HN folks would be any different :)

So that said, could I please see your cheatsheet?

I'll go first: https://github.com/fastily/cheatsheet

This surprised me that people do this. I don't have any, since if I have to look up one, it's not really useful :)

But my cheat sheet is google, I usually find what I want in no time.

No maintained cheat sheet here either. I do use `history | grep` quite a lot though.

One thing I try to do is to keep my keyboard shortcuts consistent between programs/systems. That way the chance of my instinct of pressing `<CTRL>+a` to move the cursor to the start of the line will be correct more often.

Another thing I try to do when a project has a set of complex commands that are needed, is to add them as a rule in its Makefile, that way they're available for my colleagues as well.

s.gif
I use Ctrl+R chronically for the same thing.
Try using flashcards (Anki) to remember shortcuts if you haven't yet. Just like with learning a foreign language, it's a quick way to get "action -> shortcut" mappings into your brain permanently for recall at any time, rather than relying on a cheatsheet.
My only real cheatsheet is a list of shortcuts I maintain for programs/apps I use:
    system:
    ctrl+space=switch keyboard input language
    
    iterm2:
    cmd+; = autocomplete
    fn+cmd+< = scroll to top of buffer
    fn+cmd+> = scroll to bottom of buffer
    fn+cmd+^ = pgup buffer
    fn+cmd+v = pgdown buffer
    fn+< = beginning of line
    fn+> = end of line
    shift+cmd+[ = previous tab
    shift+cmd+] = next tab
    cmd+K = delete til end of line
    cmd+enter = full-screen on/off
    cmd+shift+e = show command timeline!!!
    
    chrome:
    opt+cmd+J = devtools
    cmd+] = devtools tab right
    cmd+[ = devtools tab left
    opt+space = start/stop toggl
    fn+cmd+< = move tab left
    fn+cmd+> = move tab right
    fn+cmd+^ = move tab to start
    fn+cmd+v = move tab to end
    
    sublime:
    ctrl+` = open python console
    cmd+shift+P = open command palette
    cmd+P = search open files
    ctrl+opt+C = open in browser with View in Browser package (create tmpfile if dirty)
    cmd+shift+[ = Move to left pane
    cmd+shift+] = Move to right pane
    ctrl+0 = move to sidebar
    cmd+k+b = show/hide sidebar
    cmd+k+u = uppercase
    cmd+k+l = lowercase
    ctrl+shift+v = multiple cursor down
    ctrl+shift+^ = multiple cursor up
    shift+tab = back up tab indentation (at beginning of line)
    cmd+[ = dedent (when highlighted)
    cmd+[ = indent (when highlighted)
    cmd+shift+. = show dotfiles in open file view
    cmd+shit+g (when opening file) = navigate to path for file selection
    
    # edit package override files in /User/user/Library/Application Support/Sublime Text 3/Packages/User/
    
    VS Code:
    option+^ = drag line up
    option+v = drag line down
    ctrl+` = open terminal
    cmd+p, :#<enter> = go to line
    ctrl+enter = open alongside
    cmd+b = open/close side panel
    cmd+option+shift+> = move tab right
    cmd+option+shift+< = move tab left
    cmd+option+F = toggle fullscreen
    cmd+shift+l = highlight all selected
    cmd+shift+o = type fn name to jump to in open file
    cmd+option+shift+c = copy path of active filename
    
    Asana:
    cmd+shift+M: monospace highlighted text
s.gif
I had trouble remembering VS Code shortcuts so I put them into my flashcard program (Anki) and it's worked really well. I recommend it if you already use flashcards.
s.gif
I have this actually, but it typically only lists a small selection of shortcuts for the active application. Also doesn't work for web applications with shortcuts
My extremely short shell cheatsheet for things I do rarely enough to forget each time:
    Process substitution:
        bash: diff <(echo hello) <(echo world)
        fish: diff (echo hello | psub) (echo world | psub)
    
    Rsync directories:
        rsync -a -v --dry-run other:dir/ dir/
        Syncs the contents of dir (`/` needed)
    
    Script exit handler:
    bash:
        function finish {
          # exit handling code
        }
        trap finish EXIT # EXIT is special and works on normal exit as well as interrupts
s.gif
Process substitution is one of those tricks that I don't have to look up each time as I find that I'm always using it - but that probably says more about the number of times that I'm given randomly ordered files that I need to compare with diff to figure out what's actually changed.
s.gif
> mkdir if not exists
  [ -d "${DIR}" ] || (mkdir -p "${DIR}")
No need to check when using "-p".
s.gif
You are absolutely right :-) I think, that this is a relict, since I personally use an alias for mkdir:
  alias mkdir='mkdir -p'
Thank you
Don't really use a cheat sheet. history and fzf is mostly what i use
All kept in batch files in a directory with a meaningful name. When I need something what I do a ls <keyword> on the directory and can recon the command I need.
tab tab tab tab tab tab tab tab As someone who is quite severely dyslexic tab complete changed my life.
On a related note: has anyone used a good tool for using/inserting these kinds of custom snippets? It would be neat to have a snippet manager with quick search bound to a keypress.
s.gif
Make sure to create a cheatsheet for how to use your cheatsheet manager.
s.gif
On Linux, you can make your own very quickly using Rofi and a clipboard manager.
http://cht.sh/ - I use this a lot. It outputs a short summary of common commands for many cli tools. You can curl to it https://cht.sh/grep for example or install their cli client
I keep some as shell aliases, shell scripts or Git aliases, but mostly I just use my shell history, finding commands with Ctrl+R and a few characters that I know to be in there somewhere. (If you want to do this, make sure you set its limit high enough so you don’t lose stuff.)
I never did have a cheatsheet. Strange since I've been on the *nix journey since 1998.

I do like the cheat command but it's still not habitual to use it, I grew up with Google so I'm far too dependent on it.

My cheatsheet happens to be just my muscle memory. And, for applications I don't use often, mostly just intuitive guesses.

Sounds pretty messy but I've never felt the need to maintain a cheatsheet.

I don't see why one would. I know I'm possibly being naive.

I have maybe 50 pages of cheat codes worth. I haven't had the time to post them somewhere yet. Remind me... a week from now :D
s.gif
Remind me... a week from now :D

--> This is actually a real problem on forums --> just to remind a stranger on a forum to commment on something. --> I´m working on a concept / tool to make it simple.

--> Would you like to talk about that? Ron.

less "cheatsheet" and more just general notes for languages and vim and such:

https://github.com/valbaca/notes

s.gif
  tldr <command>
is great. It's a cheatsheet for every command and one of the first things I advise newbies to install.
s.gif
tldr is one of the best things to happen to the command line
s.gif
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search:

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK