Skip to content

Instantly share code, notes, and snippets.

Analyzing disk usage is an important task for Linux admin. Disk I/O bottlenecks can bring down applications. Hope this post can give you more ideas on how to troubleshoot disk problems.

Check Disk Space Usage with df

Check Disk Utilization In Linux

Check Disk IOPS and Bandwidth In Linux

Check IO usage by Process

@tcpdump-examples
tcpdump-examples / actimeo.md
Last active February 6, 2021 04:15
What does actimeo mean in nfs mount

What does actimeo mean in nfs mount

The "actimeo=0" option means turn attribute caching off. The actimeo option actually makes the time duration the nfs client holds the various cache attributes like "acregmin","acregmax","acdirmin" and "acdirmax" to zero seconds, which means that the nfs client will need to look for the attributes everytime from the server.

How to capture SSH Traffic with Tcpdump?

We can filter tcp port 22 in tcpdump command to capture all the ssh traffic.

tcpdump -i eth0 tcp port 22

tcpdump -i eth0 'tcp[2:2] = 22'

The output of tcpdump is format dependant. A typical output line for TCP looks like this.

How to use tcpdump to capture CDP or LLDP packet?

tcpdump -v -s 1500 -c 1 '(ether[12:2]=0x88cc or ether[20:2]=0x2000)'

How to use tcpdump to filter CDP packet?

This will often show you the uplink Cisco chassis switch info like the native vlan, port info, device name, serial name etc.

tcpdump -v -s 1500 -c 1 'ether[20:2] == 0x2000'

@tcpdump-examples
tcpdump-examples / how-to-use-tcpdump.md
Last active February 15, 2021 09:41
how-to-use-tcpdump.md.

How to use tcpdump to filter dhcp packets v4?

DHCP v4 traffic operates on port 67 (Server) and port 68 (Client). So we can capture the appropriate traffic with the following expression. (v4)

tcpdump -i eth0 udp port 67 or port 68 -vvv

How to use tcpdump to filter dhcpv6 packets?

This type of for loop is characterized by counting. The range is specified by a beginning (#1) and ending number (#5). The for loop executes a sequence of commands for each member in a list of items. A representative example in BASH is as follows to display welcome message 5 times with for loop:


#!/bin/bash
for i in 1 2 3 4 5
do

What are TCP flags?

Each TCP flag corresponds to 1 bit in size. The list below describes each flag in greater detail. Additionally, check out the corresponding RFC section attributed to certain flags for a more comprehensive explanation.

  • SYN - The synchronisation flag is used as a first step in establishing a three way handshake between two hosts. Only the first packet from both the sender and receiver should have this flag set. The following diagram illustrates a three way handshake process.
  • ACK - The acknowledgment flag is used to acknowledge the successful receipt of a packet. As we can see from the diagram above, the receiver sends an ACK as well as a SYN in the second step of the three way handshake process to tell the sender that it received its initial packet.

Sort By memory Usage per-process in the interactive menu

  • press Shift+f to enter the interactive menu
  • press the up or down arrow until the %MEM choice is highlighted
  • press s to select %MEM choice
  • press enter to save your selection
  • press q to exit the interactive menu

top sort by memory

In networking, a port is a virtual place on a machine that is open to connections from other machines. Every networked computer has a standard number of ports, and each port is reserved for certain types of communication.
Think of ports for ships in a harbor: each shipping port is numbered, and different kinds of ships are supposed to go to specific shipping ports to unload cargo or passengers. Networking is the same way: certain types of communications are supposed to go to certain network ports. The difference is that the network ports are virtual; they are places for digital connections rather than physical connections.
## DNS Port
Most of the time, DNS happens over UDP port 53. It's lightweight and faster than TCP. This is to reduce performance overhead on the DNS server due to the number of requests it is likely to receive.
But DNS servers still need to be available on TCP. Zone transfers happen over TCP port 53. This happens on the DNS server side which is not related to the end-user.