How to Easily Find Text Files Containing Passwords

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.