InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Networking tutorials

  • DIG quick start tutorial
  • Dig - list all dns records
  • How to view wifi connection speed on Mac
  • Linux iptables - Nat port forwarding using PREROUTING
  • Linux iptables and ip6tables examples
  • Ngrep - quick start guide
  • Use nc to check if a remote port is reachable
  • Use nc to listen to tcp or udp port
  • Use nc to test HTTP url redirection
  • add more DNS servers to Wi-Fi interface on Mac
  • locally override website host to IP mapping
  • use nc to print headers from browser
 
  • Home
  • > Tutorials
  • > Networking

Ngrep – quick start guide

By admin | Last updated on Mar 18, 2016

Ngrep is similar to tcpdump with ability to look for regex search in packets playload and show matching packets to screen. This can be very useful for debugging and troubleshooting in production and development environments. Here are some handy command to use ngrep on Linux or Mac:

Using ngrep to print http request headers

ngrep in quiet mode (-q), ignore case (-i), for interface ppp0,

$ ngrep -d ppp0 -q -i -t -W byline '^(GET|POST) '

Using ngrep to print http response headers

$ ngrep -d ppp0 -q -i -t -W byline '^HTTP/' port 80

Using ngrep to print outgoing solr http request

Assuming solr running on port 8080

$ ngrep -d ppp0 -q -i -t -W byline '' 'dst port 8080'

Using ngrep to print mysql select queries

$ ngrep -d ppp0 -q -i -W byline  'SELECT' port 3306

Using ngrep to print destination memcache traffic on localhost

If memcache is running on localhost, we need to use loopback network interface. This is the outcome when you hit memcache.php

$ ngrep -d lo0 -q -i -W byline '' dst port 11211
T ::1:49630 -> ::1:11211 [AP]
stats.
....

Suggested posts:

  1. How to use pm2 to manage node.js application in production
  2. How to connect to mysql server using ssh port forwarding
  3. How to use exerciser monkey tool for android stress testing
  4. How to use phantomjs to create site/url snapshot thumbnail
  5. NFS client and server handy commands
  6. How to use wildcard in robots.txt
  7. CSS max-width – limit maximum wodth of an element
  8. Mac docker minikube kubernetes – how to get shell access to container
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Linux, Networking, Tutorials
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress