MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

Linux Commands and Shell Scripting Reference for Linux Admins and DevOps Engineers

Originally published on 2016-03-03; fully revised and updated.

This guide is for Linux administrators, SREs, and DevOps engineers who need a practical path from day-to-day Linux commands to reusable shell automation. It reorganizes the original resource collection into a clearer reference with examples, comparisons, and direct links back to the source materials, including the original post.

How to use this reference effectively

If you are building Linux depth for platform or delivery engineering, use this page in a sequence instead of treating it as a random bookmark dump.

  • Start with user and admin commands to build execution confidence.
  • Move to text-processing tools (grep, sed, xargs) for log and config workflows.
  • Add shell parameters and scripting patterns for repeatable operations.
  • Practice monitoring and troubleshooting commands during real incidents.
  • Use interview sets and exercises to validate practical understanding.
flowchart TD
    A[Learn core user commands] --> B[Learn admin commands]
    B --> C[Practice text processing]
    C --> D[Write simple shell scripts]
    D --> E[Add parameters and logging]
    E --> F[Automate over SSH]
    F --> G[Monitor CPU memory IO]
    G --> H[Troubleshoot and document runbooks]

Command families and DevOps use cases

The original collection spans user-level Linux usage through incident diagnostics and scripting. This table helps you decide where each command family fits.

CategoryExamples from this collectionTypical use in operations
User commandsLinux Commands for User, common Unix utilitiesNavigation, files, permissions, process checks
Admin commandsLinux Commands for Administrator, mount/unmount, df usageHost setup, storage work, access management
Monitoringiostat, mpstat, vmstat, pmapCPU, memory, and disk bottleneck analysis
Text processinggrep, sed, xargsLog filtering, mass changes, command chaining
Remote automationssh-keygen, ssh-copy-id, gshExecuting repeatable tasks across multiple servers

Performance and troubleshooting commands compared

These commands appear frequently in Linux troubleshooting interviews and real production triage.

CommandPrimary focusExampleWhen to run it
iostatDisk I/O and device utilizationiostat -x 1 5Slow builds, high wait time, storage latency suspicion
mpstatCPU utilization by corempstat -P ALL 1 5Thread imbalance or CPU saturation checks
vmstatMemory, swap, run queue, context switchesvmstat 1 5General host pressure triage
pmapMemory map for a processpmap -x 12345Investigating process-level memory growth
xargsBatch argument passingfind /var/log -type f -name “*.log” -print0 | xargs -0 grep -H “ERROR”Applying one command over many files
# Quick triage sequence
iostat -x 1 5
mpstat -P ALL 1 5
vmstat 1 5
pmap -x 12345
find /var/log -type f -name "*.log" -print0 | xargs -0 grep -H "ERROR"Code language: PHP (php)

Shell scripting pattern for routine operations

This example demonstrates common practices from the shell-scripting resources: input parameters, validation, and log-friendly output.

#!/usr/bin/env bash
set -euo pipefail

THRESHOLD="${1:-80}"
LOG_FILE="${2:-/tmp/disk-alerts.log}"

if ! [[ "$THRESHOLD" =~ ^[0-9]+$ ]]; then
  echo "Usage: $0 threshold-percent [log-file]"
  exit 1
fi

df -P | awk 'NR!=1 {print $1,$5,$6}' | while read -r fs use mount; do
  used="$(echo "$use" | tr -d '%')"
  if [ "$used" -ge "$THRESHOLD" ]; then
    echo "$(date '+%F %T') WARN $fs at $use on $mount" | tee -a "$LOG_FILE"
  fi
doneCode language: PHP (php)

Automation example: passwordless SSH setup

The original collection includes a guide for SSH key-based login. A typical flow looks like this:

ssh-keygen -t ed25519 -C "devops@example.com"
ssh-copy-id user@server1
ssh user@server1Code language: JavaScript (javascript)

Curated links from the original collection

The links below are preserved from the original post and grouped by practical usage.

Linux commands and admin fundamentals

Monitoring, filesystem, and remote execution

Shell scripting collection, interview prep, exercises, and videos

Best practices and common pitfalls

  • Do not memorize command flags in isolation; map each command to an operational scenario.
  • Use scripts with parameter validation and predictable defaults.
  • Prefer incremental automation: prove the command manually, then script it.
  • Log script output clearly so incident timelines are easy to reconstruct.
  • Review older tutorials before production use; command options and defaults can change over time.
  • Keep a personal runbook of validated commands for your environment.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Shell script to Enable ssh password authentication in Linux

Rajesh Kumar I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have…

Read More

Linux Tutorials: expect commands examples

scmuser created the topic: expect command in unix /linux? Hello, I am doing a project which asks me to enter password 4 times in a row. I…

Read More

Linux Tutorials: Enable SSH Password authentication in linux servers

To allow SSH logins with a password on a Linux server, set PasswordAuthentication yes for the OpenSSH server (sshd), make sure no drop-in file overrides it, give…

Read More

Shell Bash Scripting: Assignment & Excercise – 16

This exercise asks for a Bash script that packs a file or directory into a compressed tar archive and then encrypts it with a passphrase. The solution…

Read More

Shell Bash Scripting: Assignment & Excercise – 15

This exercise builds a Bash script that takes an IP address, sends it to the free ip-api.com geolocation API with curl, and uses jq to print the…

Read More

Shell script to git add and commit and push each directory at a time

This page shows how to use a Bash script to stage, commit and push changes one directory at a time. That can mean a folder full of…

Read More
Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Puja kushwaha
Puja kushwaha
1 month ago

Shell scripting becomes much more useful when scripts solve real admin tasks, such as log checks, backups, and service monitoring. Beginners should learn safe handling of variables, exit codes, and command errors before automating critical work. Using clear names and adding comments makes scripts easier for others to maintain. It is also smart to test scripts on sample data before running them on production systems. These habits help prevent small mistakes from causing bigger issues.

1
0
Would love your thoughts, please comment.x
()
x