Skip to content

Instantly share code, notes, and snippets.

@IPOLIPOL
Last active January 24, 2026 21:46
Show Gist options
  • Select an option

  • Save IPOLIPOL/4a4fe65fef5d91f473c6b9f77a47a8bf to your computer and use it in GitHub Desktop.

Select an option

Save IPOLIPOL/4a4fe65fef5d91f473c6b9f77a47a8bf to your computer and use it in GitHub Desktop.
Command Line Cheetsheets

Cheatsheets

for bash, git and various command line utilities

Access the cheatsheets directly in CLI just with one command - no need to go somewhere else and switch context, get the hint where you need it.

Cheatsheet Demo

Prerequisites

Before using these cheatsheets, ensure you have the following installed:

Required
  • Bash/Zsh/compatible shell - Standard on macOS/Linux, available on Windows via WSL or Git Bash
  • Git - For git commands in .git_cheat
  • GitHub CLI (gh) - For GitHub authentication commands (install from cli.github.com)
Optional (for some commands)
  • fzf - Fuzzy finder for interactive file selection (install: brew install fzf on macOS, apt install fzf on Linux)
  • tree - Directory tree viewer (brew install tree / apt install tree)
  • VS Code - For code command functionality
  • Common Lisp / SBCL - For translation functions in .cheatsheet (if you use those features)
  • translate-shell - For trans command (install from github.com/soimort/translate-shell)
  • Node.js - For node commands in bash cheatsheet
  • Python 3 - For HTTP server and other Python commands

Setup Instructions

  1. Clone or download the cheatsheet files to ~/Bash/ directory
mkdir -p ~/Bash
# Place .cheatsheet, .bash_cheat, and .git_cheat in ~/Bash/
  1. Add aliases to your shell configuration file: macOS (Bash): ~/.bash_profile Linux (Bash): ~/.bashrc macOS/Linux (Zsh): ~/.zshrc Windows (Git Bash): ~/.bash_profile or ~/.bashrc
alias ?='echo "💡 Quick: open \"\$(find . -name \"*.pdf\" | fzf)\" | Full: cheat"'
alias cheat='cat ~/Bash/.cheatsheet'
alias bash_cheat='cat ~/Bash/.bash_cheat'
alias git_cheat='cat ~/Bash/.git_cheat'
  1. Reload configuration
source ~/.bash_profile      # Use your own configuration file name
   # or: source ~/.bashrc
   # or: source ~/.zshrc
  1. Test the aliases in bash shell:
    cheat - shows a common generic cheatsheet,
    bash_cheat - shows popular bash commands description,
    git_cheat - shows popular git commands description.
    ? - quick helper (requires fzf for file finder)
Notes
  • The ? alias requires fzf to be installed for interactive file selection
  • Small one-line alias like ? do not require a separate files and can be defined in the shell configuration file
  • File paths assume cheatsheets are stored in ~/Bash/ - adjust paths in aliases if you use a different location
  • Windows users should use Git Bash or WSL for best compatibility
  • Some commands (like open) are macOS-specific; use explorer on Windows or xdg-open on Linux
