grep -r "texthere" .
The first parameter represents the regular expression to search for, while the second one represents the directory that should be searched. In this case, .
means the current directory.
Note: This works for GNU grep, and on some platforms like Solaris you must specifically use GNU grep as opposed to legacy implementation. For Solaris this is the ggrep
command.
Related Posts:
- How do I grep recursively?
- How do I grep recursively?
- How do I use grep to search the current directory for all files having the a string “hello” yet display only .h and .cc files?
- How can I exclude directories from grep -R?
- How can I exclude directories from grep -R?
- Diff command along with Grep gives “Binary file (standard input) matches”
- How do I find all files containing specific text on Linux?
- How to perform grep operation on all files in a directory?
- SSH using python script
- Argument list too long error for rm, cp, mv commands
- Difference between using “chmod a+x” and “chmod 755”
- How to cat <
> a file containing code? - Extract file basename without path and extension in bash
- Given two directory trees, how can I find out which files differ by content?
- How to download a file from server using SSH?
- What is the difference between “#!/usr/bin/env bash” and “#!/usr/bin/bash”?
- What does `set -x` do?
- Command to change the default home directory of a user
- How to get the process ID to kill a nohup process?
- How to grep and replace
- 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
- Syntax error near unexpected token ‘then’
- C fopen vs open
- How can I use grep to show just filenames on Linux?
- Using grep and ls -a commands
- Restarting cron after changing crontab file?
- How do I write stderr to a file while using “tee” with a pipe?
- cd into directory without having permission
- Copying a large directory tree locally? cp or rsync?
- Can I nohup/screen an already-started process?
- Environment variables of a running process on Unix?
- In my /etc/hosts/ file on Linux/OSX, how do I do a wildcard subdomain?
- When does /tmp get cleared?
- SSL Certificate Location on UNIX/Linux
- Is it possible to detach a process from its terminal? (Or, “I should have used screen!”) [duplicate]
- What does ‘set -e’ do, and why might it be considered dangerous?
- Meaning of directories on Unix and Unix like systems
- How to remove empty/blank lines from a file in Unix (including spaces)?
- How to forcibly close a socket in TIME_WAIT?
- How can I rename a Unix user?
- How to get pid of just started process
- Can you have more than one ~/.ssh/config file?
- How to disable everything in crontab -l?
- How to sort ps output by process start time?
- Amazon Linux: apt-get: command not found
- What is the meaning of *nix?
- “Couldn’t find a file descriptor referring to the console” on Ubuntu bash on Windows
- How can I recursively find all files in current and subfolders based on wildcard matching?
- How to install grub after installing Windows 10
- mysql_config not found when installing mysqldb python interface
- Linux error while loading shared libraries: cannot open shared object file: No such file or directory
- Shell command to tar directory excluding certain files/folders
- QEMU: /bin/sh: can’t access tty; job control turned off
- Meaning of exit status 1 returned by linux command
- X11 forwarding request failed on channel 0
- How to change permissions for a folder and its subfolders/files in one step
- mysql_config not found when installing mysqldb python interface
- linux command to get size of files and directories present in a particular folder?
- ./configure : /bin/sh^M : bad interpreter
- Compile the Fortran program in Windows using gfortran
- How can I set the ‘backend’ in matplotlib in Python?
- Yum fails with – There are no enabled repos.
- Unable to establish SSL connection upon wget on Ubuntu 14.04 LTS
- Writing a simple shell in C using fork/execvp
- configure: error: cannot run C compiled programs
- What does set -e mean in a bash script?
- “find: paths must precede expression:” How do I specify a recursive search that also finds files in the current directory?
- Pipe to/from the clipboard in a Bash script
- Difference between exec, execvp, execl, execv?
- what does -zxvf mean in tar -zxvf filename?
- Retrieve last 100 lines logs
- Configuring Apache for localhost
- grep for special characters in Unix
- How do I know the script file name in a Bash script?
- WordPress can’t find temporary folder, but folder it’s looking at has correct permissions
- WordPress cloning issue
- How to run a server on port 80 as a normal user on Linux?
- Check if port is open or closed on a Linux server?
- Moving an already-running process to Screen
- When does `cron.daily` run?
- Permission denied (publickey). SSH from local Ubuntu to Amazon EC2 server
- How to run a command multiple times, using bash shell?
- LVM dangers and caveats
- How to know from which yum repository a package has been installed?
- tar – Remove leading directory components on extraction
- How to list Apache enabled modules?
- How can I monitor hard disk load on Linux?
- What’s the reverse DNS command line utility?
- How to add a security group to a running EC2 Instance?
- How bad is it really to install Linux on one big partition?
- How do I extract login history?
- SSH from A through B to C, using private key on B [closed]
- Is it possible to reboot a Linux OS without rebooting the hardware?
- Does the “bs” option in “dd” really improve the speed?
- What solutions exist to allow the use of revision control for server configuration files? [closed]
- Is there a way to do a remote “ls” much like “scp” does a remote copy?
- Dump a linux process’s memory to file
- What is the difference between /sbin/nologin and /bin/false?