Age
Comprehensive age commands and usage patterns for efficient workflow management.
Overview
Age is a powerful tool for various operations and system management. This cheat sheet covers essential commands, configuration options, and best practices.
Installation
Linux/Ubuntu
# Package manager installation
sudo apt update
sudo apt install age
# Alternative installation
wget -O age https://github.com/example/age/releases/latest/download/age-linux
chmod +x age
sudo mv age /usr/local/bin/
macOS
# Homebrew installation
brew install age
# Manual installation
curl -L -o age https://github.com/example/age/releases/latest/download/age-macos
chmod +x age
sudo mv age /usr/local/bin/
Windows
# Chocolatey installation
choco install age
# Scoop installation
scoop install age
# Manual installation
# Download from official website and add to PATH
Basic Commands
Command | Description |
---|---|
age --help |
Display help information |
age --version |
Show version information |
age init |
Initialize age in current directory |
age status |
Check current status |
age list |
List available options |
age info |
Display system information |
age config |
Show configuration |
age update |
Update to latest version |
Essential Operations
Getting Started
# Initialize age
age init
# Basic usage
age run
# With verbose output
age --verbose run
# With configuration file
age --config config.yaml run
Configuration
# View configuration
age config show
# Set configuration option
age config set key value
# Get configuration value
age config get key
# Reset configuration
age config reset
Advanced Operations
# Debug mode
age --debug run
# Dry run (preview changes)
age --dry-run run
# Force operation
age --force run
# Parallel execution
age --parallel run
File Operations
Command | Description |
---|---|
age create <file> |
Create new file |
age read <file> |
Read file contents |
age update <file> |
Update existing file |
age delete <file> |
Delete file |
age copy <src> <dst> |
Copy file |
age move <src> <dst> |
Move file |
Network Operations
# Connect to remote host
age connect host:port
# Listen on port
age listen --port 8080
# Send data
age send --data "message" --target host
# Receive data
age receive --port 8080
Security Features
Authentication
# Login with credentials
age login --user username
# Logout
age logout
# Change password
age passwd
# Generate API key
age generate-key
Encryption
# Encrypt file
age encrypt file.txt
# Decrypt file
age decrypt file.txt.enc
# Generate certificate
age cert generate
# Verify signature
age verify file.sig
Troubleshooting
Common Issues
Issue: Command not found
# Check if installed
which age
# Reinstall if necessary
sudo apt reinstall age
Issue: Permission denied
# Run with sudo
sudo age command
# Fix permissions
chmod +x /usr/local/bin/age
Issue: Configuration errors
# Reset configuration
age config reset
# Validate configuration
age config validate
Debug Commands
Command | Description |
---|---|
age --debug |
Enable debug output |
age --verbose |
Verbose logging |
age test |
Run self-tests |
age doctor |
Check system health |
Best Practices
Security
- Always verify checksums when downloading
- Use strong authentication methods
- Regularly update to latest version
- Follow principle of least privilege
Performance
- Use appropriate buffer sizes
- Monitor resource usage
- Optimize configuration for your use case
- Regular maintenance and cleanup
Maintenance
# Update age
age update
# Clean temporary files
age clean
# Backup configuration
age backup --config
# Restore from backup
age restore --config backup.yaml
Integration
Scripting
#!/bin/bash
# Example script using age
if ! command -v age &> /dev/null; then
echo "age is not installed"
exit 1
fi
if age run; then
echo "Success"
else
echo "Failed"
exit 1
fi
API Integration
import subprocess
import json
def run_age(command):
try:
result = subprocess.run(['age'] + command.split(),
capture_output=True, text=True)
return result.stdout
except Exception as e:
print(f"Error: \\\\{e\\\\}")
return None
Environment Variables
Variable | Description | Default |
---|---|---|
AGE_CONFIG |
Configuration file path | ~/.age/config |
AGE_HOME |
Home directory | ~/.age |
AGE_LOG_LEVEL |
Logging level | INFO |
AGE_TIMEOUT |
Operation timeout | 30s |
Configuration File
# ~/.age/config.yaml
version: "1.0"
settings:
debug: false
timeout: 30
log_level: "INFO"
network:
host: "localhost"
port: 8080
ssl: true
security:
auth_required: true
encryption: "AES256"
Examples
Basic Workflow
# 1. Initialize
age init
# 2. Configure
age config set host example.com
# 3. Run operation
age run
# 4. Check results
age status
# 5. Cleanup
age clean
Advanced Workflow
# Comprehensive operation
age run \
--config production.yaml \
--parallel \
--verbose \
--timeout 300
# Monitoring
age monitor \
--interval 60 \
--alert-threshold 80
Resources
Official Documentation
Community
Tutorials
Last updated: 2025-07-05