Term Description
Terminal A visual interface or app that gives you access to a shell (e.g., Terminal.app on macOS, GNOME Terminal on Linux, Windows Terminal). Think of it as the "window" or "UI."
Command Line (CLI) The actual interface you type commands into — the "line" where commands are entered (e.g., Bash, Zsh, CMD, PowerShell)
════════════════════════════════════════════════════════════════
BASH QUICK REFERENCE
════════════════════════════════════════════════════════════════
```bash
~ # expands to home directory (e.g. /Users/ildar)
| # (pipe) operator, connects the output of one command to the input of the next.
pwd # посмотреть текущую папку
cd ~/Folder # перейти в Folder. ~ — это домашняя директория
ls # посмотреть содержимое папки
ls -l # дополнительно-показывает детальную информацию по файлам
ls -a # показывает все файлы включая скрытые
ls /tmp/parsac_test/ # посмотреть содержимое папки в конкретной директории
cd .. # перейти в родительскую директорию
cp original.txt copy.txt # дублировать файл в новый
mkdir NewFolder # создать папку NewFolder
mv OldName NewName # переименовать папку
mv file1.txt newFolder/file1.txt # переместить file1.txt в папку newFolder (в той же директории где сейчас file1.txt)
mv file.txt folder1/folder2/file.txt # переместить file1.txt в папку folder2 (вложенная в folder1)
mv file.txt ../ # переместить file1.txt одним уровнем выше
mv file.txt ../../ # переместить file1.txt двумя уровнями выше
touch file.js # создать file.js
touch file1.txt file2.txt file3.txt # создать file1.txt, file2.txt, file3.txt
touch file{1..5}.txt # создать file1.txt, file2.txt, file3.txt
echo "Your text here" > file.txt # overwrite content in file.txt (one line)
echo "Extra line" >> file.txt # append to the file.txt (one line)
cat > file.txt # overwrite multiple lines in file.txt
cat >> file.txt # append multiple lines in file.txt (Ctrl + D ← (ends input))
cat /folder/file.txt # displays the contents of a file.txt
rm filename # удалить файл в текущей директории
code . # open the current folder
code file.js # открыть file.js в VS Code
code ~/Documents/MyProject # open a MyProject in VS Code
node file.js # запустить file.js
open . # открыть папку в текущей директории Finder
open file.svg # открыть file.svg
open -a Portacle # запустить Portacle
explorer . # Windows - открыть файловый браузер в текущей директории
clear # очистить окно терминала
python -m http.server 8000 # start local server. -m tells to run a module as a script
python --version # show version
```
════════════════════════════════════════════════════════════════
════════════════════════════════════════════════════════════════
TERMINAL QUICK REFERENCE
════════════════════════════════════════════════════════════════
🔍 FIND & OPEN:
tree -L 2 Show directory tree
tree -L 2 -h -p -u -g -D Show directory (multiple options)
open "$(find . -name "*.pdf" | fzf)" Interactive PDF finder
open "$(ls | fzf)" Pick file to open
find . -iname "*pattern*" Search files
open ~ Open home directory
notepad ~/.cheatsheet Open this file (Windows)
open -e ~/.cheatsheet Open this file (MacOS)
notepad ~/.bashrc Open bashrc (e.g. to edit alias)
code ~/.cheatsheet Open this file in VS Code
realpath ~/.cheatsheet Show full path of cheatsheet
cat ~/.cheatsheet Open in terminal
cd ~/Downloads Go to Downloads
cd - Go back
ls -la ~ List all files including hidden
which fzf show the path
ℹ️ INFO:
curl cheat.sh/treeexternal info about command
awk --help help for external tools
help echo help for built-in commands
command -V ls Detailed command info
📝 TEXT:
grep '\.java$' . -r Search .java files recursively in the current and all subdirectories
grep -i "word" file.txt Search in file
cat file.txt | wc -l Count lines
🌐 TRANSLATE:
sbcl Start Lisp
(translate "Hello" "ru") Quick translate
(tr "text" "ru") Translate to Russian
(tr-en "текст") Translate to English
trans en:ru "Hello world" Translate Shell
trans -shell Translate interactive mode
trans -h Transkate help
⚙️ CONFIGURATION:
source ~/.bash_profile Reload configuration
💡 TIPS:
Ctrl+R Search history interactively
Ctrl + C Stop current command
Ctrl + D Sends an "End of File" (EOF) marker.
Tab Autocomplete
Type '?' to see a one-line quick tip
Type 'cheat' to see this again
Type 'bash_cheat' to see the bash quick reference
Type 'git_cheat' to see the git quick reference
════════════════════════════════════════════════════════════════
```bash
════════════════════════════════════════════════════════════════
GIT QUICK REFERENCE
════════════════════════════════════════════════════════════════
git --version # local Git version
gh --version # local GitHub CLI version
gh auth login # log into GitHub
git init # initialize a local Git repo
git status # current branch situation
git remote -v # check which GitHub repo you're connected to.
git branch # check your branch (locall)
git branch -r # list remote branches
git branch -a # list local and remote branches
git clone <url> # creates a local copy of a remote repo and connects it as origin (Repo doesn't exists locally)
git remote show origin # shows info about the remote (origin)
git remote add origin <url> # adds a remote to an existing local repo (Repo already exists locally)
git remote set-url origin <url> # update remote URL
git fetch origin # downloads info from the remote (origin) without replacing local content
git diff origin/main # check the difference the local working directory and the origin/main branch from the remote
git pull origin main # fetching and replacing the files from the main branch of origin
git reset origin/main # discard all local changes and make your folder exactly match the remote
git add . # stages all new, modified, and deleted files in the current directory for the next commit.
git commit -m "update description" # creates a new commit with the staged changes
git push # sends the local commits to the remote repository’s current branch
git push origin your-branch-name # sends the local commits to origin / your-branch-name
git push --force # forces the remote branch to match your local branch, overwriting remote changes if necessary
ℹ️ INFO, NAMING:
remote # a Git repository hosted on a server (e.g., GitHub)
local # a Git repository on your computer
remote origin # main GitHub remote repo
HEAD branch # same as default branch
```
════════════════════════════════════════════════════════════════

