Results for “File operations & paths”
Small, practical examples. Search by task or narrow things down below.
Rename a file with mv
Linux Commands: Rename a known file in the current directory and inspect its new contents.
Linux Commands✓ Tested
Rename a known file
C: The standard rename function reports failure through its return value.
C✓ Tested
Rename a practice file
Linux Commands: Rename a practice file using GNU/Linux commands in an empty practice directory.
Linux Commands✓ Tested
Replace a text file with an atomic rename
Prepare new content beside the target before renaming it into place.
atomic write✓ Tested
Replace bytes at a known position in a binary file
C: Open in update mode and seek before writing a fixed-size replacement.
C✓ Tested
Resolve a merge by writing the intended final file
Git: After a conflict, edit the result, stage it, and finish the merge commit.
Git✓ Tested
Restore a file’s content from an older commit
Git: Specify a source revision when the desired contents are not in the current index.
Git✓ Tested
Retrieve a file from a stopped container
Docker / Compose: The writable layer remains available for docker cp after exit.
Docker / Compose✓ Tested
Run a command safely for each matching file
Linux Commands: Use find -exec with argument placeholders so spaces in filenames remain intact.
Linux Commands✓ Tested
Run with a read-only container filesystem
Docker / Compose: Run with a read-only container filesystem using a locally available Ubuntu image.
Docker / Compose✓ Tested
Run with a read-only root filesystem
Add a temporary writable location while protecting the image filesystem.
read-only✓ Tested
Search for text in a file
Find matching lines with their line numbers, ignoring letter case and treating the pattern as literal text.
grep✓ Tested