Advanced Search
Search Results
69 total results found
GAWK 2
Regular Expression gawk defaults to using ERE mode. Basic Usage First, create the foo text file. cat <<EOF > foo a1,a2,a3 b1,b2,b3 EOF gawk -F, '/1,a/{ print $1 }' foo a1 Here, the entire line is matched, equivalent to $0. Field-Specific Matching $2 ~ spec...
Multi-Lines Text
Echo Command Using the -e option can create simple multi-line text. echo -e 'aa\nbb' aa bb Here Document Here Document (abbreviated as Heredoc) is a way of input redirection in Shell, allowing you to embed multi-line text within scripts or commands and pas...
Regular Expression
Regular Expressions (regex) can be divided into the following categories based on different standards. Type Abbr Full Name Basic Regular Expressions BRE Basic Regular Expressions Extended Regular Expressions ERE Extended Regular Expressions Perl Reg...
SED
Stream Editor, a stream text processor, authored by Lee E. McMahon. Basic Syntax sed [OPTIONS] 'command' file OPTIONS: Command options. command: Print, replace, delete, etc. file: The file to process; if omitted, reads from STDIN. Omitting file enters inter...
Safely Delete
WARNINGDO NOT DELETE THE PATH DIRECTLY. /var/log/journal/ Commands Get Disk Usage journalctl --disk-usage Archived and active journals take up 3.9G on disk. Delete by Days journalctl --vacuum-time=7d Delete by Size journalctl --vacuum-size=500M Single Fi...
Commands
Get Router IP netstat -nr | grep default Destination Gateway Flags Netif Expire default 172.30.109.1 UGScg en1 default link#24 UCSIg bridge100 ! default ...
POC Proxy
机器 poc-proxy 192.168.255.250 Nginx/etc/nginx/vhost IPTables iptables -t nat -L -n -v Chain PREROUTING (policy ACCEPT 17M packets, 1432M bytes) pkts bytes target prot opt in out source destination 51238 3072K DNAT t...
IPVS
netstat/lsof/ss
pgsql port is visible by lsof not netstat or ss k8s pod port is visible by netstat not lsof 这种差异主要是因为 netstat 和 lsof 工作原理不同: netstat 的工作方式: 主要通过读取 /proc/net/ 下的网络相关文件 显示的是系统网络栈中的连接信息 更关注传统的网络连接和套接字 lsof 的工作方式: 显示所有打开的文件描述符 包括常规文件、目录、网络套接字等 能看到更底层的文件描述符信息 对...
Rsync
Configuration /etc/rsyncd.conf ## /etc/rsyncd: configuration file for rsync daemon mode --- ## See rsyncd.conf man page for more options. --- ## configuration example: port = 873 uid = root gid = root use chroot = yes max connections = 50 strict modes...
Scanner
Nmap Subfinder
SSH Tunnel
Kubernetes pod forward proxy. ssh -L 8080:localhost:8080 root@192.168.xx.xx
VIP
背景 在使用 Ansible 安装 K8s 集群的时候,配置了 192.168.88.48 作为 VIP 的地址。 Errorscouldn't get current server API group list: Get "https://kubernetes.example.local:6443/api?timeout=32s": dial tcp 192.168.88.48:6443: i/o timeout 辉哥:RFC 那么多保留地址任选一个也比这个C类好 VIP 用 C 类地址会有概率出问题,是...
Debian
Concept Software Source Configuration (/etc/apt/sources.list) Main Software Sources deb http://mirrors.aliyun.com/debian buster main non-free contrib deb-src http://mirrors.aliyun.com/debian buster main non-free contrib Description: deb: Binary package sour...
OOM Score
修改 oom_score 可以在某些情况下有用,特别是在管理进程的内存回收优先级时。oom_score 是 Linux 内核用于选择哪个进程应该在内存不足时(触发 OOM Killer 时)被终止的一个指标。 oom_score 的作用 oom_score:表示进程被杀死的优先级。数值越高,表示该进程在 OOM(Out of Memory,内存不足)时被杀死的可能性越大。每个进程都有一个 oom_score 值,表示该进程在 OOM 情况下的杀死优先级。 值范围:0 到 1000,越高的值表示进程越容易被 O...
Commands
iostat -x 1 iotop lsblk lsblk -o NAME,SIZE,TYPE,MOUNTPOINT dmsetup ls lvdisplay cat /etc/fstab
Logical Volume Manager
LVM 是 Logical Volume Manager(逻辑卷管理器)的缩写。 它是一种在 Linux 系统中管理磁盘存储空间的技术,主要功能包括: 把多个物理磁盘或磁盘分区(Physical Volumes, PV)合并成一个大的存储池(Volume Group, VG)。 在这个存储池里创建和管理逻辑卷(Logical Volumes, LV),相当于虚拟分区。 方便灵活地调整磁盘容量,比如扩展(扩容)、缩小、快照备份等,而不用像传统分区那样受限。 简单说,LVM 可以让你更灵活地管理硬盘空间,动态调整磁...
Clear File Content
Both methods can be used to clear a file's content, but they differ in implementation and details: 1. : > file.log Explanation: : is a shell built-in null command that does nothing. > is the output redirection operator that redirects the null command's "out...
getent
If pod has no curl or nslookup, use getent instead. getent ahosts foobar.namespace.svc.cluster.local getent ahosts google.com
System Profile
Centos echo -e "\n=== OS ===\n$(cat /etc/redhat-release)\n\n=== Kernel ===\n$(uname -r)\n\n=== CPU ===\n$(lscpu | grep --color=never -E 'Model name|CPU\\(s\\)|Socket')\n\n=== Memory ===\n$(free -h)\n\n=== Disk ===\n$(df -h)\n" echo -e "\n=== OS ===\n$(cat /e...