Prepare the daily shell environment, establish standardized project folders, configure custom terminal aliases, and write automated workstation bootstrap scripts.
Environment
Ubuntu / CLI Terminal
Difficulty
Beginner
Course Module
Chapters 1–2: Linux
Deliverables
Bootstrap Script & Key Pairs
1. System Architecture & Workflow
The diagram below maps the structure of directories created inside the user home folder, along with the login configuration timeline of the bash environment lifecycle.
2. Part 1: Step-by-Step Action Items & Key Execution Steps
STEP 1
Standardize the Directory Hierarchy
Organize your home folder with separated, structured workspaces dedicated to coding projects, server automation scripts, download caches, backup archives, and application logs.
This command creates a set of project folders, using the -p flag to build missing directories and resolve issues.
$ ls -lh ~/
This command displays directory attributes, permissions, file size metrics, ownership states, and last modification timelines for all objects in the home location.
STEP 2
Install Essential Utilities & Monitoring Packages
Prepare standard package systems with primary command-line monitoring interfaces, file management suites, and network statistics utilities.
$ sudo apt update && sudo apt install -y curl wget git unzip zip net-tools tree htop
This command fetches packages indexing info, then installs network requestors (curl, wget), git VCS, compression engines (unzip, zip), network sockets viewer (net-tools), directory view (tree), and interactive process table (htop).
STEP 3
Configure Bash Profiles and Custom Environment Aliases
Define permanent command-line shortcuts and performance alias definitions inside the bash profile config file.
$ echo "alias ll='ls -laF'" >> ~/.bashrc
This command appends a persistent command alias definition to the user's .bashrc profile, mapping "ll" to present long-format directory inventories with classifications.
This command adds a customized multi-command shell alias to inspect disk allocations, physical memory values, and launch the real-time process monitoring interface.
This command constructs an automated compression backup alias that captures directories under ~/Projects, compresses them, and writes a dated tarball archive inside ~/Backups.
$ source ~/.bashrc
This command reloads your .bashrc profile, activating new configurations without needing to restart your terminal.
STEP 4
Generate Secure Cryptographic Key Pairs for Remote SSH
Construct secure public/private keys used to authenticate with remote Git codebases, virtual machine hosts, and CI deployment nodes without plain-text password prompts.
This command generates a secure ED25519 key pair with a comment, disables the passphrase prompt for automation, and writes the keys to the .ssh directory.
$ cat ~/.ssh/id_ed25519.pub
This command outputs the public key contents, allowing the student to copy the public key and paste it into GitHub or other authorized hosts.
3. Automation Architecture
The flowchart below outlines the bootstrap shell script logic. The script automates folder generation, validates software packages, modifies files, reloads variables, and validates environment outputs.
4. Part 2: Complete Deliverable Assets & Production Templates
To automate the configuration of a fresh user workstation, we will write a bootstrap initialization script. Below is a step-by-step breakdown of how this script is assembled, followed by the complete unified script template.
Step-by-Step Script Construction
Step 1
Declare Safety Flags & Log Paths
Setup standard shell flags to prevent error leakage and specify where logs will be captured.
#!/usr/bin/env bash
set -euo pipefail
LOG_FILE="${HOME}/Logs/bootstrap_setup.log"
This boots the bash shell interpreter, enables strict error checking, and defines the destination file path variable to redirect installation output streams.
Step 2
Loop to Create Work Directories
Create all standard project, script, and backup directories in the user home folder.
for dir in Projects Scripts Downloads Backups Logs; do
if [ ! -d "${HOME}/${dir}" ]; then
mkdir -p "${HOME}/${dir}"
echo "Created directory: ${HOME}/${dir}" | tee -a "${LOG_FILE}"
fi
done
This checks the presence of each folder in the list and creates it if it is missing, writing confirmation messages to both the terminal and the log file.
Step 3
Automate Package Installations
Check and install necessary tools using apt-get package manager.
REQUIRED_PACKAGES=(curl wget git unzip zip net-tools tree htop)
sudo apt-get update -qq
for pkg in "${REQUIRED_PACKAGES[@]}"; do
if ! dpkg -s "${pkg}" &>/dev/null; then
sudo apt-get install -y -qq "${pkg}" >> "${LOG_FILE}" 2>&1
fi
done
This updates local apt listings, checks if each required tool is already installed using dpkg -s, and installs missing packages silently, appending all outputs to the log file.
Step 4
Inject Custom Shell Aliases
Check `.bashrc` and inject command aliases for administrative efficiency.
BASHRC_CONFIG="${HOME}/.bashrc"
ALIASES=(
"alias ll='ls -laF'"
"alias checksys='df -h && free -m && htop'"
"alias project_backup='tar -czf ~/Backups/projects_\$(date +%F).tar.gz -C ~/ Projects'"
)
for val in "${ALIASES[@]}"; do
if ! grep -Fq "${val}" "${BASHRC_CONFIG}"; then
echo "${val}" >> "${BASHRC_CONFIG}"
fi
done
This iterates over custom aliases, searches `.bashrc` for duplicates, and appends missing entries to the file.
Step 5
Generate SSH Key Pair
Create secure cryptographic credentials for remote GitHub authentication.
if [ ! -f "${HOME}/.ssh/id_ed25519" ]; then
ssh-keygen -t ed25519 -C "student@devops-node" -N "" -f "${HOME}/.ssh/id_ed25519" >> "${LOG_FILE}" 2>&1
fi
This verifies if an ED25519 private key is already present in the `.ssh` folder, and generates a new key pair with no passphrase if the key is missing.
Combined Automated Script
Save the consolidated blocks above as ~/Scripts/bootstrap_linux.sh, make it executable with chmod +x bootstrap_linux.sh, and run it:
#!/usr/bin/env bash# bootstrap_linux.sh - Automation System Setup Scriptset -euo pipefail
LOG_FILE="${HOME}/Logs/bootstrap_setup.log"echo"=== DevOps Environment Bootstrap Initiated ===" | tee -a "${LOG_FILE}"# 1. Directory Structure Creationfor dir in Projects Scripts Downloads Backups Logs; doif [ ! -d "${HOME}/${dir}" ]; then
mkdir -p "${HOME}/${dir}"echo"Created directory: ${HOME}/${dir}" | tee -a "${LOG_FILE}"elseecho"Directory already exists: ${HOME}/${dir}" | tee -a "${LOG_FILE}"fidone# 2. Package Installation
REQUIRED_PACKAGES=(curl wget git unzip zip net-tools tree htop)
echo"Updating apt caches..." | tee -a "${LOG_FILE}"
sudo apt-get update -qq
for pkg in"${REQUIRED_PACKAGES[@]}"; doif dpkg -s "${pkg}" &>/dev/null; thenecho"Package already installed: ${pkg}" | tee -a "${LOG_FILE}"elseecho"Installing Package: ${pkg}..." | tee -a "${LOG_FILE}"
sudo apt-get install -y -qq "${pkg}" >> "${LOG_FILE}" 2>&1
fidone# 3. Inject Alias Configurations
BASHRC_CONFIG="${HOME}/.bashrc"
ALIASES=(
"alias ll='ls -laF'""alias checksys='df -h && free -m && htop'""alias project_backup='tar -czf ~/Backups/projects_\$(date +%F).tar.gz -C ~/ Projects'"
)
echo"Injecting configuration aliases..." | tee -a "${LOG_FILE}"for val in"${ALIASES[@]}"; doif ! grep -Fq "${val}""${BASHRC_CONFIG}"; thenecho"${val}" >> "${BASHRC_CONFIG}"echo"Added alias: ${val}" | tee -a "${LOG_FILE}"fidone# 4. Generate SSH Key pairs if not existsif [ ! -f "${HOME}/.ssh/id_ed25519" ]; thenecho"Generating cryptographic ED25519 identity key..." | tee -a "${LOG_FILE}"
ssh-keygen -t ed25519 -C "student@devops-node" -N "" -f "${HOME}/.ssh/id_ed25519" >> "${LOG_FILE}" 2>&1
elseecho"SSH identity keys already present." | tee -a "${LOG_FILE}"fiecho"=== DevOps Environment Bootstrap Completed ===" | tee -a "${LOG_FILE}"
5. Deliverables Summary
Verify that the following configurations and outputs exist inside your Linux workstation.