grep -n 'pattern' file.txt

Category: Text Processing

grep -n 'pattern' file.txt

Show line numbers alongside matching lines

Shows matching lines together with their line numbers so you can find them easily in the file.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.