← Back to list

Deleting a nul File on Windows (The Clean Fix)

Upon trying to git status:

Roscoe Kerby [ROSCODE] · 2026-01-18 17:19 · 0 claps · 1.7 min read
#windows #linux #wsl #nul #github
Open on Medium ↗
Wiki topics: 🔓 · Open Source

Deleting a nul File on Windows (The Clean Fix)

Upon trying to git status:

I found this horrible guy “nul”

I could not delete him.

Even handle could not find him.

This one was painful.

On Windows, nul is a reserved DOS device name, which means:

  • Explorer cannot delete it
  • PowerShell cannot delete it
  • del nul fails
  • handle.exe shows no process locking it

Even though the file clearly exists.

The key insight

The problem is not a lock. It is a Windows namespace limitation.

NTFS allows a file called nul. Win32 tools refuse to touch it.

The solution that actually works

Use WSL, which does not have DOS device names.

Steps (worked instantly)

Open Command Prompt as Administrator

Start WSL:

  • wsl

Navigate to the Windows drive via /mnt:

  • cd /mnt/c/ROSCODE\ TECH/Skinvest/skinvest
  1. Delete the file normally:
  • rm nul

That is it.

Exit WSL, go back to Windows, and the file is gone.

Why this works

  • WSL talks to NTFS directly
  • Linux has no concept of nul, con, aux, etc.
  • The file was never locked, just unreachable from Win32

Prevent this in future (important)

If this came from Git, run once:

git config --global core.protectNTFS true

This stops nul, aux, con, and similar files from ever being created again on Windows.

Final takeaway

If Windows cannot delete a file named nul and no process is locking it, stop fighting Win32. Drop into WSL and remove it like a normal file.

[embed]Coding Portfolio I'm building bleeding-edge AI and machine learning technology for seamless biometric identification of cattle. IDScan…roscoekerby.com

[embed]Home - ROSCODE TECH At ROSCODE TECH, we're building powerful tools like Skinvest, Gene-ius, and Taily to solve real-world problems through…roscodetech.com


메타데이터
post_id
7e664c58bb30
slug
deleting-a-nul-file-on-windows-the-clean-fix-7e664c58bb30
url
https://medium.com/@roscoe.kerby/deleting-a-nul-file-on-windows-the-clean-fix-7e664c58bb30
canonical_url
https://medium.com/@roscoe.kerby/deleting-a-nul-file-on-windows-the-clean-fix-7e664c58bb30
author_url
https://medium.com/@roscoe.kerby
status
ok
fetched_at
2026-07-14 14:55:07