Skip to content

file-handling

Git File and Commit Operations: Managing Changes Between States

Introduction

Ever stared at your repo, wondering why a “small” change just won’t commit or push?

GUI tools like GitHub Desktop or VSCode extensions are convenient—but they hide the magic. When things go sideways, or when you need to carefully craft commits, stage parts of files, or undo a “tiny mistake” that isn’t obvious, the GUI often leaves you helpless.

Full CLI Git is where you gain real control. It’s the difference between:

  • Clicking buttons blindly and hoping everything works
  • Understanding exactly where each change lives (Working Directory, Index, HEAD, Remote) and moving it precisely

Even minor mistakes—like accidentally staging a debug log or overwriting a feature—can snowball into hours of frustration. By mastering the CLI, you can fix problems before they become disasters, cherry-pick changes, or sculpt your commit history like a pro.

Think of this guide as your toolkit: practical commands, clear flows between Git states, and actionable tips to tame your repo—even when the “small” fixes aren’t so small after all.

Mastering Essential Linux Commands: Your Path to File and Directory Mastery

Introduction

This documentation aims to offer a comprehensive understanding of essential commands and techniques for file and directory management in a Linux environment. Mastering these commands is crucial for efficient navigation, manipulation, and analysis of files and directories.

We'll embark on a journey by delving into the foundational usage of key commands like wc, du, grep, awk, and find, uncovering their individual functionalities. Additionally, we'll explore how these commands can be combined using powerful methods such as pipes (|), -exec {} \;, or -exec {} +, unlocking their synergistic potential.

Moreover, to solidify your understanding, real-life examples showcasing practical applications will be demonstrated.

Pathlib Tutorial: Transitioning to Simplified File and Directory Handling in Python

Introduction

Are you still using import os for file handling after 2020 ? Use pathlib instead !

If you're moving away from command line operations or 'os' module to Python's pathlib, you're at the right place.

Well, in this tutorial, we'll dive into the powerful pathlib module in Python. It offers a clean transition for users accustomed to CLI or 'os' for file and directory handling, providing an elegant and intuitive approach.

Removing Directories in Python

Remove Empty Directories in Python

To remove an empty directory, you can use os.rmdir() with os and Path.rmdir() with pathlib.

import os

directory_path = '/path/to/empty_directory'

try:
    os.rmdir(directory_path)
    print(f"The directory '{directory_path}' has been successfully removed.")
except OSError as e:
    print(f"Error: {directory_path} : {e.strerror}")
from pathlib import Path

directory_path = Path('/path/to/empty_directory')

try:
    directory_path.rmdir()
    print(f"The directory '{directory_path}' has been successfully removed.")
except OSError as e:
    print(f"Error: {directory_path} : {e.strerror}")

Flask based File Hosting (web app & api & python module & cli app)

This guide will walk you through creating a basic file hosting web application using Flask, a lightweight web framework for Python. The application will include features such as user login, file uploads, and file listing. We'll also explore adding a simple API for interacting with the application.

Prerequistes

  • python >=3.9

Setup Environment

  1. Create a requirements.txt file:
python-slugify
python-dotenv
Flask~=2.0.1

pandoc: convert most files without online services

Introduction

Pandoc is a versatile document conversion tool that can convert Markdown documents to PDF, HTML, Word DOCX, and many other formats. Pandoc provides a wide range of options to customize the output of the converted document. Here is a list of some of the most commonly used options:

  • -s: Create a standalone document with a header and footer.
  • -o: Specify the output file name.
  • --from: Specify the input format explicitly.
  • --to: Specify the output format explicitly.