--- 
canonical: 'https://mwop.net/blog/2026-02-06-linux-null-byte-filename-removal.html'
title: 'Removing a filename containing a null byte or binary character on Linux'
author: "[Matthew Weier O'Phinney](https://mwop.net)"
created: '2026-02-06T11:01:27-06:00'
updated: '2026-02-06T11:01:27-06:00'
tags:
  - linux
  - til

---
Somehow, I got a file in my tree that started with a null byte. I only discovered it because `git status` was noting it wasn't added to my branch, and wanted to know if I wanted to add it.

No, no, I did not. I wanted to delete it.

But, of course, you cannot reference such a file by name, so I had to learn a few tricks.





First off, you can list names with binary bytes using:

```bash
/bin/ls -lb
```

But even better, you can get the inode if you use:

```bash
/bin/ls -li
```

When you do, the inode is in the first column of the list for each file.

Once you know that, you can delete the file, using find:

```bash
find . -maxdepth 1 -inum <inode_id> -exec rm -i -- {} +
```