Kernal
获取系统运行相关数据
1. 获取CPU信息
cat /proc/cpuinfo
2. inxi
# install
apt install inxi
# print info
inxi -F
查看 主流发行版 版本号和内核版本
1. 主流发行版版本号
lsb_release -a
2. WSL 版本号
wslfetch
3. 内核版本和编译时间
uname -a
查看显卡设备
lspci 很强大,不止有这一种用法
# 列出所有 VGA 设备
lspci | grep -i vga
# 查看这个设备的详情
lspci -v -s 00:02.0
NV
- nvidia-smi (
nvidia-smi -l 2) - gpustat (
gpustat -cp)
AMD
- radeontop
Intel
- intel-gpu-tools
Sudo 免密码
cd /etc/sudoers.d/
# vim {profile}
%sudo ALL=(ALL:ALL) NOPASSWD:ALL
# User rules for ubuntu
ubuntu ALL=(ALL) NOPASSWD:ALL
清理 Journal 日志
缩减至 200M
journalctl --vacuum-size=200M
挂载 SMB 路径
在 CentOS 下测试通过
视情况更改 vers, 在 windows server 2019 版本中, vers 1.0 不能成功挂载。(认证/加密未匹配)
refs:
- https://support.cs.toronto.edu/systems/linux.html
- https://blog.henrici.name/blog/2020-07-17/
- https://techoverflow.net/2021/07/06/how-to-automount-cifs-smb-on-alpine-linux/
yum install cifs-utils -y
mkdir -p /nas/mirrors
mount -t cifs -o username="",password="",vers=3.0 //192.168.1.11/mirrors/ /nas/mirrors
SSH Tunnel
# 通过 100.66.111.78 映射 192.168.50.1 的 端口 到 本地的 6800
ssh -L 6800:192.168.50.1:16800 -i wayne_key [email protected]
开机执行一段命令
crontab -e
@reboot sleep 10 && sh -c /opt/some-scripts.sh
ICMP Ping
出于安全考虑,某些 Linux 发行版会根据组 ID 限制发送 ICMP 数据报的权限。
2024-11-09T00:37:05Z WRN The user running cloudflared process has a GID (group ID) that is not within ping_group_range. You might need to add that user to a group within that range, or instead update the range to encompass a group the user is already in by modifying /proc/sys/net/ipv4/ping_group_range. Otherwise cloudflared will not be able to ping this network error="Group ID 0 is not between ping group 1 to 0"
2024-11-09T00:37:05Z WRN ICMP proxy feature is disabled error="cannot create ICMPv4 proxy: Group ID 0 is not between ping group 1 to 0 nor ICMPv6 proxy: socket: permission denied"
to fix that:
sudo vim /etc/sysctl.d/99-allow-ping.conf
net.ipv4.ping_group_range=0 10001
# 立即生效
sudo sysctl -p /etc/sysctl.d/99-allow-ping.conf
ref: https://opennms.discourse.group/t/how-to-allow-unprivileged-users-to-use-icmp-ping/1573
本地信任证书
# 复制证书到指定目录下
cp http_ca.crt /usr/local/share/ca-certificates
# 更新证书
update-ca-certificates