grep excluding file name pattern December 12, 2023 by Tarik You can quote the pattern: grep -r --exclude="*.cmd" "ckim" ./ PS. ./ is the current directory