Productivity & dotfiles¶
Shell setup, editor shortcuts, and tools that speed up daily work.
Dotfiles layout¶
Keep dotfiles in a git repo and symlink into $HOME:
~/dotfiles/
bash/
.bashrc
.bash_aliases
.bash_profile
git/
.gitconfig
.gitignore_global
tmux/
.tmux.conf
ssh/
config
A minimal install script:
#!/usr/bin/env bash
DOTFILES="$HOME/dotfiles"
ln -sf "$DOTFILES/bash/.bashrc" "$HOME/.bashrc"
ln -sf "$DOTFILES/bash/.bash_aliases" "$HOME/.bash_aliases"
ln -sf "$DOTFILES/git/.gitconfig" "$HOME/.gitconfig"
ln -sf "$DOTFILES/tmux/.tmux.conf" "$HOME/.tmux.conf"
Shell aliases¶
Useful aliases to add to ~/.bash_aliases or ~/.zshrc:
# navigation
alias ..='cd ..'
alias ...='cd ../..'
alias ll='ls -lAh --color=auto'
# git shortcuts
alias gs='git status -sb'
alias gl='git log --oneline --graph --decorate -20'
alias gd='git diff --stat'
# safety nets
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# quick edits
alias vimrc='$EDITOR ~/.vimrc'
alias bashrc='$EDITOR ~/.bashrc && source ~/.bashrc'
tmux basics¶
Start a named session (survives SSH disconnect):
tmux new -s work
Detach: Ctrl-b d. Reattach:
tmux attach -t work
Split panes:
| Key | Action |
|---|---|
Ctrl-b " |
Split horizontally |
Ctrl-b % |
Split vertically |
Ctrl-b o |
Cycle panes |
Ctrl-b z |
Zoom current pane |
Ctrl-b [ |
Scroll mode (q to exit) |
Useful .tmux.conf settings:
set -g mouse on # mouse scroll and pane select
set -g history-limit 50000
set -g default-terminal "tmux-256color"
bind r source-file ~/.tmux.conf \; display "Reloaded!"
fzf — fuzzy finder¶
Install via your package manager or:
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
After install, Ctrl-r gives an interactive history search and Ctrl-t fuzzy-finds files. Pipe anything into fzf:
# interactive branch checkout
git branch | fzf | xargs git checkout
# kill a process interactively
ps aux | fzf | awk '{print $2}' | xargs kill
ripgrep — fast search¶
rg respects .gitignore automatically and is significantly faster than grep -r:
rg "TODO" src/ # recursive, colour output
rg -l "import requests" # list files only
rg -i "error" --type py # case-insensitive, Python files only
rg "fn \w+" --type rust -n # with line numbers
SSH ~/.ssh/config¶
Stop typing long hostnames and options. Example ~/.ssh/config:
Host bastion
HostName 203.0.113.42
User deploy
Port 2222
IdentityFile ~/.ssh/id_ed25519
Host dev
HostName 10.10.10.50
User root
ForwardAgent yes
StrictHostKeyChecking no
Host *
ServerAliveInterval 60
ServerAliveCountMax 3
ControlMaster auto
ControlPath ~/.ssh/cm-%r@%h:%p
ControlPersist 10m
ControlMaster / ControlPersist reuse one TCP connection for multiple SSH sessions to the same host — subsequent ssh dev commands are instant.
Editor shortcuts (VS Code / vim)¶
VS Code:
| Shortcut | Action |
|---|---|
Ctrl-P |
Quick-open file |
Ctrl-Shift-P |
Command palette |
Ctrl- ` |
Toggle terminal |
Alt-↑/↓ |
Move line up/down |
Ctrl-D |
Multi-cursor on next match |
Vim essentials:
gg / G — top / bottom of file
Ctrl-f / Ctrl-b — page down / up
* — search for word under cursor
:s/old/new/g — replace in current line
:%s/old/new/gc — replace in whole file with confirmation
:w !sudo tee % — save as root
See also: Linux CLI recipes for rsync and Git workflows for worktrees — both pair well with a tidy dotfiles setup.