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

Unix Basics for DevOps Engineers: Commands, Permissions, Pipes, and Workflow

Originally published on 2009-03-07; fully revised and updated.

Unix fundamentals are still central to modern DevOps work, from troubleshooting CI runners to managing containers and servers. This guide gives you a clear, practical starting point: what Unix is, how commands run, and which commands you will use daily.

unix-presentation

Original presentation and attribution

The original post was primarily an embedded SlideShare presentation. It is preserved below for attribution and historical reference.

Basic Unix from Rajesh Kumar. View more presentations on SlideShare.

Unix fundamentals every DevOps engineer should know

In practice, most engineers work on Unix-like systems (commonly Linux and BSD-derived environments). The command model and tooling patterns below are broadly transferable across shells and distributions.

  • Everything is file-oriented: devices, logs, configs, and process interfaces are often exposed through filesystem-like paths.
  • Small tools compose well: combine commands with pipes to solve bigger tasks quickly.
  • Permissions matter: ownership and mode bits control what users and services can read, write, or execute.
  • Processes are first-class: service operation, debugging, and incident response all rely on process inspection.
  • Text is the universal interface: logs and config files are frequently plain text and easy to automate.

How a Unix command is executed

Understanding this path helps with debugging command failures, permission errors, and path issues in CI/CD jobs.

flowchart TD
    A[User types command in shell] --> B[Shell parses command and expands variables]
    B --> C{Built in command}
    C -- yes --> D[Shell executes built in]
    C -- no --> E[Shell locates executable in PATH]
    E --> F[Kernel starts process]
    F --> G[Program reads input and files]
    G --> H[Program writes stdout or stderr]
    D --> I[Shell returns exit code]
    H --> I

The shell captures an exit code after each command. A zero value usually means success; non-zero values indicate an error condition.

Essential Unix commands at a glance

CommandBest forExample
pwd, cd, lsNavigation and directory inspectionls -lah /var/log
cat, less, head, tailReading files and logstail -n 100 app.log
grep, sort, uniq, wcText filtering and aggregationgrep "ERROR" app.log | wc -l
find, xargsFile discovery and bulk operationsfind . -name "*.yaml"
chmod, chownPermissions and ownershipchmod 640 secrets.txt
ps, kill, topProcess visibility and controlps aux | grep nginx

Practical Unix command examples

Use these examples as a starter lab in a non-production directory.

Navigate files and inspect directories

mkdir -p ~/unix-lab/logs
cd ~/unix-lab
pwd
touch notes.txt
echo "hello unix" > notes.txt
ls -lah
cat notes.txtCode language: PHP (php)

Read, search, and transform text

grep -R "ERROR" /var/log 2>/dev/null | head
find . -type f -name "*.log" -mtime -1
sort app.log | uniq -c | sort -nr | headCode language: JavaScript (javascript)

Permissions and processes

chmod 640 notes.txt
chown $USER:$USER notes.txt
ps aux | grep ssh
kill -TERM 12345Code language: PHP (php)

Redirection and pipeline operators

OperatorMeaningExample
>Write stdout to a file (overwrite)command > out.txt
>>Append stdout to a filecommand >> out.txt
2>Write stderr to a filecommand 2> err.txt
2>&1Send stderr to same target as stdoutcommand > all.log 2>&1
|Pipe stdout of one command to next command inputcat app.log | grep ERROR

Best practices and common pitfalls

  • Use pwd and ls often to avoid running commands in the wrong directory.
  • Quote paths with spaces: "my file.txt".
  • Be careful with recursive operations like rm -rf and broad find patterns.
  • Check permissions before assuming a command is broken.
  • Read command help with man pages or --help flags.
  • In production, prefer non-destructive dry runs when available.

If you are new to Unix, focus first on navigation, text processing, and permissions. Those three areas solve a large share of daily DevOps troubleshooting tasks.

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

Unix Epoch Timestamp Guide for DevOps: Conversions, Commands, and Pitfalls

Unix epoch timestamps are simple in concept but easy to misuse in production. This updated guide shows reliable conversions across shell, Python, JavaScript, and SQL, with timezone and Y2038 guardrails.

Read More

Common UNIX Commands and Utilities: Practical Reference for DevOps and Sysadmin Work

A structured UNIX command reference organized by real operational tasks: discovery, files, processes, networking, text processing, and job control. Includes C-shell notes, comparison tables, and practical command examples.

Read More

UNIX sed Quick Reference: Print and Delete Lines with Address and Pattern Ranges

Use this sed quick reference to print or delete exact lines, ranges, and regex matches without opening an editor. It also highlights GNU vs POSIX differences and safer in-place editing patterns.

Read More

Unix grep Quick Reference: Patterns, Options, and Real Command Examples

grep is the core Unix command for searching text by pattern across files or standard input. This revised quick reference covers syntax, high-value options, and practical examples you can use immediately.

Read More

Shell Scripting Interview Questions, Explained: Bash Fundamentals, UNIX Processes, and Practical Commands

A modernized, interview-focused guide to shell scripting and core UNIX concepts for DevOps engineers. Learn command execution flow, redirection, permissions, process control, IPC, and safe scripting patterns with practical examples.

Read More

How to Run Shell Scripts from Apache Ant (and Set Unix File Permissions Safely)

Learn practical patterns for combining Apache Ant with shell scripts in Unix-like build environments. This guide covers file permissions, script execution, and safer file-processing examples for legacy CI pipelines.

Read More
Subscribe
Notify of
guest
2 Comments
Newest
Oldest Most Voted
Puja kushwaha
Puja kushwaha
27 days ago

Learning Unix basics becomes easier when commands are linked to everyday tasks, such as finding files or checking running processes. Beginners should practise commands like pwd, ls, cd, and grep in a safe test folder. Understanding file permissions and the difference between absolute and relative paths is also important. Short hands-on exercises help turn command names into useful skills. This practical approach builds confidence before working on important systems.

Jason Mitchell
Jason Mitchell
4 months ago

One area that becomes important after learning Unix basics is understanding how small system-level decisions affect reliability over time. For example, unmanaged scripts, incorrect permissions, and inconsistent environment settings can create hidden issues that appear only during deployments or incidents. Building good operational habits around documentation, repeatable configurations, and safe change practices helps teams avoid problems that are difficult to diagnose later. Unix skills become much more valuable when they are applied with an engineering mindset focused on stability, automation, and maintainability.

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