bash search file code example

Example 1: bash search file in directory

grep -rnw '/path/to/somewhere/' -e 'pattern'

Example 2: bash find file by name

find . -name 'mystring*'

Example 3: bash find file

# syntax 
# find *</path/to/dir> '(' *<filter-1> -o *<filter-2> ')'

# example 
find . '(' -name '*ERR5312209.zip' -o -name '*ERR5312209.TXT' ')'

Example 4: bash search history

sudo add-apt-repository ppa:ultradvorka/ppa && sudo apt-get update && sudo apt-get install hstr && hstr --show-configuration >> ~/.bashrc && . ~/.bashrc