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?
- Bash: No such file or directory?
- What’s a .sh file?
- sudo: npm: command not found
- How can I symlink a file in Linux? [closed]
- Kill detached screen session [closed]
- How to get the url of the current svn repo?
- performing HTTP requests with cURL (using PROXY)
- Amazon Linux: apt-get: command not found
- Pass a password to ssh in pure bash
- gcc: error: unrecognized command line option
- How to set proxy for wget?
- How to change permissions for a folder and its subfolders/files in one step
- ssh: Could not resolve hostname [hostname]: nodename nor servname provided, or not known
- Docker can’t connect to docker daemon
- Need a good hex editor for Linux
- Who can access a file with octal permissions “000” on Linux/UNIX?
- What does it mean to mount a file system in linux?
- Trying to use bash on Windows and got no installed distributions message
- “Unable to find remote helper for ‘https'” during git clone
- -bash: fork: Cannot allocate memory
- Is there a “goto” statement in bash?
- Explanation of polkitd Unregistered Authentication Agent
- tar: Cowardly refusing to create an empty archive
- How can I delete a user in linux when the system says its currently used in a process
- Read and write to binary files in C?
- PHP and mod_fcgid: ap_pass_brigade failed in handle_request_ipc function
- httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName
- Why does “docker attach” hang?
- Retrieve last 100 lines logs
- What are various options / arguments for “./configure” in Linux
- CronJob not running
- Delete .DS_STORE files in current folder and all subfolders from command line on Mac
- bash sh – command not found
- Hosting multiple WordPress sites on single server – best practices?
- How to configure WP filesystem access in Linux (Ubuntu Server)?
- Can’t upload media to my Raspberry Pi WordPress server
- My WordPress is giving me an 403 error when saving post/draft with specific words
- Anyone else experiencing high rates of Linux server crashes during a leap second day?
- What permissions should my website files/folders have on a Linux webserver?
- Can I automatically add a new host to known_hosts?
- How can I run Debian stable but install some packages from testing?
- Shell command to monitor changes in a file
- Difference in sites-available vs sites-enabled vs conf.d directories (Nginx)?
- Disk full, du tells different. How to further investigate?
- Filename length limits on linux?
- best way to clear all iptables rules
- How to re-order windows, change the scroll shortcut, and modify the status bar contents in GNU Screen?
- How to prevent a user from login in, but allow “su – user” in Linux?
- I have a keypair. How do I determine the key length?
- Why drop caches in Linux?
- swap partition vs file for performance?
- Best way to disable swap in Linux
- How can I zip/compress a symlink?
- How to find the physical volume(s) that hold a logical volume in LVM