هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
$ مستخدم عادي# بصلاحية root (أو مع sudo)
المهارات في هذا الفصل
- أتمتة الطرفية — 8
bash — the glue of every pipeline
bash scripts join the other tools: if, loops, functions, exit codes.
- Used for: CI steps, entrypoints of containers, small ops scripts.
cat deploy.sh
#!/usr/bin/env bash
set -euo pipefail
kubectl apply -k "deploy/overlays/${ENV:?ENV is not set}"
kubectl rollout status deploy/shop --timeout=120s
bash -n deploy.sh && shellcheck deploy.shGood practice:
- Start every script with
set -euo pipefail. - Quote variables (
"$file"); check scripts withshellcheck.
curl — talk to every API
curl sends HTTP requests: health checks, REST APIs, webhooks, downloads.
- Used for: smoke tests after a deploy, API calls in scripts, debugging.
curl -fsS https://staging.example.com/health
curl -s -o /dev/null -w '%{http_code} %{time_total}\n' https://staging.example.com/
curl -fsS -H "Authorization: Bearer $TOKEN" https://api.example.com/v1/items
curl -fsSL https://get.example.com/install.sh -o install.shGood practice:
-fmakes curl fail on HTTP errors — needed in scripts.- Read install scripts before you run them; never
curl | sudo bashblindly.
jq — read and change JSON
jq takes one value out of JSON — from APIs, kubectl -o json or cloud CLIs.
yq — read and change YAML
yq is jq for YAML: set an image tag, read a Helm value, merge files.
xargs — run a command for many items
xargs turns lines into arguments, in batches or in parallel.
envsubst — tiny templates
envsubst fills $VARIABLES in a file with environment values.
watch — a live view
watch runs a command every few seconds and shows what changed.
tmux — sessions that survive
tmux keeps a terminal session alive on the server when SSH drops, and splits the screen.