• Home
  • WordPress
  • web Hosting
    • Free hosting
    • Cheap Hosting
    • comparison cloud , vps, shared, wordpress
    • managed wordpress hosting
    • managed cloud hosting
  • page Speed
  • Deals
  • Services
  • About

RAaz Kumar .com

wordpress tutorials seo hosting etc


Top 10 GREP Commands in linux to search files directory words strings

Grep command in linux explained

Grep command used for search files and search pattern. (Find Text in Files).
grep command stands for “global regular expression print
grep [options] pattern [files]

Options Description

-c : counts the frequency only
-h : Display the matched lines, but do not display the filenames.
-i : case insensitive Ignores, case for matching
-l : filenames only.(imp)
-n :  line number if word in a file
-v : lines that are not matched with the keyword
-e exp : Specifies expression with this option. Can use multiple times.
-f file : takes the file patterns
-E : Treats pattern as an extended regular expression (ERE)
-w : prints whole words in a file
-o : Print only matched words per line

Expressions

Start ^
End $
grep “^linux” mynewfile.txt
grep “ux$” mynewfile.txt
$grep –e “admin” –e “admin” –e “admin” newfile.txt
$grep –f newfile.txt  mynewfile.txt

Finding a text in list of files in a directory.

grep ‘word’ file1 file2 file3

grep -n ‘root’ /etc/passwd
grep –color root /etc/passwd

Grep From Files and Display the File Name On Linux

grep -l “string” filenamegrep -l root /etc/*

Searching a String / word in files & directories

root@instance-1:/etc/nginx# grep -nr ‘cache-control’ .
./conf.d/global.config:62:add_header cache-control “max-age=31536000”;
./conf.d/expires.global:5:add_header cache-control: max-age=31536000;

 

grep command to search string word in file

 

root@-s-4vcpu-8gb-blr1-01:~# grep root /etc/passwd
root:x:0:0:root:/root:/bin/bash

grep WP_CACHE_KEY_SALT /var/www/html/yoursite.com/wp-config.php

all files containing string

grep -R containing text /home/user/

grep ‘string1 string2’ filename

 

finding a file containing a particular text string

grep “find me in home” /home/tom/*.txt

grep “find me anywhere in text files “~/*.txt

 

 use grep recursively

grep -R “192.168.0.1” /etc/
grep -R ‘string’ dir/
grep -R ‘expires’ /etc/nginx/
root@instance-1:/etc/nginx# grep -R ‘expires’ /etc/nginx/
/etc/nginx/rocket-nginx/default.conf: expires 30d;
/etc/nginx/rocket-nginx/default.conf: expires 30d;
/etc/nginx/rocket-nginx/default.conf: expires 30d;
/etc/nginx/rocket-nginx/rocket-nginx.tmpl: expires 30d;
/etc/nginx/rocket-nginx/rocket-nginx.tmpl: expires 30d;
/etc/nginx/rocket-nginx/rocket-nginx.tmpl: expires 30d;
/etc/nginx/sites-enabled/rajuginne: # Directives to send expires headers and turn off 404 error logging.
/etc/nginx/sites-enabled/rajuginne: expires 24h;
/etc/nginx/conf.d/default.conf: expires 31536000s;
/etc/nginx/conf.d/default.conf: expires 3600s;
/etc/nginx/conf.d/default.conf: expires 31536000s;
/etc/nginx/conf.d/headers.conf:#add_header expires $expires;
/etc/nginx/conf.d/headers.conf:map $sent_http_content_type $expires {
/etc/nginx/conf.d/browsercaching.confg: expires 3600s;
/etc/nginx/conf.d/expires.global: expires 365d;
/etc/nginx/conf.d/global2.config: expires max;
grep -R ‘add_header’ /etc/nginx/
grep -nr ‘ssl’ .
t@instance-1:/etc/nginx# grep -nr ‘ssl’ .
./nginx.conf:38: #ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
./nginx.conf:39: #ssl_prefer_server_ciphers on;
./rocket-nginx/README.md:153:**<a name=’faq_ssl’>Will Rocket-Nginx work if my we bsite uses a SSL certificate (https) ?</a>**
./sites-enabled/f.in.conf:5:#ssl on;
./sites-enabled/ff.in.conf:6:ssl_certificate /etc/nginx/ssl/ssc.pem;
./sites-enabled/ff.in.conf:7:ssl_certificate_key /etc/nginx/ssl/ssc.key;
./sites-enabled/ffff.in:5:#listen 443 ssl http2;
./sites-enabled/.in:8:#include /etc/letsencrypt/options-ssl-nginx. conf;
The dot at the end searches the current directory. Meaning for each parameter:
-n Show relative line number in the file
‘yourString*’ String for search, followed by a wildcard character
-r Recursively search subdirectories listed
. Directory for search (current directory)
cd /etc/nginx/sites-enabled#
grep -nr ‘ssl’ .
./eaadharcard.co.in.conf:8: ssl on;
./eaadharcard.co.in.conf:9: ssl_certificate /etc/nginx/ssl/eaadharcard.co.in.pem;
./eaadharcard.co.in.conf:10: ssl_certificate_key /etc/nginx/ssl/eaadharcard.co.in.key;
./employmentnewsdaily.in:5: ssl on;

root@instance-1:~# grep . /proc/sys/net/ipv4/tcp*mem

/proc/sys/net/ipv4/tcp_mem:45525        60702   91050
/proc/sys/net/ipv4/tcp_rmem:4096        131072  6291456
/proc/sys/net/ipv4/tcp_wmem:4096        16384   4194304
root@instance-1:~#/etc/nginx/sites-enabled# grep -nr ‘raazkumar.com‘ .

linux find a file in a directory

The find command can only filter the directory hierarchy based on a file’s name and metadata. If you need to search based on the file’s content, use a tool like grep. Consider the following example:

find . -type f -exec grep “example” ‘{}’ \; -print

find command to find a file in a directory

find /path option filename

i want to ind newrelic.ini file  this directory
find /etc/php/7.4/fpm/conf.d/ newrelic
ls -l  /etc/php/7.4/fpm/conf.d/
2nd way
cd /etc/php/7.4/fpm/conf.d/
grep newrelic
/etc/php/7.4/fpm/conf.d

Related topics:

  1. linux commands pdf (files & Directories, zip & unzip process, search etc)
  2. Top 10 zip / tar commands to compress & extract files in linux
  3. Top 10 most used Cat commands with examples (create, view, append files)
  4. TOP 10 mv & cp commands in linux to move & copy files in Linux
  5. lsof netstat commands to know listening ports in linux 3 ways

tutorials

  • Vivek Bindra Videos Transcription (business strategy)
  • git commands
  • new relic php agent install in 3 steps
  • new relic mysql install integration - 2 ways fix problems
  • new relic installation linux (infrastructure agent , php, mysql , nginx)
  • xampp tutorials 2021 installation errors fix wordpress phpmyadmin mysql apache
  • Redis performance metrics & tuning for nginx apache ubuntu & debian
  • Devops course Syllabus topics PDF AWS, Azure, cisco, redhat
  • CCNA Syllabus pdf (CCNA / CCNP vs devops vs mcsa /MCSE)
  • how to create a website free of cost on google
  • what is vpn vs proxy vs tor, http vs https, http2, tcp vs udp, kali linux sql source code injection
  • nginx server tutorials (installation, configuration, performance tuning, security)
  • MySQL Tutorial (create,connect database, update tables, export etc) Documentation & TIPS
  • AUdio Editing Background Noise removal (Audacity, Adobe Premiere Addition, Camtasia Filmora Windows Obs)
  • Android Studio tutorials syllabus Topics Course details #AndroidApplicationDevelopment
  • [INTRO] Ethical hacking / cyber Security / Penetration testing Tutorial -{updates frequently}
  • redis install ubuntu 20.04 with wordpress php redis mysql configuration
  • ubuntu tutorials installation download issues etc
  • Php tutorials
  • HTML & CSS Tutorials
  • Core Java Tutorial Free online
  • Linux sysadmin tutorials linux system administrator
    • linux security limits.conf deciding user limits process limits for nginx server
    • remove repository ubuntu
    • increase open file limit linux File descriptor ft nginx , mysql, lemp
    • how to uninstall package in linux ubuntu rpm, yum apt-get
    • rsync command linux with examples comparison to scp
    • check linux version (lsb_release -a) ubuntu debian 32 or 64 bit
    • memcached install ubuntu wordpress
    • ping command
    • change ssh port in linux - avoid sshd ddos attacks
    • ddos attack prevention
    • ufw firewall commads allow port enable disable ubuntu 20.04
    • red hat linux certification cost jobs salary syllabus courses fees
    • ulimit linux unlimited command unlimto set & know user limits open files file descriptor max user process etc.
    • top 10 apt & apt-get commands (most used) apt vs apt-get
    • linux sysctl command tweaks & hardening
    • linux system specs commands (CPU, Memory, Disk )speed, type. manufacture
    • 3 Ways (SCP, rsync, Sftp) linux server migration between two remote server apache nginx
    • Upgrade Ubuntu from 18.04 (19.10) to 20.04 LTS command line or gui server | desktop
    • lsof netstat commands to know listening ports in linux 3 ways
    • Top 10 GREP Commands in linux to search files directory words strings
    • TOP 10 mv & cp commands in linux to move & copy files in Linux
    • Top 10 zip / tar commands to compress & extract files in linux
    • Ip tables / ufw / firewall d commands for block port ip rate limiting
    • Top 10 most used Cat commands with examples (create, view, append files)
    • linux performance tuning inode limit file descriptors tco, kernel etc
    • linux commands pdf (files & Directories, zip & unzip process, search etc)
  • apache server tutorial (install,config, performance tuning, security, error handling)

 

 

wordpress Pagespeed optimization

Digitalocean free $100 Credit

Cloudways Review pricing promo codes

Siteground cpu limits Pricing

Shared Hosting

Managed wordpress Hosting

Managed Hosting Cloud server

VPS Hosting

Cloud Hosting – Unmanaged

Google cloud Pricing

Aws Pricing

Azure pricing

nginx server tutorials

apache server tutorials

linux sysadmin tutorials

mysql Commands list pdf

LEMP Install Ubuntu

Mysql Performance Tuning

Nginx Performance tuning

Linux Performance tuning

Php -fpm performance tuning

Redis Performance tuning

linux server security

nginx security best practices

wordpress security plugins

 

 

wordpress

 

Top 5  WP Google Analytics Plugins

WP Backup Plugins

Wp Comment Plugins

Top wordpress Security Plugins

WP Seo Plugins

WP Caching Plugins

Best Adsense Plugins for WordPress

Wp social Sharing Plugins

autoshare social media plugins

WP speed Optimization Plugins

Speedup WordPress google Score

More Wp tuts

Server Admin Cloud

 

Installing Nginx LEMP On ubuntu

Installing apache Lamp ubuntu

nginx fastcgi cache enable

php – fpm install  & Configuration

Opcache install & Configure

php -fpm pool manager explained

Mysql Install & Configuration

Redis Object cache install & configure

 

Nginx as Reverse Proxy and Load balancer

Load Balance / auto scaling in google cloud

Linux Commands PDF

Mysql Commands Pdf

Letsencrypt tutorial

mysqldump export & import 

Pagespeed Module install & configure

nginx.conf best file

mysql.conf best file

upgrade ubuntu

© 2023 - All Rights Reserved Disclaimer & Privacy Policy