Skip to content

CLI Cheatsheet & Custom Aliases

This page serves as a quick reference for custom terminal aliases, modern CLI tool replacements, and essential server administration commands.

✨ Modern CLI Replacements

The shell environment is configured to use modern, rust-based alternatives to standard GNU tools.

Command Real Utility Description
cat batcat Prints file contents with full syntax highlighting and line numbers.
ls, l, la, ll lsd Directory listing with colors, icons, and tree views.
z, zi zoxide Smart directory jumper. Learns your habits. Type z dock to jump to /home/parth/docker.

🛠️ Custom Macros & Utilities

Alias Command / Action Description
_ sudo Quick prefix for executing commands as root.
caffeine gnome-session-inhibit ... Prevents the system from going to sleep while running.
dl-audiobook yt-dlp -f "bestaudio..." Downloads high-quality audio (.m4a), embeds metadata/chapters, and saves directly to /data/audiobooks/.
sassysh sassyshell ask Triggers the SassyShell AI CLI assistant.
tmux tmux -u Starts tmux with enforced UTF-8 support (fixes rendering issues).

🌍 Environment & Paths

The shell dynamically loads several paths and version managers at startup. Note: If you are writing Cron jobs, you will need to explicitly source these, as Cron runs in a non-interactive shell without these paths!

  • Node Version Manager (NVM): Loads dynamically from ~/.nvm. Manages node and npm versions.
  • Pipx / Local Binaries: Global python tools installed via pipx are available in ~/.local/bin.
  • Snaps: Snap package binaries are available in /snap/bin.
  • Custom Env: Loads additional private variables from ~/.local/bin/env if the file exists.

🚀 Lightning Navigation

Oh-My-Zsh provides rapid directory traversal without typing cd.

Command Action Command Action
.. Move up 1 directory (cd ..) 1 Return to previous directory (cd -)
... Move up 2 directories 2 Go back 2 directories in history
.... Move up 3 directories 3 Go back 3 directories in history
..... Move up 4 directories 4 Go back 4 directories in history

🐙 Git Shortcuts (Oh-My-Zsh Greatest Hits)

You have the full OMZ Git plugin enabled. Here are the most useful shortcuts to remember:

Committing & Branching

Alias Full Command When to use it
gst git status Check what's modified.
gco git checkout Switch branches (e.g., gco main).
gcb git checkout -b Create and switch to a new branch.
gca! git commit -v -a --amend Lifesaver: Add your current changes to the last commit without editing the message.
gwip git commit -m "--wip--" Quick commit everything as a "Work In Progress" so you can switch branches safely.

Pulling, Pushing & Logs

Alias Full Command When to use it
gl git pull Update your local branch.
gp git push Push local commits to remote.
gpf! git push --force Force push (use with caution).
glog git log --oneline --graph View a beautiful, colored tree graph of your commit history.

💻 Server Admin commands (The "I always forget this" list)

Docker Survival

  • Check running containers & ports cleanly:
    docker ps -a --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
    
  • Drop into a container's shell:
    docker exec -it <container_name> /bin/bash 
    # (use /bin/sh if bash isn't found)
    
  • View live logs for a specific service:
    docker logs -f <container_name>
    

Networking & Ports

  • "What process is using this port?"
    ss -tulnp | grep <port_number> 
    # (Requires sudo to see process names)
    
  • Check UFW Firewall Status:
    sudo ufw status numbered
    
  • Manually trigger Cloudflare Tunnel connection check:
    docker logs -n 50 cloudflare-tunnel
    

Disk Space Management

  • See human-readable disk usage:
    df -hT | grep -v "tmpfs\|overlay\|shm"
    
  • Find the largest folders in the current directory:
    du -sh * | sort -hr | head -n 10
    
  • Check systemd timer schedules (When does Kopia/Snapshots run?):
    systemctl list-timers --all