Capture traffic on an interface

Write traffic to and from one IP on port 80 into a pcap file.

tcpdump -i eth0 -nn host <ip> and port 80 -w /tmp/capture.pcap

tool
linux133 commands
tags
linuxnetworkdebug

More linux commands

  • df -i | sort -k5 -rn

    Show inode usage per filesystem. When inodes run out, you get "No space left on device" while the disk still has free space.

  • lsof -p <pid>

    Show all files, sockets and connections that a process has open.

  • watch -n 2 'kubectl get pods -n <ns>'

    Re-run a command every 2 seconds and show the fresh output. Add -d to highlight changes.

  • nohup ./script.sh > /tmp/out.log 2>&1 &

    Run a script that keeps working after you close the terminal (SIGHUP) and write its output to a file.

  • ssh -L 8080:internal-service:80 user@bastion -N -f

    Forward local port 8080 to an internal service through a bastion host and keep the tunnel in the background.

all 133 linux commands