# version 1.1, 2025-12-12

bind-key -T insert_strings k display-menu -T 'insert command line : kernel- / hardware-related' \
	' adjust OOM'                       '1' 'send-keys "echo -500 >|/proc/PID/oom_score_adj"' \
	' disable same page merging'        '2' 'send-keys "echo 0 >| /sys/kernel/mm/ksm/run"' \
	' drop page cache'                  '3' 'send-keys "echo 1 >| /proc/sys/vm/drop_caches"' \
	' find IOMMU group for PCIe device' '4' 'send-keys "find /sys/kernel/iommu_groups/ -type l | grep 0000:01:00.0"' \
	' show BIO queue length'            '5' 'send-keys "head /sys/block/sd?/queue/nr_requests"' \
	' show block device IO scheduler'   '6' 'send-keys "head /sys/block/sd?/queue/scheduler"' \
	' show block device IO scheduler settings' '7' 'send-keys "head /sys/block/sda/queue/iosched/*"' \
	' show CPU frequency per core'      '8' 'send-keys "for cpu_path in /sys/devices/system/cpu/cpu[0-9]* ; do cpu_id=\"\${cpu_path\#\#*/}\" ; printf \"%-5s  %s\\n\" \"\${cpu_id}\" \"\$(< \"\$cpu_path\"/cpufreq/scaling_cur_freq ) (min: \$(< \"\$cpu_path\"/cpufreq/scaling_min_freq ))\" ; done | sort -n -k 2"' \
	' show DIMMs' '' 'send-keys "dmidecode | grep -e \"DMI type 17\" -e \"^\s*Size:\""' \
	'' \
	' show NVMes temperatures'          '9' 'send-keys "for nvme in /dev/nvme? ; do echo \"\$nvme\"; nvme smart-log \"\$nvme\" | grep -i temp; done"' \
	' show page cache settings'         '0' 'send-keys "sysctl vm.dirty_expire_centisecs vm.dirty_bytes vm.dirty_ratio vm.dirty_background_bytes vm.dirty_writeback_centisecs"' \
	'      number of dirty pages'       'a' 'send-keys "grep -i -e dirty -e writeback /proc/meminfo"' \
	' show PCIe link speed'             'b' 'send-keys "lspci -vv -s 41:00.0 | grep -A1 LnkSta \# PCIe 3: 8 GT/s   PCIe 4: 16 GT/s   PCIe 5: 32 GT/s"' \
	' show secure boot state'           'c' 'send-keys "mokutil --sb-state"' \
	' show USB device driver'           'd' 'send-keys "ll /sys/bus/usb/devices/1-2*/driver"' \
	' sysrq-trigger: reisub'            'e' 'send-keys "echo _reisub >| /proc/sysrq-trigger"' \
	' sysrq-trigger: invoke OOM killer' 'f' 'send-keys "echo f >| /proc/sysrq-trigger"' \
	' udev: reload rules'               'g' 'send-keys "udevadm control --reload"' \
	' udev: trigger block device rules' 'h' 'send-keys "udevadm trigger --action=change --subsystem-match=block"' \
	' udev: trigger tty rules'          'i' 'send-keys "udevadm trigger --subsystem-match=tty"' \
	'' \
	' --- commands with arguments ---' '' '' \
	' fio (linear reads)'               'j' 'send-keys "fio --name=readtest --rw=read --bs=1M --ioengine=io_uring --direct=1 --iodepth=32 --numjobs=4 --size=10G --filename=/dev/sda"' \
	' iostat'                           'k' 'send-keys "iostat -xm /dev/[sv]d{a..e} /dev/nvme?n1 5"' \
	' lsblk+'                           'l' 'send-keys "lsblk --nodeps -o NAME,SIZE,ROTA"' \
	' lsof+ (open files in a subtree)'  'm' 'send-keys "lsof /foo/bar"' \
	' lsof+ (rw open files and cwd check in a subtree)' 'n' "send-keys \"lsof -F pat /mnt/bigdata | grep -q -e ^fcwd -e '^a[wac]'\"" \
	' sysctl+'                          'o' 'send-keys "sysctl -a --pattern forward$"'

