Skip to main content
wegoagain

101

My shortcuts and tools reference.

Linux File System Basics

Understanding where you are and how Linux organises files is critical for managing your server.

The Prompt Explained

When you log in, you see something like this: wegoagain@k8s:~$

Part Meaning
wegoagain Your username
@k8s The hostname (name of the server)
~ Current directory (~ = your home folder)
$ Privilege level ($ = user, # = root)

The Tree Structure

Linux uses a single hierarchical tree starting at / (root).

Path Purpose
/ Root directory. The beginning of the filesystem.
/home Contains user directories.
/home/user (~) Your home directory. Your personal workspace with full control.
/etc Configuration files. System-wide settings (SSH, network, k3s).
/var Variable data. Files that grow/change (logs, databases).
/bin & /usr/bin Binaries. Where programs live (ls, kubectl).
/tmp Temporary. Files here are deleted on reboot.

Navigation Commands

Command Action
pwd Print working directory. Shows where you are.
ls List files in current folder.
ls -la List all files including hidden (starting with .) with permissions.
cd /path Change directory. Moves you to a specific folder.
cd ~ or cd Go home. Takes you to /home/yourname.
cd .. Go up one folder in the tree.
mkdir <dir> Create a directory.
touch <file> Create an empty file.
cp <src> <dest> Copy a file.
mv <src> <dest> Move or rename a file.
rm <file> Remove a file.
rm -rf <dir> Remove directory and all contents.
What does -rf mean?

-r = recursive (delete folders and everything inside). -f = force (don't ask for confirmation). Use carefully.

Permissions 101

Linux is strict about who owns what.

Permission Meaning
r (read) Can open/view the file.
w (write) Can edit/delete the file.
x (execute) Can run the file as a program.

You own everything in /home/yourname. Root owns almost everything else (/etc, /usr, etc). To edit system files, use sudo to temporarily act as root.

Command Action
sudo <command> Run command as root (admin).
Example

touch /etc/myfile.txt fails (permission denied).
sudo touch /etc/myfile.txt works.

chmod <mode> <file> Change file permissions.
Common modes

chmod +x script.sh = make executable.
chmod 755 script.sh = rwx for owner, rx for others.
chmod 644 file.txt = rw for owner, r for others.

chown <user>:<group> <file> Change file owner.
Example

sudo chown www-data:www-data /var/www = give ownership to web server user.

Ghostty

GPU-accelerated terminal emulator with native macOS feel.

Key Action
cmd+d Split pane vertically (left/right)
cmd+shift+d Split pane horizontally (up/down)
cmd+[ / cmd+] Focus previous/next split
cmd+ctrl+arrow Resize splits

Shell

Zsh with starship for a minimal prompt showing git status, k8s context, and terraform workspace. Using zed as my editor for its speed and built-in AI assistance.

Navigation

Shortcut Action
ctrl+r Fuzzy history search (fzf)
ctrl+t Fuzzy file finder (fzf)
z <dir> Smart cd (zoxide)
fe Fuzzy find + open in zed

File Listing (eza)

Alias Command
ls eza with icons
ll Long format with git status
lt Tree view
la All files, long format

File Reading (bat)

Alias Command
cat bat (plain style)
catp bat (full decorations)

Git

Alias Command
gs git status -sb
gp git pull
gpo git push origin
gc git commit -m
gco git checkout
gd git diff
glog Visual log (oneline, graph, decorate)
fgh Fuzzy search git history

Kubernetes

Alias/Function Action
k kubectl
kg kubectl get
kd kubectl describe
kdel kubectl delete
kl kubectl logs -f
kctx Fuzzy context switch
kns Fuzzy namespace switch

Docker

Alias/Function Action
d docker
dc docker compose
dps Formatted container list
dex docker exec -it
dclean Prune everything (containers, images, volumes)
dlogs Fuzzy container logs

Terraform

Alias/Function Action
tf terraform
tfi terraform init
tfp terraform plan
tfa terraform apply
tfd terraform destroy
tfv terraform validate
tff terraform fmt -recursive
tfw Fuzzy workspace switch

k9s

Kubernetes TUI for cluster management. Faster than kubectl for most operations. Docs

lazygit

Git TUI for staging, committing, and branch management. Makes complex git operations visual. Docs

Utilities

Function Description
killport <port> Kill process on port
top10 Show top 10 CPU processes
replace 'old' 'new' Search and replace in files
brewup Update, upgrade, cleanup brew
ports Show listening ports
myip Show public IP