Skip to content

Instantly share code, notes, and snippets.

@tcpdump-examples
tcpdump-examples / iowait-linux.md
Created March 21, 2021 11:40
How to Fix io wait issue in Linux

Linux high IOwait is a common Linux performance issue. Today we will look at what iowait means and what contributes to this problem. Hope this can give you more ideas about high IOwait issue.

What is IOwait?

IO wait is related to the CPU resource on the server.

The iowait column on top command output shows the percentage of time that the processor was waiting for I/O to complete. It indicates that the system is waiting on disk or network IO. Because the system is waiting on those resources, it can not fully utilize the CPU.

Learn more about what IOwait here.

@tcpdump-examples
tcpdump-examples / tcpdump udp.md
Last active December 13, 2024 07:41
tcpdump udp packet

https://www.howtouselinux.com/post/tcpdump-udp

tcpdump is a powerful command-line network packet analyzer used for network troubleshooting and analysis. To capture UDP packets using tcpdump, you can use specific filtering options to narrow down the traffic you want to capture.

Capture all UDP traffic To capture all UDP packets, you can use the following command:

sudo tcpdump udp

Tcpdump is a CLI tool to capture raw network packets. This is useful for various forms of network troubleshooting. This cheat sheet covers all the basic and advanced options for tcpdump.

Tcpdump cheat sheet

how-to-use-tcpdump

Tcpdump command is a famous network packet analyzing tool that is used to display TCP\IP & other network packets being transmitted over the network attached to the system on which tcpdump has been installed. Tcpdump uses libpcap library to capture the network packets & is available on almost all Linux/Unix flavors.

Capture ICMP Packets With Tcpdump

#https://www.howtouselinux.com/post/how-to-get-file-size-with-ansible
- name: Get file size
hosts: your_host
tasks:
- name: Check file size
stat:
path: /path/to/your/file
register: file_info
- name: Display file size

find command:https://www.howtouselinux.com/post/find-file-by-name-in-linux

Use find command, find all *.txt files but ignore foo.txt

find . -type f ( -iname "*.txt" ! -iname "foo.txt" )

To delete file add -delete or -exec your-delete-command-here option.

find . -type f ( -iname "*.txt" ! -iname "foo.txt" ) -delete

To select folder or dirs use -type d, in this example, find all folders and ignore foo and bar folder :

find . -type d ( ! -iname "foo" ! -iname "bar" )

To delete folders except foo and bar

find . -type d ( ! -iname "foo" ! -iname "bar" ) -execdir rm -rfv {} +

Be careful while deleting files and dirs.

To check the size of a directory in Ubuntu, you can use the du command. This command stands for "disk usage" and it shows the amount of disk space used by the specified files or directories.

Options:

-h , --human-readable

-s, --summarize

-a, --all

Today we can discuss about IP address and I can also tell you about IPv4 and IPv6: Everyone who are living in this world has it’s own unique identity. The unique identity maybe his/her home address or maybe his/her ID card number. But can you ever think what is your identity on the internet??? So, don’t worry today i can answer this question in more simple words.

IP Address:

IP address stands for Internet Protocol Address. It can provide your identity on the internet.

It’s also enable the devices to communicate with each other on IP Based Networks like internet. The example of IP address is (231.23.764.123).

The working process of this technology is very simple. When any device is connected to the internet. A unique numerical identity is assigned to it. When two devices wanted to share the information.

Question: What is the most efficient way to configure an IP address on a Linux system with multiple network interfaces?

Answer: The most efficient way to configure an IP address on a Linux system with multiple network interfaces is to use the Network Manager utility.

This tool allows you to easily set up and manage your network connections on a Linux system, including assigning static IPs to multiple interfaces.

It can also be used for troubleshooting networking related issues, such as diagnosing problems with DHCP servers or configuring VPNs.

Get current time with python time module

import time
print(time.time())
1586813438.419919
print(time.ctime())
Mon Apr 13 23:30:38 2020

Get current time with python datetime module