DEV Community

Chetan Tekam
Chetan Tekam

Posted on

Linux - File & Directory Operation v1.1

Epic: Linux Foundations for DevOps
Work Card: File & Directory Operations v1.1
Status: Completed up to v1.1
Previous Iteration: v1.0
GitHub: linux/file-directory-operations/
Demos: Linux for DevOps — Execution Demos


Introduction

In real DevOps workflows, file and directory manipulations go beyond simple one-off actions. Day-to-day tasks often require operating on groups of files, reorganizing folders, cleaning up artifacts, and handling large directory structures — all done cautiously on servers that matter.

This iteration (v1.1) of “File & Directory Operations” focuses on safe and efficient bulk file handling on remote Linux servers. The goal is not just to perform operations quickly, but to do them with verification and control — exactly the way it’s done on production systems.


Why This Matters for DevOps

In DevOps work, bulk file operations show up in scenarios like:

  • Cleaning up old build artifacts after CI jobs
  • Moving or renaming application directories
  • Removing failed deployments safely
  • Preparing or cleaning environments before new releases

Being able to handle these operations with confidence and minimal risk is a fundamental DevOps skill.


What This Iteration Covers

This iteration is about learning how to perform the following on a remote Linux host via SSH:

  • Using wildcards (*, ?) responsibly for multiple files
  • Performing safe deletions with confirmation
  • Removing directories with contents (rm -r)
  • Copying full directory structures (cp -r)
  • Verifying files before acting on them
  • Cleaning up large, broken, or unused folders

This is lean, focused, and directly operational.


Practical Usage (Remote Linux Host via SSH)

How this is practiced today:

Use wildcards to manage multiple files
Perform dry-run checks before deleting files
Safely remove directories with contents
Verify file details before moving or deleting
Handle large numbers of files without mistakes
Clean up broken or unused application files
Enter fullscreen mode Exit fullscreen mode

Demo

🎥 YouTube — File & Directory Operations v1.1 (Remote Linux via SSH)

This demo shows:

  • Bulk file selection using wildcards
  • Safe deletion using rm -i confirmation
  • Recursive directory removal
  • Copying directory trees
  • Verifying files before actions

This is a learning artifact, not a tutorial.


Key Concepts Learned

Working with Multiple Files (Wildcards)

Wildcards allow you to make changes across many files at once. They are powerful but risky:

  • Always verify with ls before executing
  • Use patterns that match only what you intend

Safe Deletion Practices

Using rm -i prompts for confirmation before deleting each file — a critical safeguard on live systems.

Recursive Directory Operations

Commands like rm -r and cp -r enable you to:

  • Remove a non-empty folder
  • Duplicate full directory structures but with verification and safety checks.

Pre-action Verification

Before performing destructive actions, I consistently used:

  • ls -lh to check file details
  • stat to inspect metadata
  • file to confirm file type

This reduces mistakes and builds confidence.


Outcomes

At the end of this iteration, I am able to:

  • Perform bulk file manipulations with control
  • Delete and clean up directories safely
  • Copy directory trees reliably
  • Avoid accidental systems errors
  • Operate efficiently on real remote Linux hosts

This marks the transition from basic file operator (v1.0) to a safe and efficient bulk operator (v1.1).


Reflections

In v1.0, I learned how to change files.
In v1.1, I learned how to do it safely and efficiently at scale.

This is a core DevOps capability: not just doing, but doing with discipline.


Next Iteration

v2.0 — Environment-aware File Operations (Cloud & Containers)
(Held until Cloud backlog begins — e.g., Docker / Kubernetes contexts.)


Canonical Reference

  • Worklog & iteration history: GitHub
  • Trello Workcard progress
  • Demo playlists on YouTube

Top comments (0)