Bash

pwd                 			# посмотреть текущую папку 
cd ~/Folder         			# перейти в Folder. ~ — это домашняя директория 
ls                  			# посмотреть содержимое папки 
ls -l                                   # дополнительно-показывает детальную информацию по файлам
ls -a                                   # показывает все файлы включая скрытые
ls /tmp/parsac_test/                    # посмотреть содержимое папки в конкретной директории
cd ..               			# перейти в родительскую директорию 
cp original.txt copy.txt                # дублировать файл в новый 
mkdir NewFolder     			# создать папку NewFolder 
mv OldName NewName  			# переименовать папку
mv file1.txt newFolder/			# переместить file1.txt в папку newFolder (в той же директории где сейчас file1.txt)
mv file.txt folder1/folder2/		# переместить file1.txt в папку folder2 (вложенная в folder1)
mv file.txt ../				# переместить file1.txt одним уровнем выше
mv file.txt ../../			# переместить file1.txt двумя уровнями выше
touch file.js       			# создать file.js
touch file1.txt file2.txt file3.txt   	# создать file1.txt, file2.txt, file3.txt
touch file{1..5}.txt                  	# создать file1.txt, file2.txt, file3.txt
echo "Your text here" > file.txt        # overwrite content in file.txt (one line)
echo "Extra line" >> file.txt           # append to the file.txt (one line)
cat > file.txt                          # overwrite multiple lines in file.txt
cat >> file.txt                         # append multiple lines in file.txt (Ctrl + D  ← (ends input))
cat /folder/file.txt                    # displays the contents of a file.txt
rm filename         			# удалить файл в текущей директории
code .					# open the current folder
code file.js        			# открыть file.js в VS Code
code ~/Documents/MyProject		# open a MyProject in VS Code
node file.js        			# запустить file.js
open file.svg       			# открыть file.svg
open -a Portacle                # запустить Portacle

=========================== GIT ==============================
git --version				# local Git version
gh --version				# local GitHub CLI version
gh auth login				# log into GitHub
git init            			# initialize a local Git repo
git status                              # current branch situation 
git remote -v				# check which GitHub repo you're connected to.
git branch          			# check your branch (locall)
git branch -r                           # list remote branches
git branch -a                           # list local and remote branches
git clone <url>                         # creates a local copy of a remote repo and connects it as origin (Repo doesn't exists locally)
git remote add origin <url>             # adds a remote to an existing local repo (Repo already exists locally)
git remote set-url origin <url>         # update remote URL
git fetch origin                        # downloads info from the remote (origin) without replacing local content
git diff origin/main                    # check the difference the local working directory and the origin/main branch from the remote
git pull origin main			# fetching and replacing the files from the main branch of origin
git reset origin/main                   # discard all local changes and make your folder exactly match the remote
git add .           			# stages all new, modified, and deleted files in the current directory for the next commit.
git commit -m "update description"  	# creates a new commit with the staged changes
git push            			# sends the local commits to the remote repository’s current branch
git push origin your-branch-name	# sends the local commits to origin / your-branch-name
git push --force    			# forces the remote branch to match your local branch, overwriting remote changes if necessary 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment