- 1). Log in to your system with an account that has sufficient privileges to view all files and folders your file(s) may be located in.
- 2). Open a new terminal window. This process is different for each system, but typically it can be found in the "Applications" or "Utilities" menu of your window manager.
- 3). Change your working directory to the directory you want to begin the search in. For example, type "cd /" to look at all connected system devices, or type "cd ~/Desktop" to look only at your desktop.
- 4). Begin entering your command by typing "grep -lr" into the terminal. This tells grep it will list only file names and will recursively search all subdirectories it encounters.
- 5). Complete the command by specifying the pattern, which is also known as a regular expression. For example, to search words only starting with "report" type, including quotes: grep -lr "report.*"
- 6). Try different patterns. To search for multiple files named "bill" or "frank" or "joe," type, including quotes:
grep -r "bill\|frank\|joe"
SHARE