https://github.com/mendel5/find-characters
How to find files with "forbidden" characters in their names on a Linux system. Forbidden characters could be non-printable or non-ASCII characters.
https://github.com/mendel5/find-characters
allowlist character characters find forbidden letter search
Last synced: 6 months ago
JSON representation
How to find files with "forbidden" characters in their names on a Linux system. Forbidden characters could be non-printable or non-ASCII characters.
- Host: GitHub
- URL: https://github.com/mendel5/find-characters
- Owner: mendel5
- License: agpl-3.0
- Created: 2024-11-28T13:23:34.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-28T19:40:25.000Z (over 1 year ago)
- Last Synced: 2025-02-01T00:45:40.600Z (over 1 year ago)
- Topics: allowlist, character, characters, find, forbidden, letter, search
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# find-characters
How to find files with "forbidden" characters in their names on a Linux system. Forbidden characters could be non-printable or non-ASCII characters.
## Part A
Copy and paste these commands in the Linux Terminal.
### Part 1
```
LC_COLLATE=C find . -name '*[! -~]*'
The "forbidden" characters are returned as they are.
```
### Part 2
```
LC_ALL=C find . -name '*[! -~]*'
The "forbidden" characters are returned as questions marks, e.g., "??".
```
```
LC_ALL=C find . -name '*[![:print:]]*'
This might not work as well as the two other ones.
```
Sources:
- https://www.baeldung.com/linux/find-special-character-filenames
## Part B
Another good idea could be to list all filenames with a command like `tree`, then save this output to a file, then analyze this file with another command.
When it is done like this, the file system does not have to be scanned so frequently because scanning the whole filesystem takes a lot of time.