commit e2bc5a2b538b71ccde55d1d2fe0a3833aed64420 Author: ilia Date: Sun Aug 31 13:38:29 2025 -0400 Enhance onboarding script and documentation for developer setup. Added functions for Git configuration, SSH key generation, and connection testing. Updated README with setup instructions and usage tips. diff --git a/README.md b/README.md new file mode 100644 index 0000000..4f4f836 --- /dev/null +++ b/README.md @@ -0,0 +1,71 @@ +# Developer Onboarding + +A comprehensive developer environment setup toolkit that automates the installation of essential tools and configures Git and SSH for seamless development workflows. + +## Overview + +This project provides scripts and documentation to quickly set up a development environment with all the necessary tools, from basic system utilities to modern development tools and containerization platforms. + +## Quick Start + +### Prerequisites +- Ubuntu/Debian-based Linux system +- `sudo` privileges for package installation +- Internet connection + +### Setup Process + +1. **Run the onboarding script:** + ```bash + chmod +x onboarding.sh + ./onboarding.sh + ``` + +2. **Follow the interactive prompts:** + - Configure Git username and email + - Generate SSH keys for secure Git operations + - Test SSH connection to your Git server + +## What Gets Configured + +### Git Configuration +- Global username and email setup +- Credential caching for convenience +- Color output for better readability + +### SSH Key Management +- Ed25519 SSH key generation (modern, secure) +- Automatic key copying to clipboard +- SSH connection testing to Git server + +## Files in This Repository + +- `onboarding.sh` - Main interactive setup script +- `onboarding.sh.save` - Backup/alternative version +- `applications.md` - Complete list of installed applications +- `README.md` - This file + +## Usage Tips + +- The script is idempotent - safe to run multiple times +- SSH keys are only generated if they don't already exist +- Git config is only set if not already configured +- All operations are interactive with user confirmation + +## Customization + +You can modify the `onboarding.sh` script to: +- Change the Git server URL (currently set to `10.0.30.169:3000`) +- Adjust SSH key types or parameters +- Add additional Git configuration options + +## Support + +If you encounter issues: +1. Ensure you have the required permissions +2. Check network connectivity to the Git server +3. Verify SSH key permissions (`chmod 600 ~/.ssh/id_ed25519`) + +## Contributing + +Feel free to submit issues or pull requests to improve the onboarding experience. diff --git a/applications.md b/applications.md new file mode 100644 index 0000000..6f22bc0 --- /dev/null +++ b/applications.md @@ -0,0 +1,1203 @@ +# Installed Applications Guide + +This document provides an overview of all applications installed by the Ansible playbook, organized by category with descriptions of their general use cases. + +## SSH & Security + +### openssh-server +**Purpose**: SSH daemon server for secure remote access +**Use**: Enables secure shell connections to your machine from other systems. Essential for remote development and server management. +**Syntax**: Service management via systemctl +**Examples**: +```bash +# Check SSH service status +sudo systemctl status ssh + +# Start/stop/restart SSH service +sudo systemctl start ssh +sudo systemctl restart ssh + +# Connect to remote server +ssh username@hostname +ssh -p 2222 user@server.com # Custom port +``` +**Documentation**: [OpenSSH Manual](https://www.openssh.com/manual.html) + +### ufw (Uncomplicated Firewall) +**Purpose**: Simple firewall management +**Use**: Protect your system by controlling incoming and outgoing network traffic with easy-to-understand rules. +**Syntax**: `ufw [options] [rule]` +**Examples**: +```bash +# Enable/disable firewall +sudo ufw enable +sudo ufw disable + +# Allow/deny ports +sudo ufw allow 22 # SSH +sudo ufw allow 80/tcp # HTTP +sudo ufw deny 23 # Telnet + +# Check status +sudo ufw status verbose +``` +**Documentation**: [UFW Documentation](https://help.ubuntu.com/community/UFW) + +### fail2ban +**Purpose**: Intrusion prevention system +**Use**: Automatically bans IP addresses that show suspicious activity (like repeated failed login attempts). +**Syntax**: `fail2ban-client [options]` +**Examples**: +```bash +# Check status +sudo fail2ban-client status + +# Check specific jail status +sudo fail2ban-client status sshd + +# Unban an IP +sudo fail2ban-client set sshd unbanip 192.168.1.100 + +# Start/stop service +sudo systemctl restart fail2ban +``` +**Documentation**: [Fail2ban Manual](https://fail2ban.readthedocs.io/) + +## Base System Utilities + +### curl +**Purpose**: Command line HTTP client +**Use**: Download files, test APIs, send HTTP requests from the terminal. Essential for web development and scripting. +**Syntax**: `curl [options] URL` +**Examples**: +```bash +# Basic GET request +curl https://api.example.com + +# POST with JSON data +curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' https://api.example.com + +# Download file +curl -O https://example.com/file.zip + +# Follow redirects and show headers +curl -L -I https://example.com +``` +**Documentation**: [curl Manual](https://curl.se/docs/manpage.html) + +### wget +**Purpose**: Network downloader +**Use**: Download files from web servers, supports resume and recursive downloads. Great for downloading large files or mirroring websites. +**Syntax**: `wget [options] URL` +**Examples**: +```bash +# Download a file +wget https://example.com/file.zip + +# Resume interrupted download +wget -c https://example.com/largefile.iso + +# Download recursively (mirror site) +wget -r -np -k https://example.com/ + +# Download in background +wget -b https://example.com/file.zip +``` +**Documentation**: [GNU Wget Manual](https://www.gnu.org/software/wget/manual/) + +### unzip +**Purpose**: Archive extraction utility +**Use**: Extract ZIP archives from command line. Useful for downloaded software packages and file transfers. +**Syntax**: `unzip [options] archive.zip` +**Examples**: +```bash +# Extract all files +unzip archive.zip + +# Extract to specific directory +unzip archive.zip -d /target/directory + +# List contents without extracting +unzip -l archive.zip + +# Extract specific file +unzip archive.zip file.txt +``` +**Documentation**: [unzip Manual](http://infozip.sourceforge.net/UnZip.html) + +### xclip +**Purpose**: Clipboard utility for X11 +**Use**: Copy and paste text between terminal and GUI applications. Integrates command line output with desktop clipboard. +**Syntax**: `xclip [options]` +**Examples**: +```bash +# Copy file contents to clipboard +xclip -sel clip < file.txt + +# Copy command output to clipboard +echo "Hello World" | xclip -selection clipboard + +# Paste from clipboard +xclip -o -sel clip + +# Copy SSH public key +cat ~/.ssh/id_rsa.pub | xclip -sel clip +``` +**Documentation**: [xclip Manual](https://github.com/astrand/xclip) + +### tree +**Purpose**: Directory tree display utility +**Use**: Visualize directory structures in a tree format. Helpful for understanding project layouts and file organization. +**Syntax**: `tree [options] [directory]` +**Examples**: +```bash +# Show current directory tree +tree + +# Show tree with file sizes +tree -h + +# Limit depth to 2 levels +tree -L 2 + +# Show only directories +tree -d + +# Exclude certain patterns +tree -I 'node_modules|*.pyc' +``` +**Documentation**: [tree Manual](http://mama.indstate.edu/users/ice/tree/) + +## Network & Admin Tools + +### net-tools +**Purpose**: Network configuration tools (ifconfig, netstat, etc.) +**Use**: Traditional network troubleshooting and configuration. View network interfaces, routing tables, and connection statistics. +**Syntax**: Various commands included +**Examples**: +```bash +# Show network interfaces +ifconfig +ifconfig eth0 # Specific interface + +# Show network connections +netstat -tuln # TCP/UDP listening ports +netstat -i # Interface statistics + +# Show routing table +route -n + +# Show ARP table +arp -a +``` +**Documentation**: [net-tools Documentation](https://sourceforge.net/projects/net-tools/) + +### mailutils +**Purpose**: Mail handling utilities +**Use**: Send and manage emails from command line. Useful for system notifications and automated email tasks. +**Syntax**: `mail [options] recipient` +**Examples**: +```bash +# Send simple email +echo "Message body" | mail -s "Subject" user@example.com + +# Send email with attachment +mail -s "Subject" -A /path/to/file user@example.com < message.txt + +# Check mail +mail + +# Send email from script +echo "Server backup completed" | mail -s "Backup Status" admin@company.com +``` +**Documentation**: [GNU Mailutils Manual](https://mailutils.org/manual/) + +## Monitoring & System Tools + +### iotop +**Purpose**: I/O usage monitoring +**Use**: Monitor disk read/write activity by process. Essential for diagnosing performance issues and identifying I/O bottlenecks. +**Syntax**: `iotop [options]` +**Examples**: +```bash +# Monitor I/O in real-time +sudo iotop + +# Show only processes doing I/O +sudo iotop -o + +# Show accumulated I/O +sudo iotop -a + +# Non-interactive mode +sudo iotop -b -n 3 +``` +**Documentation**: [iotop Manual](http://guichaz.free.fr/iotop/) + +### nethogs +**Purpose**: Network bandwidth monitoring per process +**Use**: See which applications are using network bandwidth in real-time. Great for troubleshooting network performance. +**Syntax**: `nethogs [options] [device]` +**Examples**: +```bash +# Monitor network usage +sudo nethogs + +# Monitor specific interface +sudo nethogs eth0 + +# Monitor with delay in seconds +sudo nethogs -d 5 + +# Monitor multiple interfaces +sudo nethogs eth0 wlan0 +``` +**Documentation**: [nethogs GitHub](https://github.com/raboof/nethogs) + +### logwatch +**Purpose**: Log analysis and reporting +**Use**: Automatically analyze system logs and generate summary reports. Helps identify security issues and system problems. +**Syntax**: `logwatch [options]` +**Examples**: +```bash +# Generate today's report +logwatch --detail low --mailto admin@example.com --service all + +# Generate report for specific date range +logwatch --range yesterday +logwatch --range "2024-01-01 - 2024-01-07" + +# Generate detailed SSH report +logwatch --service sshd --detail high + +# Test configuration +logwatch --print +``` +**Documentation**: [Logwatch Documentation](https://sourceforge.net/projects/logwatch/) + +## Modern CLI Tools + +### jq +**Purpose**: JSON processor +**Use**: Parse, filter, and manipulate JSON data from command line. Essential for API development and data processing. +**Syntax**: `jq [options] filter [file]` +**Examples**: +```bash +# Pretty print JSON +echo '{"name":"John","age":30}' | jq . + +# Extract specific field +echo '{"name":"John","age":30}' | jq '.name' + +# Filter array elements +echo '[{"name":"John"},{"name":"Jane"}]' | jq '.[0]' + +# Use with curl +curl -s https://api.github.com/users/octocat | jq '.login' +``` +**Documentation**: [jq Manual](https://jqlang.github.io/jq/manual/) + +### ripgrep (rg) +**Purpose**: Fast text search tool +**Use**: Search for text patterns in files and directories. Much faster than traditional grep, especially for large codebases. +**Syntax**: `rg [options] pattern [path]` +**Examples**: +```bash +# Basic search +rg "function" + +# Search in specific file types +rg "TODO" --type js + +# Case insensitive search +rg -i "error" + +# Search with context lines +rg -A 3 -B 3 "function main" + +# Search and replace preview +rg "old_name" --replace "new_name" --passthru +``` +**Documentation**: [ripgrep User Guide](https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md) + +### fd-find (fd) +**Purpose**: Modern file finder +**Use**: Find files and directories with intuitive syntax and fast performance. Better alternative to traditional `find` command. +**Syntax**: `fd [options] pattern [path]` +**Examples**: +```bash +# Find files by name +fd config + +# Find files by extension +fd -e js + +# Find directories only +fd -t d bin + +# Exclude hidden files +fd --no-hidden config + +# Execute command on results +fd -e log -x rm {} +``` +**Documentation**: [fd GitHub](https://github.com/sharkdp/fd) + +## Shell & Terminal + +### zsh +**Purpose**: Z shell - advanced shell +**Use**: Enhanced shell with better tab completion, history, and scripting capabilities compared to bash. +**Syntax**: Interactive shell and scripting +**Examples**: +```bash +# Switch to zsh +zsh + +# Set as default shell +chsh -s $(which zsh) + +# Zsh-specific features +setopt AUTO_CD # cd by typing directory name +setopt HIST_IGNORE_DUPS # ignore duplicate commands + +# Advanced globbing +ls **/*.txt # recursive file matching +ls *.txt~backup.txt # exclude pattern +``` +**Documentation**: [Zsh Manual](https://zsh.sourceforge.io/Doc/) + +### tmux +**Purpose**: Terminal multiplexer +**Use**: Run multiple terminal sessions in one window, detach/reattach sessions, and split terminals. Essential for remote work. +**Syntax**: `tmux [command]` +**Examples**: +```bash +# Start new session +tmux new-session -s mysession + +# List sessions +tmux list-sessions + +# Attach to session +tmux attach-session -t mysession + +# Key bindings (default prefix Ctrl+b) +# Ctrl+b % - split vertically +# Ctrl+b " - split horizontally +# Ctrl+b d - detach session +``` +**Documentation**: [tmux Manual](https://github.com/tmux/tmux/wiki) + +### Oh My Zsh +**Purpose**: Zsh framework +**Use**: Provides themes, plugins, and configurations for zsh. Makes the shell more user-friendly and productive. +**Syntax**: Configuration via `~/.zshrc` +**Examples**: +```bash +# Update Oh My Zsh +omz update + +# Change theme in ~/.zshrc +ZSH_THEME="agnoster" + +# Enable plugins in ~/.zshrc +plugins=(git docker kubectl node npm) + +# Reload configuration +source ~/.zshrc +``` +**Documentation**: [Oh My Zsh Wiki](https://github.com/ohmyzsh/ohmyzsh/wiki) + +#### **Essential Oh My Zsh Plugins Guide** + +The following plugins significantly enhance your shell experience. Add them to your `~/.zshrc` file: + +```bash +plugins=(git sudo z colored-man-pages fzf zsh-syntax-highlighting zsh-autosuggestions web-search copypath) +``` + +##### **git** +**Purpose**: Git integration and aliases +**Usage**: Provides shortcuts and status information for Git repositories +```bash +# Aliases provided: +ga # git add +gst # git status +gc # git commit +gp # git push +gl # git pull +gco # git checkout +gbr # git branch + +# Branch info in prompt automatically shown +# Works in any Git repository +``` + +##### **sudo** +**Purpose**: Easily retry commands with sudo +**Usage**: Press `ESC` twice to add sudo to the beginning of current command +```bash +# Type a command that needs sudo +apt update +# Press ESC ESC to get: +sudo apt update + +# Also works with previous command +# Just press ESC ESC on empty line +``` + +##### **z** +**Purpose**: Smart directory jumping based on frequency +**Usage**: Jump to frequently used directories with partial names +```bash +# After visiting directories, z learns your patterns +cd ~/Documents/code/projects/myapp +cd ~/Downloads +cd ~/Documents/code/projects/myapp # visited again + +# Later, jump directly: +z myapp # jumps to ~/Documents/code/projects/myapp +z doc # jumps to ~/Documents +z proj # jumps to ~/Documents/code/projects + +# List all tracked directories +z -l +``` + +##### **colored-man-pages** +**Purpose**: Colorized manual pages for better readability +**Usage**: Automatic - man pages now have syntax highlighting +```bash +# Before: plain black and white +man ls + +# After: colored sections, options, and examples +# Headers in bold, options in different colors +# Much easier to read and navigate +``` + +##### **fzf** +**Purpose**: Fuzzy finder integration +**Usage**: Enhanced search and selection with fuzzy matching +```bash +# Reverse search with fuzzy matching +Ctrl+R # Search command history with fuzzy finder + +# File/directory selection +Ctrl+T # Insert selected files/directories into command line +Alt+C # cd into selected directory + +# Example workflow: +vim ** # Opens fzf to select file +ssh ** # Select from SSH hosts +kill -9 ** # Select process to kill +``` + +##### **zsh-syntax-highlighting** +**Purpose**: Real-time syntax highlighting in terminal +**Usage**: Automatic - commands are highlighted as you type +```bash +# Valid commands: green +ls -la # Appears in green as you type + +# Invalid commands: red +invalidcommand # Appears in red + +# Strings and paths: different colors +echo "hello" # String in quotes highlighted +cat /etc/hosts # Valid path highlighted differently +``` + +##### **zsh-autosuggestions** +**Purpose**: Fish-like autosuggestions based on history +**Usage**: Suggestions appear in gray text as you type +```bash +# Start typing a command you've used before: +git sta +# Suggestion appears: git status (in gray) + +# Accept suggestion: +→ (Right arrow) # Accept entire suggestion +Ctrl+→ # Accept one word + +# Example: +git s # Shows: git status +→ # Completes to: git status +``` + +##### **web-search** +**Purpose**: Search the web directly from terminal +**Usage**: Quick web searches with predefined engines +```bash +# Search Google +google "zsh plugins" +google terminal tricks + +# Search GitHub +github "oh my zsh themes" + +# Search Stack Overflow +stackoverflow "bash vs zsh" + +# Search YouTube +youtube "linux tutorials" + +# Other engines available: +duckduckgo "privacy search" +bing "microsoft docs" +yahoo "old school search" +``` + +##### **copypath** +**Purpose**: Copy current path or file paths to clipboard +**Usage**: Quickly copy paths for use in other applications +```bash +# Copy current directory path +copypath + +# Copy specific file/directory path +copypath ~/.zshrc +copypath ~/Documents/project + +# Useful for: +# - Pasting paths into file dialogs +# - Sharing directory locations +# - Documentation and notes +``` + +#### **Plugin Installation & Configuration** + +1. **Edit your zsh configuration:** +```bash +vim ~/.zshrc +# or +nano ~/.zshrc +``` + +2. **Add plugins to the plugins array:** +```bash +plugins=(git sudo z colored-man-pages fzf zsh-syntax-highlighting zsh-autosuggestions web-search copypath) +``` + +3. **Install additional plugins (if needed):** +```bash +# For zsh-syntax-highlighting (if not included) +git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting + +# For zsh-autosuggestions (if not included) +git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions +``` + +4. **Reload your configuration:** +```bash +source ~/.zshrc +# or +exec zsh +``` + +#### **Pro Tips** + +- **Customize suggestion color:** +```bash +# Add to ~/.zshrc +ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#666666" +``` + +- **Configure fzf colors:** +```bash +# Add to ~/.zshrc +export FZF_DEFAULT_OPTS="--height 40% --layout=reverse --border" +``` + +- **Z plugin tips:** +```bash +# Use with other commands +vim $(z -e myproject) # Edit files in frequent directory +``` + +**Documentation**: [Oh My Zsh Wiki](https://github.com/ohmyzsh/ohmyzsh/wiki) + +### Powerlevel10k +**Purpose**: Zsh theme +**Use**: Modern, fast, and informative shell prompt with Git status, execution time, and system information. +**Syntax**: Configuration wizard and manual config +**Examples**: +```bash +# Run configuration wizard +p10k configure + +# Reload theme +exec zsh + +# Enable instant prompt in ~/.zshrc +# Enable Powerlevel10k instant prompt (add to top of ~/.zshrc) +if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then + source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" +fi +``` +**Documentation**: [Powerlevel10k GitHub](https://github.com/romkatv/powerlevel10k) + +## Development Tools + +### git +**Purpose**: Version control system +**Use**: Track code changes, collaborate with teams, and manage project history. Fundamental tool for software development. +**Syntax**: `git [command] [options]` +**Examples**: +```bash +# Basic workflow +git init +git add . +git commit -m "Initial commit" +git push origin main + +# Branching +git branch feature-branch +git checkout feature-branch +git merge main + +# Status and logs +git status +git log --oneline +git diff +``` +**Documentation**: [Git Documentation](https://git-scm.com/doc) + +### nodejs +**Purpose**: JavaScript runtime +**Use**: Run JavaScript applications outside the browser. Essential for modern web development and tooling. +**Syntax**: `node [options] script.js` +**Examples**: +```bash +# Run JavaScript file +node app.js + +# Interactive REPL +node + +# Check version +node --version + +# Run with specific flags +node --inspect app.js # Enable debugger +node --max-old-space-size=4096 app.js # Increase memory +``` +**Documentation**: [Node.js Documentation](https://nodejs.org/en/docs/) + +### npm +**Purpose**: Node.js package manager +**Use**: Install, manage, and publish JavaScript packages. Central tool for Node.js ecosystem. +**Syntax**: `npm [command] [options]` +**Examples**: +```bash +# Initialize project +npm init -y + +# Install packages +npm install express +npm install -g nodemon # Global install +npm install --save-dev jest # Development dependency + +# Run scripts +npm start +npm test +npm run build + +# Package management +npm list +npm outdated +npm update +``` +**Documentation**: [npm Documentation](https://docs.npmjs.com/) + +### build-essential +**Purpose**: Essential build tools (gcc, make, etc.) +**Use**: Compile software from source code. Required for building many applications and development tools. +**Syntax**: Various compilation tools +**Examples**: +```bash +# Compile C program +gcc -o program program.c + +# Use make with Makefile +make +make install +make clean + +# Check installed tools +gcc --version +make --version +g++ --version + +# Compile C++ program +g++ -o program program.cpp +``` +**Documentation**: [GCC Manual](https://gcc.gnu.org/onlinedocs/) + +### python3 +**Purpose**: Python 3 interpreter +**Use**: Run Python applications and scripts. Popular language for automation, data science, and web development. +**Syntax**: `python3 [options] script.py` +**Examples**: +```bash +# Run Python script +python3 script.py + +# Interactive interpreter +python3 + +# Run module as script +python3 -m http.server 8000 +python3 -m json.tool file.json # Pretty print JSON + +# Check version +python3 --version + +# Run with specific flags +python3 -u script.py # Unbuffered output +``` +**Documentation**: [Python Documentation](https://docs.python.org/3/) + +### python3-pip +**Purpose**: Python package installer +**Use**: Install and manage Python packages from PyPI repository. Essential for Python development. +**Syntax**: `pip3 [command] [options]` +**Examples**: +```bash +# Install packages +pip3 install requests +pip3 install -r requirements.txt +pip3 install --user package_name # User install + +# Package management +pip3 list +pip3 show requests +pip3 freeze > requirements.txt + +# Upgrade packages +pip3 install --upgrade package_name +pip3 install --upgrade pip + +# Uninstall +pip3 uninstall package_name +``` +**Documentation**: [pip Documentation](https://pip.pypa.io/en/stable/) + +## Docker Ecosystem + +### apt-transport-https +**Purpose**: APT HTTPS transport +**Use**: Enables package manager to download packages over HTTPS for security. +**Syntax**: Used automatically by APT +**Examples**: +```bash +# APT will automatically use HTTPS transport when configured +# No direct commands - enables secure package downloads + +# Check if HTTPS transport is available +apt list --installed | grep apt-transport-https + +# Used in repository configuration +echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu focal stable" | sudo tee /etc/apt/sources.list.d/docker.list +``` +**Documentation**: [APT Documentation](https://manpages.ubuntu.com/manpages/focal/man1/apt-transport-https.1.html) + +### ca-certificates +**Purpose**: Certificate authorities +**Use**: Trusted certificates for verifying SSL/TLS connections. +**Syntax**: Managed by system +**Examples**: +```bash +# Update certificate store +sudo update-ca-certificates + +# Add custom certificate +sudo cp custom-cert.crt /usr/local/share/ca-certificates/ +sudo update-ca-certificates + +# Check certificate details +openssl x509 -in /etc/ssl/certs/ca-certificates.crt -text -noout + +# Verify SSL connection +openssl s_client -connect example.com:443 -CAfile /etc/ssl/certs/ca-certificates.crt +``` +**Documentation**: [ca-certificates Manual](https://manpages.ubuntu.com/manpages/focal/man8/update-ca-certificates.8.html) + +### gnupg +**Purpose**: GNU Privacy Guard +**Use**: Encrypt, decrypt, and sign data. Used for package verification and secure communications. +**Syntax**: `gpg [options] [files]` +**Examples**: +```bash +# Generate key pair +gpg --gen-key + +# List keys +gpg --list-keys +gpg --list-secret-keys + +# Encrypt/decrypt files +gpg --encrypt --recipient user@example.com file.txt +gpg --decrypt file.txt.gpg + +# Add repository key (common for package management) +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg +``` +**Documentation**: [GnuPG Manual](https://gnupg.org/documentation/) + +### lsb-release +**Purpose**: Linux Standard Base release info +**Use**: Provides system information for scripts and applications to determine OS version. +**Syntax**: `lsb_release [options]` +**Examples**: +```bash +# Show all information +lsb_release -a + +# Show distribution ID +lsb_release -i + +# Show release number +lsb_release -r + +# Show codename +lsb_release -c + +# Used in scripts +if [ "$(lsb_release -si)" = "Ubuntu" ]; then + echo "Running on Ubuntu" +fi +``` +**Documentation**: [lsb_release Manual](https://manpages.ubuntu.com/manpages/focal/man1/lsb_release.1.html) + +### docker-ce +**Purpose**: Docker Community Edition engine +**Use**: Core Docker runtime for creating and running containers. +**Syntax**: `docker [command] [options]` +**Examples**: +```bash +# Basic container operations +docker run hello-world +docker run -it ubuntu bash +docker run -d -p 80:80 nginx + +# Container management +docker ps # List running containers +docker ps -a # List all containers +docker stop container_id +docker rm container_id + +# Image management +docker images +docker pull ubuntu:latest +docker build -t myapp . +``` +**Documentation**: [Docker Documentation](https://docs.docker.com/) + +### docker-ce-cli +**Purpose**: Docker command line interface +**Use**: Command-line tools for interacting with Docker engine. +**Syntax**: Same as docker-ce (provides the `docker` command) +**Examples**: +```bash +# All docker commands come from docker-ce-cli +# See docker-ce section for examples + +# Check CLI version +docker version --format '{{.Client.Version}}' + +# CLI-specific features +docker --help +docker system info +docker system df # Show disk usage +``` +**Documentation**: [Docker CLI Reference](https://docs.docker.com/engine/reference/commandline/cli/) + +### containerd.io +**Purpose**: Container runtime +**Use**: Low-level container runtime that Docker uses to manage containers. +**Syntax**: `ctr [options] [command]` (advanced usage) +**Examples**: +```bash +# Check containerd status +sudo systemctl status containerd + +# Direct containerd commands (advanced) +sudo ctr images list +sudo ctr containers list + +# Usually managed by Docker daemon +# Most users interact through docker commands + +# Check containerd version +containerd --version +``` +**Documentation**: [containerd Documentation](https://containerd.io/docs/) + +### docker-buildx-plugin +**Purpose**: Docker Buildx plugin +**Use**: Advanced Docker build features including multi-platform builds and build caching. +**Syntax**: `docker buildx [command] [options]` +**Examples**: +```bash +# Create and use builder +docker buildx create --name mybuilder --use + +# Multi-platform build +docker buildx build --platform linux/amd64,linux/arm64 -t myapp . + +# Build with cache +docker buildx build --cache-from type=local,src=/tmp/cache --cache-to type=local,dest=/tmp/cache . + +# List builders +docker buildx ls + +# Inspect build +docker buildx imagetools inspect myapp:latest +``` +**Documentation**: [Docker Buildx Documentation](https://docs.docker.com/buildx/) + +### docker-compose-plugin +**Purpose**: Docker Compose plugin +**Use**: Define and run multi-container Docker applications using YAML configuration files. +**Syntax**: `docker compose [command] [options]` +**Examples**: +```bash +# Start services defined in docker-compose.yml +docker compose up +docker compose up -d # Detached mode + +# Stop and remove services +docker compose down + +# View logs +docker compose logs +docker compose logs service_name + +# Scale services +docker compose up --scale web=3 + +# Build services +docker compose build +``` +**Documentation**: [Docker Compose Documentation](https://docs.docker.com/compose/) + +## Desktop Applications + +### redshift +**Purpose**: Blue light filter +**Use**: Automatically adjust screen color temperature based on time of day to reduce eye strain. +**Syntax**: `redshift [options]` +**Examples**: +```bash +# Start redshift with location +redshift -l 40.7:-74.0 # NYC coordinates + +# Run once (no continuous adjustment) +redshift -O 3000 + +# Reset to normal +redshift -x + +# Run in background +redshift & +``` +**Documentation**: [Redshift Manual](http://jonls.dk/redshift/) + +### libreoffice +**Purpose**: Office suite +**Use**: Open-source alternative to Microsoft Office with word processing, spreadsheets, and presentations. +**Syntax**: `libreoffice [options] [file]` +**Examples**: +```bash +# Open LibreOffice start center +libreoffice + +# Open specific applications +libreoffice --writer document.odt +libreoffice --calc spreadsheet.ods +libreoffice --impress presentation.odp + +# Convert documents +libreoffice --convert-to pdf document.docx +libreoffice --headless --convert-to pdf *.docx +``` +**Documentation**: [LibreOffice Help](https://help.libreoffice.org/) + +### evince +**Purpose**: PDF viewer +**Use**: View and navigate PDF documents with search and annotation capabilities. +**Syntax**: `evince [options] [file]` +**Examples**: +```bash +# Open PDF file +evince document.pdf + +# Open at specific page +evince --page-index=5 document.pdf + +# Open in fullscreen +evince --fullscreen document.pdf + +# Print document +evince --preview document.pdf +``` +**Documentation**: [Evince Manual](https://help.gnome.org/users/evince/stable/) + +### brave-browser +**Purpose**: Privacy-focused web browser +**Use**: Web browsing with built-in ad blocking, tracking protection, and privacy features. +**Syntax**: `brave-browser [options] [URL]` +**Examples**: +```bash +# Start Brave browser +brave-browser + +# Open specific URL +brave-browser https://example.com + +# Open in incognito mode +brave-browser --incognito + +# Open with specific profile +brave-browser --profile-directory="Profile 1" + +# Disable web security (development) +brave-browser --disable-web-security --user-data-dir="/tmp/brave" +``` +**Documentation**: [Brave Support](https://support.brave.com/) + +## Snap Packages + +### snapd +**Purpose**: Snap package daemon +**Use**: System service that manages snap packages - universal Linux packages with automatic updates. +**Syntax**: `snap [command] [options]` +**Examples**: +```bash +# Search for snaps +snap find code +snap find --category=development + +# Install/remove snaps +snap install code --classic +snap remove code + +# List installed snaps +snap list + +# Update snaps +snap refresh +snap refresh code # Update specific snap + +# Check snap info +snap info code +``` +**Documentation**: [Snap Documentation](https://snapcraft.io/docs) + +### yq +**Purpose**: YAML processor +**Use**: Parse, filter, and manipulate YAML data from command line. Complement to jq for YAML files. +**Syntax**: `yq [options] expression [file]` +**Examples**: +```bash +# Read YAML value +yq '.database.host' config.yaml + +# Update YAML value +yq '.database.port = 5432' config.yaml + +# Convert YAML to JSON +yq -o json config.yaml + +# Filter arrays +yq '.services[] | select(.name == "web")' docker-compose.yml + +# Merge YAML files +yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' file1.yml file2.yml +``` +**Documentation**: [yq Documentation](https://mikefarah.gitbook.io/yq/) + +### btop +**Purpose**: Modern system monitor +**Use**: Beautiful, feature-rich system monitor showing CPU, memory, disk, and network usage with an intuitive interface. +**Syntax**: `btop [options]` +**Examples**: +```bash +# Start btop +btop + +# Key bindings within btop: +# q - quit +# h - help +# + - add shown information +# - - subtract shown information +# f - filter processes +# t - tree view +# m - memory view +# ESC - clear filter/reset +``` +**Documentation**: [btop GitHub](https://github.com/aristocratos/btop) + +### code (Visual Studio Code) +**Purpose**: IDE/code editor +**Use**: Popular, extensible code editor with debugging, Git integration, and extensive plugin ecosystem. +**Syntax**: `code [options] [file/directory]` +**Examples**: +```bash +# Open file or directory +code . +code file.txt +code /path/to/project + +# Open with specific options +code --new-window project/ +code --goto file.js:10:5 # Go to line 10, column 5 +code --diff file1.txt file2.txt + +# Extensions management +code --install-extension ms-python.python +code --list-extensions +``` +**Documentation**: [VS Code Documentation](https://code.visualstudio.com/docs) + +### cursor +**Purpose**: AI-powered code editor +**Use**: Modern code editor with built-in AI assistance for code completion, generation, and refactoring. +**Syntax**: `cursor [options] [file/directory]` +**Examples**: +```bash +# Open file or directory +cursor . +cursor file.txt +cursor /path/to/project + +# AI features (within editor): +# Ctrl+K - AI chat/commands +# Ctrl+L - AI inline suggestions +# Ctrl+I - AI code generation +# Tab - Accept AI suggestion +``` +**Documentation**: [Cursor Documentation](https://docs.cursor.com/) + +--- + +## Getting Started + +Most command-line tools are immediately available after installation. For desktop applications, you can find them in your application launcher. + +### Quick Command Examples + +- Monitor system: `btop` or `iotop` +- Search files: `fd filename` or `rg "search term"` +- Process JSON: `curl api.example.com | jq '.data'` +- Start development server in tmux: `tmux new-session -d -s dev` +- Check Docker status: `docker --version && docker ps` + +### Configuration Tips + +- Customize zsh with `~/.zshrc` +- Configure tmux with `~/.tmux.conf` +- Set up Git aliases for common operations +- Use Docker Compose for multi-container applications diff --git a/onboarding.sh b/onboarding.sh new file mode 100755 index 0000000..7c406f4 --- /dev/null +++ b/onboarding.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# Git + SSH onboarding script for developer environments. +# Prompts for missing git config, sets recommended options, and helps create and test SSH keys. +# Author: [ilia] | Created: [Aug 28, 2025] + +set -euo pipefail # Exit on error, unset vars, and in pipe failures + +## FUNCTIONS + +# Prompt for and set global git config if missing +set_git_config() { + local key="$1" + local prompt="$2" + if ! git config --get "user.${key}" &>/dev/null; then + read -rp "$prompt" value + git config --global "user.${key}" "$value" + fi +} + +# Create ed25519 SSH key if missing +setup_ssh_key() { + if [ ! -f ~/.ssh/id_ed25519 ]; then + read -rp "No ed25519 SSH key found! Create one for Git usage? (y/n): " sshyn + if [[ "$sshyn" =~ ^[Yy]$ ]]; then + ssh-keygen -t ed25519 -C "$(git config --get user.email)" + fi + fi +} + +# Show public SSH key and copy to clipboard +show_and_copy_ssh_key() { + if [ -f ~/.ssh/id_ed25519.pub ]; then + echo "Your public ed25519 SSH key:" + cat ~/.ssh/id_ed25519.pub + if command -v xclip &>/dev/null; then + xclip -sel clip < ~/.ssh/id_ed25519.pub + echo "Public key copied to clipboard." + fi + echo "Add this key to Gitea: http://10.0.30.169:3000/user/settings/keys" + else + echo "No public ed25519 SSH key found. You might need to generate it." + fi +} + +# SSH connection test +test_ssh_connection() { + read -rp "Test SSH connection to Gitea server? (y/n): " testssh + if [[ "$testssh" =~ ^[Yy]$ ]]; then + ssh -T gitvm@10.0.30.169 + fi +} + +## MAIN LOGIC + +echo "Checking Git global config..." +set_git_config "name" "Enter your Git user name: " +set_git_config "email" "Enter your Git email: " + +# Set best-practice Git global defaults +git config --global credential.helper cache +git config --global color.ui auto + +echo +echo "Current global Git configuration:" +git config --global --list + +setup_ssh_key +show_and_copy_ssh_key +test_ssh_connection + +echo +echo "Setup complete!"