How to Easily Find Text Files Containing Passwords

Konstantin Dokuchaev
Konstantin Dokuchaev
How to Easily Find Text Files Containing Passwords

Many people store passwords in text files, even though it’s easier and much safer to use password managers. PowerShell and grep commands can help locate such files.

A surprising number of people still store their website logins and passwords in plain text documents. This is odd to me, since password managers are not only more secure but also more convenient for organizing and searching information.

If you’ve decided to finally organize your passwords, it’s a good idea to scan your drive for as many text files containing login credentials as possible.

Solution for Windows

The easiest way is to open PowerShell and run the following command:

Get-ChildItem -Path C:\ -Recurse -Include *.txt, *.log, *.csv | Select-String -Pattern "password|login|pass|secret|credentials|user|username|auth|apiKey|token|accessKey|privateKey|passwords|pwd|hash|пароль|логин|ключ|аккаунт|учетная запись|секрет|токен|доступ|ключ_доступа|сертификат" | Format-Table Filename, LineNumber, Line

This command will display a list of files matching the search criteria. You can customize the keywords or file formats as needed.

Solution for macOS

It’s just as simple on a Mac. Open the Terminal and run the following command:

grep -r -i -E "password|login|pass|secret|credentials|user|username|auth|apiKey|token|accessKey|privateKey|passwords|pwd|hash|пароль|логин|ключ|аккаунт|учетная запись|секрет|токен|доступ|ключ_доступа|сертификат" /path/to/search/

As with the Windows example, this will return a list of all files that match your criteria.



Great! Next, complete checkout for full access to All-in-One Person
Welcome back! You've successfully signed in
You've successfully subscribed to All-in-One Person
Success! Your account is fully activated, you now have access to all content
Success! Your billing info has been updated
Your billing was not updated