grep -r --include=*.{cc,h} "hello" .
This reads: search recursively (in all sub directories also) for all .cc OR .h files that contain “hello” at this .
(current) directory
From another stackoverflow question
Related Posts:
- How do I grep recursively?
- How do I grep recursively?
- How do I grep recursively?
- How can I exclude directories from grep -R?
- How can I exclude directories from grep -R?
- Extract file basename without path and extension in bash
- Given two directory trees, how can I find out which files differ by content?
- Diff command along with Grep gives “Binary file (standard input) matches”
- What is the difference between “#!/usr/bin/env bash” and “#!/usr/bin/bash”?
- What does `set -x` do?
- How to get the process ID to kill a nohup process?
- How do I write stderr to a file while using “tee” with a pipe?
- How to get pid of just started process
- Can you have more than one ~/.ssh/config file?
- How do I deal with a filename that starts with the hyphen (-) character?
- Bash: No such file or directory?
- Why do you need to put #!/bin/bash at the beginning of a script file?
- How do I find all files containing specific text on Linux?
- “Couldn’t find a file descriptor referring to the console” on Ubuntu bash on Windows
- grep –ignore-case –only
- gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now
- How to perform grep operation on all files in a directory?
- Pass a password to ssh in pure bash
- -bash: syntax error near unexpected token `newline’ for display command
- SSH using python script
- “sed” command in bash
- Argument list too long error for rm, cp, mv commands
- Difference between using “chmod a+x” and “chmod 755”
- Explaining the ‘find -mtime’ command
- How does “cat << EOF" work in bash?
- Pseudo-terminal will not be allocated because stdin is not a terminal
- How to cat <
> a file containing code? - mv: cannot stat error : No such file or directory error
- Pseudo-terminal will not be allocated because stdin is not a terminal
- ./configure : /bin/sh^M : bad interpreter
- How to download a file from server using SSH?
- Trying to use bash on Windows and got no installed distributions message
- -bash: fork: Cannot allocate memory
- Is there a “goto” statement in bash?
- Bash script: bad interpreter
- How to count lines in a document?
- Command to change the default home directory of a user
- How to grep and replace
- Writing a simple shell in C using fork/execvp
- chmod: changing permissions of ‘my_script.sh’: Operation not permitted
- Using ls to list directories and their total sizes
- What does “&” at the end of a linux command mean?
- Can’t remove a directory in Unix
- tar: add all files and directories in current directory INCLUDING .svn and so on
- What does set -e mean in a bash script?
- What does set -e mean in a bash script?
- Syntax error near unexpected token ‘then’
- C fopen vs open
- “find: paths must precede expression:” How do I specify a recursive search that also finds files in the current directory?
- How can I use grep to show just filenames on Linux?
- Bash script prints “Command Not Found” on empty lines
- Using grep and ls -a commands
- Pipe to/from the clipboard in a Bash script
- Linux Bash: Move multiple different files into same directory
- Restarting cron after changing crontab file?
- How to include file in a bash shell script
- cd into directory without having permission
- How to enable Bash in Windows 10 developer preview?
- What does ‘bash -c’ do?
- bash sh – command not found
- How do I know the script file name in a Bash script?
- How can I sort du -h output by size
- Copying a large directory tree locally? cp or rsync?
- What are the functional differences between .profile .bash_profile and .bashrc
- Can I nohup/screen an already-started process?
- Environment variables of a running process on Unix?
- How to run a command multiple times, using bash shell?
- In my /etc/hosts/ file on Linux/OSX, how do I do a wildcard subdomain?
- When does /tmp get cleared?
- How do I prevent accidental rm -rf /*?
- SSL Certificate Location on UNIX/Linux
- How do I sleep for a millisecond in bash or ksh
- Is it possible to detach a process from its terminal? (Or, “I should have used screen!”) [duplicate]
- What is “-bash: !”: event not found”
- What does ‘set -e’ do, and why might it be considered dangerous?
- What’s the best way to check if a volume is mounted in a Bash script?
- Keeping a linux process running after I logout
- What useful things can one add to one’s .bashrc? [closed]
- Meaning of directories on Unix and Unix like systems
- How to add a timestamp to bash script log?
- How to remove empty/blank lines from a file in Unix (including spaces)?
- How to forcibly close a socket in TIME_WAIT?
- Colors in bash after piping through less?
- How can I rename a Unix user?
- Linux command line best practices and tips?
- How to run command as user who has /usr/sbin/nologin as Shell?
- How to disable everything in crontab -l?
- SSH from A through B to C, using private key on B [closed]
- How can I fully log all bash scripts actions?
- How to sort ps output by process start time?
- How to apply a filter to real time output of `tail -f `?
- How to remove invalid characters from filenames?
- zcat/gzcat works in linux, not on osx. general linux/osx compatibility
- Amazon Linux: apt-get: command not found
- Shell command to tar directory excluding certain files/folders