Skip to content

case

How to List Files with Case-Insensitive Glob Patterns in zsh/bash: A Guide for Varying String Cases

Introduction

In the world of command-line interfaces, efficiently managing and navigating files is a fundamental skill. One powerful tool at your disposal is glob patterns (or "globs"), which allow you to match filenames using wildcard characters like *, ?, and []. However, a common frustration arises when dealing with files that have inconsistent capitalization—think Report.pdf, report.PDF, and REPORT.pdf in the same directory. By default, most shells (including bash and zsh) treat glob patterns as case-sensitive, meaning a pattern like *.pdf would only match filenames with exactly lowercase .pdf extensions, missing variations like .PDF or .Pdf.

This guide will demystify case-insensitive globbing in bash and zsh, walking you through how to match files regardless of letter case, advanced techniques, troubleshooting, and best practices. Whether you’re a system administrator, developer, or casual terminal user, mastering case-insensitive globs will save you time and reduce errors when working with mixed-case filenames.

Why Does Blocking recv() Return Less Than Requested Bytes? Common Scenarios (Server Crashes, Protocol Design) Explained

Introduction

When working with network programming in C/C++, the recv() system call is a staple for reading data from a socket. For developers new to socket programming, a common misconception is that blocking recv() will always wait until it receives the exact number of bytes requested. In reality, recv() often returns fewer bytes than specified—even in blocking mode. This behavior can lead to bugs, data corruption, or unexpected application crashes if not handled properly.

In this blog, we’ll demystify why blocking recv() returns partial data, explore common scenarios (including server crashes and protocol design flaws), and discuss best practices to handle partial reads. By the end, you’ll understand how to write robust network code that accounts for this behavior.