Find files containing something in Linux

Grep

1. grep -lir "String_to_find" * :searching from the current path

-l print only the file names containing your search term

-r recursive

-i case insensitive

* all files
grep -iw glcore XFree86.0.log search glcore in file XFree86.0.log

-w means whole word match

Find
1. find /start_path -name *.txt | grep -lir "some text" *   : start searching from the given path
$ find / -name arrow.jpg
$ find ~ -name 'arrow*.xbm'
$ find ~ -name '*.xbm'
$ find / -uid 1005

Locate
$ locate -i filename


No comments:

Post a Comment

Datatable static image not found on the server

When you use ```datatables.min.css``` and ```datatables.min.js``` locally, instead of datatables CDN, you may have encountered that ```sort...