cheatsheets/shell_tools.md

2.3 KiB

The purpose of this document is serve as a repository of the Unix shell commands and key bindings that either are the most useful or that I use the most.

tmux

Sessions

Start new session named name
tmux new -s name

Attach latest session
tmux a

Attach to session named name
tmux a -t name

Detach from session
Ctrl+b,d

List all sessions
tmux ls
Ctrl+b,s

Rename current session
tmux rename-session newname
Ctrl+b,$

Kill session named name
tmux kill-ses -t name
Kill all sessions except the current
tmux kill-ses -a

Windows

Create new window
Ctrl+b,c

Rename current window
Ctrl+b,,

Next window
Ctrl+b,n

Previous window
Ctrl+b,p

Select window by number
Ctrl+b,0...9

Close window
Ctrl+b,&

Panes

Split pane vertically
Ctrl+b,%

Split pane horizontally
Ctrl+b,"

Toggle last active pane
Ctrl+b,;

Switch pane to the direction
Ctrl+b,
Ctrl+b,
Ctrl+b,
Ctrl+b,

Convert pane into a new window
Ctrl+b,!

Close current pane
Ctrl+b,x

git

Basics

Initialize the current directory as git repository
git init

Stage changes of a file or directory
git add <directory>

Commit changes with message
git commit -m <commit message>

List files staged, unstaged and untracked
git status

Display entire commit history in a nice way
git log --all --graph --decorate

Branches

List all branches in current repo git branch

Create new branch named branch_name and checkout on it
git checkout -b <branch_name>

Undoing stuff

Remote repositories

docker

weechat

Switch between weechat core buffer and server buffer
Ctrl+x