- Posted on
- • Artificial Intelligence
30-Day Artificial Intelligence Linux Learning Plan
- Author
-
-
- User
- linuxbash
- Posts by this author
- Posts by this author
-
30-Day Artificial Intelligence Linux Learning Plan (Bash-First)
If you’ve tried to learn AI but felt stuck juggling notebooks, environments, and “it works on my machine” issues, this plan is for you. Linux and Bash are the glue that make AI projects reproducible, automatable, and fast to iterate. In 30 days, you’ll go from command-line basics to training classical ML models, running a transformer on CPU, and packaging your work like a pro.
Why this matters:
Linux is the backbone of AI in the cloud and on-prem servers.
Bash turns routine steps (data pulls, preprocessing, training, evaluation) into one-click scripts.
Command-line skills save time, reduce friction, and make your results reproducible.
Below is a practical, step-by-step plan with real commands and minimal theory—just enough to keep you moving.
Quick Setup: Zero-to-ML CLI
Install core tools (Git, Python, build tools, data-wrangling utilities, editor, terminal multiplexer, and Podman for optional containerization).
Debian/Ubuntu (apt):
sudo apt update
sudo apt install -y \
git curl wget build-essential \
python3 python3-pip python3-venv \
jq ripgrep tmux neovim podman
Fedora/RHEL/CentOS (dnf):
sudo dnf -y groupinstall "Development Tools"
sudo dnf install -y \
git curl wget \
python3 python3-pip \
jq ripgrep tmux neovim podman
openSUSE (zypper):
sudo zypper refresh
sudo zypper install -y \
git curl wget gcc make \
python3 python3-pip \
jq ripgrep tmux neovim podman
Create your workspace and Python environment:
mkdir -p ~/ai30/{data,notebooks,scripts,models}
python3 -m venv ~/.venvs/ai30
source ~/.venvs/ai30/bin/activate
python -m pip install --upgrade pip
# Core Python data/ML stack
pip install numpy pandas scikit-learn jupyterlab matplotlib seaborn joblib ipykernel
# Make a Jupyter kernel for this environment
python -m ipykernel install --user --name ai30 --display-name "Python (ai30)"
Run Jupyter Lab (local machine):
jupyter lab
Run Jupyter Lab on a server and keep it alive in tmux:
tmux new -s ai30
source ~/.venvs/ai30/bin/activate
jupyter lab --no-browser --ip 0.0.0.0 --port 8888
# Press Ctrl+b then d to detach
The 30-Day Plan (Week-by-Week)
Think of each week as a theme with daily bite-sized goals. Spend 45–90 minutes/day.
Week 1: Bash and Linux Fundamentals (Days 1–7)
Filesystem mastery: cd, ls, find, tar, permissions, SSH keys.
Pipes and filters: cat, head, tail, sort, uniq, wc, tee.
Text wrangling: grep/ripgrep, sed, awk.
JSON handling with jq.
Keep jobs alive with tmux.
Mini-labs:
- Extract error lines from logs:
rg -n "error|fail|exception" logs/*.log | tee errors.txt- Summarize CSV numbers (3rd column) with awk:
awk -F, 'NR>1 {sum+=$3} END {print "Total,",sum}' data/metrics.csv- Parse JSON to CSV with jq:
jq -r '.items[] | [.id, .name, .stargazers_count] | @csv' repos.json > repos.csv
Week 2: Python, Jupyter, and Data Handling (Days 8–14)
Virtual environments, pip hygiene, requirements.txt.
Pandas for CSV/JSON/Parquet; plotting with matplotlib/seaborn.
Jupyter Lab workflows and notebooks-to-scripts mindset.
CSV CLI tooling:
# Install csvkit in your venv pip install csvkit # Preview and query CSV csvcut -n data/people.csv csvgrep -c country -m "DE" data/people.csv | csvstat
Week 3: Classical ML with scikit-learn (Days 15–21)
Train/test splits, pipelines, cross-validation.
Feature scaling; models (LogisticRegression, RandomForest).
Metrics; saving models; reproducible scripts and Makefile or simple Bash.
Turn notebooks into CLI scripts with argparse.
Example training script (Iris dataset) below.
Week 4: Intro to Deep Learning + Packaging (Days 22–30)
PyTorch CPU install and quick tensor exercises.
Run a small transformer for inference.
Wrap your project as a CLI; optional: containerize with Podman.
Automate: cron/systemd timers; logging outputs; archive models.
4 Actionable Builds (With Real Commands)
1) Your AI workspace and reproducible Python environment
mkdir -p ~/ai30/{data,notebooks,scripts,models}
python3 -m venv ~/.venvs/ai30
source ~/.venvs/ai30/bin/activate
pip install --upgrade pip numpy pandas scikit-learn jupyterlab matplotlib seaborn joblib ipykernel
python -m ipykernel install --user --name ai30 --display-name "Python (ai30)"
2) Essential Bash data-wrangling patterns you’ll use forever
Decompress, preview, and sample:
tar -xvf data.tar.gz -C data/ head -n 5 data/huge.csv | column -s, -t shuf -n 1000 data/huge.csv > data/sample.csvFast search with ripgrep:
rg -n "TODO|FIXME" -S --hidden --glob '!venv/*' .
3) Ship a scikit-learn model as a CLI
Create scripts/train_iris.py:
#!/usr/bin/env python3
import argparse, joblib
from pathlib import Path
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
def main():
p = argparse.ArgumentParser()
p.add_argument("--C", type=float, default=1.0)
p.add_argument("--models-dir", type=Path, default=Path("models"))
args = p.parse_args()
X, y = load_iris(return_X_y=True, as_frame=True)
Xtr, Xte, ytr, yte = train_test_split(X, y, test_size=0.2, random_state=42, stratify=y)
pipe = Pipeline([
("scale", StandardScaler()),
("clf", LogisticRegression(max_iter=1000, C=args.C))
])
pipe.fit(Xtr, ytr)
pred = pipe.predict(Xte)
acc = accuracy_score(yte, pred)
print(f"accuracy={acc:.4f}")
args.models_dir.mkdir(parents=True, exist_ok=True)
out = args.models_dir / f"iris_lr_C{args.C}.joblib"
joblib.dump(pipe, out)
print(f"saved: {out}")
if __name__ == "__main__":
main()
Create scripts/predict_iris.py:
#!/usr/bin/env python3
import argparse, joblib, sys
import numpy as np
p = argparse.ArgumentParser()
p.add_argument("--model", required=True)
p.add_argument("--features", nargs="+", type=float, required=True,
help="Four numbers: sepal_length sepal_width petal_length petal_width")
args = p.parse_args()
clf = joblib.load(args.model)
x = np.array(args.features, dtype=float).reshape(1, -1)
print(clf.predict(x)[0])
Run:
source ~/.venvs/ai30/bin/activate
python scripts/train_iris.py --C 0.5
python scripts/predict_iris.py --model models/iris_lr_C0.5.joblib --features 5.1 3.5 1.4 0.2
4) Run a transformer (CPU) in two commands
Install CPU-only PyTorch and Transformers in your venv:
source ~/.venvs/ai30/bin/activate
pip install --index-url https://download.pytorch.org/whl/cpu torch torchvision torchaudio
pip install transformers sentencepiece
Quick test:
python - << 'PY'
from transformers import pipeline
nlp = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")
print(nlp("I love learning AI on Linux!"))
PY
Optional: Package as a tiny CLI
cat > scripts/sentiment.py << 'PY'
#!/usr/bin/env python3
import sys
from transformers import pipeline
clf = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")
print(clf(" ".join(sys.argv[1:]))[0])
PY
chmod +x scripts/sentiment.py
./scripts/sentiment.py "The command line makes me productive."
Optional: Containerize with Podman
Podman install (if you skipped earlier):
- apt:
sudo apt update && sudo apt install -y podman
- dnf:
sudo dnf install -y podman
- zypper:
sudo zypper install -y podman
Minimal Containerfile (root of your project):
# Containerfile
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "scripts/train_iris.py"]
Build and run:
# Generate requirements from your venv
pip freeze | grep -E 'numpy|pandas|scikit-learn|joblib' > requirements.txt
podman build -t ai30 .
podman run --rm -v $(pwd)/models:/app/models ai30
A Simple Day-by-Day Checklist
Days 1–3: Files, permissions, SSH keys; pipes/redirects; tmux basics
Days 4–5: ripgrep, sed, awk; jq for JSON
Day 6: Create venv; install Python stack; Jupyter kernel
Day 7: Git basics; commit your workspace
Days 8–9: Pandas read/clean/join; CSV CLI (csvkit)
Day 10: Visualize with matplotlib/seaborn
Day 11: Turn notebook to script; argparse
Day 12: Write your first train script; save model
Day 13: Evaluation metrics; logging outputs to files
Day 14: Make a tiny Bash runner (train + evaluate)
Days 15–17: Pipelines, CV, parameter sweep (C, n_estimators)
Day 18: Organized project layout; requirements.txt
Day 19: Predict script + sample inputs
Day 20: Document usage (README, comments)
Day 21: Automate with tmux and simple cron
Days 22–23: Install PyTorch CPU; tensor fundamentals
Day 24: Run a transformer pipeline; cache models
Day 25: Wrap transformer as a CLI
Day 26: Optional containerization with Podman
Day 27: Reproducible runs; timestamps and artifacts
Day 28: Clean code pass; consistent logs and exits
Day 29: End-to-end demo: download → train → evaluate → predict
Day 30: Publish your repo, write a short project report
Troubleshooting Tips
venv not found:
- On Debian/Ubuntu, ensure
python3-venvis installed (see apt command above).
- On Debian/Ubuntu, ensure
Jupyter not visible from remote:
- Use
--ip 0.0.0.0 --port 8888, open firewall/security group, tunnel with SSH if needed.
- Use
Slow installs on limited machines:
- Prefer CPU builds; use smaller models; cache wheels and models.
Conclusion and Next Step (CTA)
With this 30-day Linux-first path, you’ve built habits that scale: clean environments, Bash pipelines, reproducible training, and practical packaging. Your next step:
Turn today’s scripts into a shareable repo with a one-command Makefile or Bash runner.
Add one small feature each week (new dataset, better metrics, CLI flags).
Keep a lab notebook with commands you ran and results you observed.
Commit to 30 minutes a day this month. By Day 30, you won’t just “know AI”—you’ll ship AI, the Linux way.