Shell Aliases & Functions Reference
Complete guide to all aliases and functions available in this dotfiles configuration.
Table of Contents
- EZA (ls replacement)
- BAT (cat replacement)
- Navigation
- File Operations
- Search & Find
- Git
- System Monitoring
- Network
- Tmux
- Utility Functions
- NixOS Specific
EZA (ls replacement)
Modern replacement for ls with icons, git integration,
and colors.
Basic Listing
ls # Basic list with icons and directories first
l # Same as ls
ll # Long format with git status
la # Long format with hidden files
l. # Hidden files onlySorted Views
llt # Sort by modification time
lls # Sort by size
lla # Long format with all details and headerTree Views
lt # Tree view of directory
lt1 # Tree view, 1 level deep
lt2 # Tree view, 2 levels deep
lt3 # Tree view, 3 levels deepGit Integration
lg # Long list with git status, ignore git-ignored filesExamples:
# Show current directory with icons
ls
# Long format with git status
ll
# Tree view 2 levels deep
lt2
# Show only hidden files
l.BAT (cat replacement)
Syntax-highlighted file viewer with git integration.
cat <file> # Syntax-highlighted cat
catp <file> # Plain cat without decorations
catl <file> # Cat with line numbersExamples:
# View a Python file with syntax highlighting
cat script.py
# View without line numbers or decorations
catp config.txt
# View with line numbers
catl app.jsNavigation
Quick directory navigation aliases.
.. # Go up one directory
... # Go up two directories
.... # Go up three directories
..... # Go up four directories
~ # Go to home directory
- # Go to previous directory
# Quick shortcuts
dl # cd ~/Downloads
doc # cd ~/Documents
dt # cd ~/DesktopExamples:
# Go up two directories
...
# Go to previous directory
-
# Go to Downloads
dlFile Operations
Enhanced file operation commands with safety features.
cp # Copy with interactive prompt and verbose
mv # Move with interactive prompt and verbose
rm # Remove with interactive prompt (if >3 files)
mkdir # Create directory with parents, verbose
# Always interactive variants
rmi # rm with always-on interactive prompt
cpi # cp with always-on interactive prompt
mvi # mv with always-on interactive promptFunctions
mkcd - Make directory and cd into it
mkcd <directory>Example:
mkcd project/src/components
# Creates nested directories and cd's into itbackup - Create timestamped backup
backup <file>Example:
backup important-config.nix
# Creates: important-config.nix.backup-20251223-120500extract - Extract any archive
extract <archive-file>Supports: tar.gz, tar.bz2, tar.xz, zip, rar, 7z, and more.
Example:
extract archive.tar.gz
extract package.ziptargz - Create tar.gz archive
targz <file-or-directory>Example:
targz myproject/
# Creates: myproject.tar.gzzipf - Create zip archive
zipf <file-or-directory>Example:
zipf documents/
# Creates: documents.zipcpp - Copy with progress bar
cpp <source> <destination>Example:
cpp large-file.iso /mnt/usb/mvp - Move with progress bar
mvp <source> <destination>Search & Find
Enhanced search commands.
rg <pattern> # Smart-case ripgrep with hidden files
rga <pattern> # Search all files including ignoredFunctions
findlarge - Find large files
findlargeFinds all files larger than 100MB in current directory.
findreplace - Find and replace in files
findreplace <search> <replace> [pattern]Example:
findreplace "old_function" "new_function" "*.py"filecount - Count files by extension
filecount [directory]Example:
filecount .
# Output:
# 42 .nix
# 23 .md
# 15 .shGit
Comprehensive git aliases for common operations.
Status & Info
g # git
gs # git status
gl # git log (oneline, graph)
gla # git log --all (all branches)
gb # git branchAdding & Committing
ga # git add
gaa # git add --all
gc # git commit
gcm # git commit -m "message"Pushing & Pulling
gp # git push
gpl # git pullDiff & Branches
gd # git diff
gdc # git diff --cached
gco # git checkout
gcb # git checkout -b (new branch)Stash
gst # git stash
gstp # git stash popExamples:
# Quick status check
gs
# Add all and commit
gaa
gcm "Add new feature"
# Create new branch and switch to it
gcb feature/new-widget
# View graphical log
glSystem Monitoring
Monitor system resources and processes.
df # Disk free (human readable)
du # Disk usage (human readable)
free # Memory info (human readable)Process Management
psg <name> # Grep running processes
topcpu # Top 10 CPU-consuming processes
topmem # Top 10 memory-consuming processesFunctions
psgrep - Find process by name
psgrep <process-name>Example:
psgrep firefoxkillps - Kill process by name
killps <process-name>Example:
killps chromedusort - Show directory sizes sorted
dusort [directory]Example:
dusort /var/log
# Shows all subdirectories sorted by sizesysinfo - Show system information
sysinfoShows: hostname, OS, kernel, uptime, CPU, memory, disk.
countfiles / countdirs - Count files or directories
countfiles [directory]
countdirs [directory]Network
Network utilities and information.
ports # Show all listening ports
listening # Show listening ports with process infoIP Addresses
myip # Get public IP address
myip4 # Get public IPv4 address
myip6 # Get public IPv6 address
localip # Get local IP addressFunctions
lports - List listening ports
lportsShows all ports the system is listening on.
weather - Quick weather
weather [location]Example:
weather
weather London
weather "New York"weatherfull - Detailed weather
weatherfull [location]Shows full weather forecast.
Tmux
Comprehensive tmux session and window management with 30+ aliases and functions.
Basic Session Management
ta # Attach to last session
tat <name> # Attach to named session
tls # List sessions
tnew <name> # Create new session
tkill <name> # Kill session
tka # Kill all sessions except current
tkall # Kill all sessions including server
tds # Detach from session
trs <name> # Rename current session
tss <name> # Switch to sessionWindow & Pane Management
tw # New window
twn <name> # New window with name
ts # Split window
tsh # Horizontal split
tsv # Vertical split
trw <name> # Rename current windowSmart Functions
t - Quick launcher
t # Attach to last or create default session
t dev # Attach to 'dev' or create ittn - Create or attach
tn work # Create 'work' session or attach if existstlist - Detailed session list
tlist
# Shows:
# dev: 3 windows, created 2h ago, attached: 1
# work: 2 windows, created 1d ago, attached: 0tdev - Development session layout
tdev # Create 'dev' session with predefined layout
tdev myproject # Create 'myproject' session
# Creates 4 windows:
# 1. editor - Split for code and terminal
# 2. servers - For dev servers
# 3. git - For git operations
# 4. misc - For other taskstmon - Monitoring session
tmon # Create 'monitor' session with system monitoring
# Creates 4 panes showing:
# - htop (system resources)
# - journalctl (system logs)
# - ss (network stats)
# - Free pane for commandstsendall - Send command to all panes
tsendall ls # Run 'ls' in all panes of current window
tsendall pwd # Run 'pwd' in all panestclone - Clone pane to new window
tclone # Move current pane to its own windowtjoin - Join pane from another window
tjoin 2 # Join pane from window 2 to current windowtsave - Save session layout
tsave
# Saves to: ~/.tmux-session-<name>.txttswitch - Interactive session switcher (with fzf)
tswitch # Fuzzy search and switch sessionstsm - Session manager (with fzf)
tsm # Interactive menu for session operations
# Options: New session, Attach, Kill, ListExamples
Quick start development:
# Create dev session with layout
tdev myproject
# Or just use quick launcher
t myprojectMonitor system:
# Start monitoring session
tmon
# View in split panes: htop, logs, network statsSession management:
# List all sessions
tlist
# Switch between sessions (with fzf)
tswitch
# Kill old sessions
tkill old-session
# Rename current session
trs new-nameWindow management:
# Create new window with name
twn servers
# Rename current window
trw editing
# Split horizontally
tsh
# Split vertically
tsvAdvanced:
# Send command to all panes
tsendall "git pull"
# Save current layout
tsave
# Join window 3 to current
tjoin 3
# Clone pane to new window
tcloneTmux Key Bindings Quick Reference
These are default tmux bindings (prefix is Ctrl+b):
Prefix + c # New window
Prefix + , # Rename window
Prefix + n # Next window
Prefix + p # Previous window
Prefix + % # Split horizontal
Prefix + " # Split vertical
Prefix + arrow # Navigate panes
Prefix + x # Kill pane
Prefix + d # Detach session
Prefix + [ # Enter copy mode
Prefix + ] # Paste
Tips
- Use t for everything:
tattaches to last or creates default - tdev for projects: Automatic multi-window layout
- tmon for debugging: Pre-configured monitoring setup
- tswitch for navigation: Fuzzy find with fzf
- tsendall for batch: Run commands across all panes
Utility Functions
serve - Quick HTTP server
serve [port]Default port: 8000
Example:
serve 3000
# Starts HTTP server on port 3000note - Quick note taking
note [text] # Add note with timestamp
note # View all notesExample:
note "Remember to backup before deployment"
note "Bug in user authentication module"
note # View all notespath - Show PATH in readable format
pathDisplays PATH variable with line numbers.
json - Pretty print JSON
json '<json-string>'
echo '{"key":"value"}' | jsonExample:
json '{"name":"Alice","age":30}'
cat data.json | jsongenpass - Generate random password
genpass [length]Default length: 20
Example:
genpass 32
# Generates 32-character passworduuid - Generate UUID
uuidman - Colored man pages
man <command>Uses bat for syntax-highlighted man pages.
NixOS Specific
See also: README.md for complete NixOS functions.
Quick Rebuild
nrs # nixos-rebuild switch
nrb # nixos-rebuild boot
nrt # nixos-rebuild test
nrsv # nixos-rebuild switch with verbose output
nrbs # nixos-rebuild build (test without switching)Update & Maintenance
nixup # Update flake and rebuild
nixup-input <name> # Update specific input
nixclean [days] # Clean old generations (default: 30 days)
nixclean-all # Clean all old generationsInformation
nixgen # Show all generations
nixdu # Show disk usage
nixdiff [g1] [g2] # Compare generations
nixlist # List installed packagesPackage Management
nixsearch <pkg> # Search for package
nixinfo <pkg> # Show package info
nixshell <pkg...> # Enter shell with packages
nixrun <pkg> [cmd] # Run package command
nixtry <pkg> # Try package temporarilyFlake Management
nixcheck # Check flake for errors
nixshow # Show flake outputsMiscellaneous
h # History
j # Jobs list
c # Clear screen
q # Exit shell
now # Current date and time
nowutc # Current UTC time
timestamp # Unix timestamp
reload # Reload shell configurationColor Enhancements
These commands are automatically colorized:
grep,egrep,fgrep- Color in grep outputdiff- Colorized diff output
Tips & Tricks
Combine Commands
# Create project structure
mkcd myproject && mkcd src && mkcd components
# Quick git workflow
gaa && gcm "Update feature" && gp
# Find and extract
ll | grep archive
extract myarchive.tar.gzUsing with FZF
Many commands work great with fzf:
# Fuzzy search and cat file
cat $(fzf)
# Fuzzy search and cd
cd $(find . -type d | fzf)
# Kill process with fuzzy search
killps $(ps aux | fzf | awk '{print $2}')Pipeline Examples
# Find large files and view details
findlarge | bat
# Show process tree
psg nginx | bat
# Pretty print JSON from curl
curl -s https://api.example.com/data | json
# Count file types in project
filecount ~/projects/myappCustomization
All aliases and functions are defined in
/etc/dotfiles/shell-aliases.sh.
To add your own:
- Edit
home/shell-aliases.shin your dotfiles - Rebuild:
nrs - Reload shell:
reloador start new shell
Example custom alias:
# Add to shell-aliases.sh
alias myalias='echo "Hello from my alias"'
# Then rebuild
nrsCheatsheet Quick Reference
# File Navigation
ls, ll, la, lt # List files (eza)
.., ..., cd - # Navigate directories
mkcd <dir> # Make and cd
# File Operations
cat, catp # View files (bat)
backup <file> # Create backup
extract <archive> # Extract archive
# Git
gs, gaa, gcm # Status, add all, commit
gp, gpl # Push, pull
gl, gd # Log, diff
# System
topcpu, topmem # Top processes
sysinfo # System info
dusort # Directory sizes
# Network
myip, localip # IP addresses
weather # Current weather
# NixOS
nrs # Rebuild system
nixup # Update system
nixsearch # Search packages
# Utilities
serve # HTTP server
genpass # Generate password
note # Take notes
json # Pretty JSONSee Also
- README.md - Main documentation
- USER-MANAGEMENT.md - User and password management
- Shell Aliases Source - Raw alias definitions