Brew | Git | Misc | Python | Tmux | Vim |
---|
This is my refcard. There are many like it, but this one is mine.
Brew
Use brew
for command line applications, brew cask
for GUI apps.
Command | Description |
---|---|
brew doctor |
Check brew configuration |
brew update |
Update brew repositories |
brew upgrade |
Upgrade installed formulae |
brew list [--versions] |
List installed software [with version information] |
brew deps <formula> |
List dependencies for <formula> |
brew deps --installed --tree |
Show dependency tree for installed formulae |
brew uses --installed <formula> |
Check installed formulae that depend on <formula> |
brew cleanup -[n]s |
Clear cache, remove [dry run] old version from cellar |
Git
Official documentation at git-scm. Branch housekeeping at Railsware Blog.
Command | OMZ | Description |
---|---|---|
git status |
gst |
Show status |
git log --oneline --decorate --color --abbrev-commit --all --graph |
glola |
Show pretty commit log |
git commit -v |
gc |
Commit verbose |
git commit -a[m "message"] |
gca |
Add and commit (ignores new files!) |
git add --all |
gaa |
Update index with entire working tree |
git diff |
gd |
Changes in the working tree not yet staged for the next commit |
git diff --cached |
gdca |
Changes between the index and your last commit |
git diff HEAD |
gd HEAD |
Changes in the working tree since your last commit |
git difftool |
gdt |
Git diff with default difftool |
git remote -v |
grv |
List remote repositories |
git branch -vv |
List branches and show tracking | |
git remote show <origin> |
Show detailed information on <origin> | |
git pull --rebase |
gup |
Pull remote with rebase |
git rebase -i HEAD~x |
grbi HEAD~x |
Interactively squash last x commits |
Misc
SSH Homepage at ssh.com
Command | Description |
---|---|
rsync -av[n] <src> <dst> [--exclude=.DS_Store] |
Archive verbose [dry run] |
find . -name .DS_Store -type f [-delete] |
When you forget -exclude ;) |
sips -Z 1024 *.jpg |
Resize images w max edge |
ssh-keygen -t rsa |
Interactively generate SSH key pair |
ssh-copy-id -i ~/.ssh/mykey user@host |
Copy publc key to host |
####PostgreSQL
Offline installation, download PGDG rpm files from:
Install RPMs Set postgres user password open network using pg_hba.conf
Python
Command | Description |
---|---|
virtualenv [-p /path/to/python] venv |
Create virtual environment venv [using specified Python interpreter] |
source venv/bin/activate |
Use the venv virtual environment |
deactivate |
Stop using the current virtual environment |
pip list [--outdated] |
List [outdated] packages |
pip install <package> [--upgrade] |
Install [/upgrade] <package> |
Tmux
Terminal Multiplexer manual
Command | Description |
---|---|
tmux ls |
List sessions |
tmux a [-t <session-name>] |
Attach first available session |
tmux kill-session -t <session-name> |
Kill session |
tmux new [-s <session-name>] |
Create a new [named] session |
Ctrl-b s |
List sessions |
Ctrl-b w |
List Windows |
Ctrl-b c |
New window |
Ctrl-b , |
Name window |
Ctrl-b f |
Find window |
Ctrl-b & |
Kill window |
Simple configuration file (~/.tmux.conf) stolen from around the web but mostly from here.
Vim
There are many fine vim tutorials out there, and cheatsheets so big you could wallpaper a decent sized house with them. I don’t use vim all that much, this is just some basic stuff I tend to forget.
Command | Description |
---|---|
w [W] |
Start of next word [including punctuation] |
e [E] |
End of next word [including punctuation] |
b [B] |
Back to start of word [including punctuation] |
0 |
Beginning of line |
^ |
Beginning of line (non-blank) |
$ |
End of line |
Ctrl-b |
Page up |
Ctrl-f |
Page down |
H M L |
Place cursor High/Middle/Low on screen |
gg |
First line |
G |
Last line |
i [I] |
Insert [at beginning of line] |
a [A] |
Append [at end of line] |
o [O] |
Open new line below [above] |
u |
Undo |
Ctrl-r |
Redo |
:wq [ZZ] |
Save and quit |
:q! [ZQ] |
Don’t save, just quit |
/<pattern> |
Search for <pattern> |
?<pattern> |
Search backward for <pattern> |
n |
Find next |
N |
Find previous |
:%s/<old>/<new>/g[c] |
Replace <old> with <new> in entire file (g)[with confirmation] |
I keep a very simple .vimrc