Compare commits

...

9 Commits

Author SHA1 Message Date
ae4e526ea2 update:openwrt 2025-07-26 11:29:30 +08:00
c72880f07c update:linux 2025-07-21 09:54:11 +08:00
defe396d05 update:openwrt 2025-07-20 14:35:09 +08:00
23db8005e0 update:openwrt 2025-07-15 15:48:52 +08:00
fd5d415988 update:openwrt 2025-07-15 09:57:46 +08:00
80d8c193cc update:openwrt 2025-07-14 22:58:19 +08:00
79c32ed073 update:arch 2025-07-14 19:28:09 +08:00
de0f8c7094 update:openwrt 2025-07-14 19:12:53 +08:00
d1436fdf3d update:openwrt 2025-07-14 14:34:19 +08:00
60 changed files with 615 additions and 4212 deletions

View File

@ -365,6 +365,63 @@ sudo powerprofilesctl set balanced
# 切换到“省电”模式
sudo powerprofilesctl set power-saver
```
## 其他性能优化
```
Profilesyncdaemon
将浏览器配置文件和缓存挂载到内存,退出时再写回磁盘:
sudo pacman -S profile-sync-daemon
systemctl --user enable --now psd.service
Systemdoomd
启用 systemd 自带的内存超载保护守护进程:
sudo pacman -S systemd-oomd
sudo systemctl enable --now systemd-oomd
Bpftune
加载 BPF 性能调优脚本网络、I/O、调度等
sudo pacman -S bpftune
sudo systemctl enable --now bpftune
AnanicyCpp
根据预设规则给游戏、多媒体和后台任务打优先级标签:
sudo pacman -S ananicy-cpp
sudo systemctl enable --now ananicy-cpp
```
## 常用命令
```
更新系统sudo pacman -Syu
重新安装所有软件包sudo pacman -Qq | sudo pacman -S -
Reset keyrings
sudo rm -rf /etc/pacman.d/gnupg
sudo pacman-key --init
sudo pacman-key --populate archlinux
移除数据库锁sudo rm -f /var/lib/pacman/db.lck
清理软件包缓存sudo pacman -Sc (或 -Scc 完全清空)
删除孤立软件包sudo pacman -Rns $(pacman -Qtdq)
Install Gaming packagessudo pacman -S steam wine lutris dxvk
排序镜像:
sudo pacman -S reflector
sudo reflector --latest 10 --sort rate --save /etc/pacman.d/mirrorlist
更改 DNS 服务器:编辑 /etc/systemd/resolved.conf 中的 DNS=1.1.1.1 8.8.8.8,然后 sudo systemctl restart systemd-resolved
```
## 在Arch Linux上安装Docker

View File

@ -22,8 +22,6 @@ tags = ["综合工程"]
- 8.VPN配置回家
- 9.实现透明代理。
> 剩余专业路由功能可以由ROS替代服务则跑在NAS系统上避免ALL in Boom
## 大致思路
- 使用高性能的X86主机管理拨号和 DHCP 内网的工作其他无线路由器桥接做APMesh组网
@ -52,14 +50,39 @@ tags = ["综合工程"]
## **如何得到一个openwrt系统**
- 可以在恩山论坛上使用他人编译好的现成的镜像,如"高大全","精品小包"等等,但存在一定风险;
- 可以使用[官方固件](https://downloads.openwrt.org/)下载得到一个最小化的系统再一步步添加自己要用的包注意需要根据你的uboot来选择注意固件名称是否带了uboot_mod!
- 可以使用[Openwrt 在线编译](https://firmware-selector.openwrt.org/)或[Openwrt.ai](https://openwrt.ai/?target=x86%2F64&id=generic)在线编译
1. 使用编译好的现成的镜像:
- 恩山论坛上的"高大全","精品小包"等等,但存在一定风险;
- 使用[官方固件](https://downloads.openwrt.org)下载得到一个最小化的系统再一步步添加自己要用的包注意需要根据你的uboot来选择注意固件名称是否带了uboot_mod!
2. 自行编译:
- [Openwrt.ai](https://openwrt.ai/?target=x86%2F64&id=generic)在线编译
一个固件;
- 可以使用GitHub action 云编译一个固件;
- 可以在本地linux环境中进行编译。
## **X86平台安装准备**
3. ImageBuilder
- 使用[Openwrt 官方ImageBuilder编译](https://firmware-selector.openwrt.org/)
- 自行下载对应的ImageBuilder包并构建.
## Toolchain/SDK/ImageBuilder
| 特性 | **Toolchain** | **SDK** | **Image Builder** |
| -------- | -------------------------------------- | ---------------------------------------------- | ------------------------------------------------------------------------------ |
| 包含内容 | 仅交叉编译工具链(二进制版 GCC、ld、musl、binutils | 完整交叉编译环境 + feeds 脚本 + package 目录,用于 `.ipk` 包开发 | 预编译的根文件系统 + opkg 包(无需源码编译),用于快速定制固件映像 |
| 典型用途 | 用于编译第三方程序或 CI如 hello-world 示例 | 编写和编译 `.ipk` 包,本地或自动化环境中离线开发 | 快速生成可刷写的固件镜像,集成所需包且无需完整源码树 |
| 解压即用 | ✅ | ✅ | ✅ |
| 在源码树中的作用 | `make toolchain/install` 自动识别并使用跳过编译流程 | 源码树中不会触发 SDK 安装,需要手动解压并进入其目录使用 | 不使用源码树,直接在 Image Builder 根目录下运行 `make image` 等命令 |
| 大小 | 较小(几十 MB | 较大(上百 MB | 中等(约数百 MB因包含预编译包 |
| 构建时间 | 几秒到几分钟 | 几分钟到十几分钟(取决于 feeds 大小) | 极快,可在几十秒到几分钟内完成定制镜像 |
| 兼容性 | 与对应 Release 完全匹配 | 与对应 Release 完全匹配 | 与对应 Release 完全匹配 |
| 使用难度 | 简单,只需解压并设置 PATH | 适中,需要理解 feeds 机制及包管理 | 最简单,适合终端用户或快速测试环境
## **X86平台安装流程**
0. 安装准备:
- 一个U盘与一台双网口物理机
@ -72,26 +95,22 @@ tags = ["综合工程"]
- [img 写盘工具](https://www.roadkil.net/program.php?ProgramID=12#google_vignette)
## **X86平台安装流程**
1.进入PE环境
1. 进入PE环境
- 打开微PE将其安装进U盘中安装完成后将 img 工具和 openwrt 包一起放进去;
- 将U盘插入目标主机进入 BIOS-boot 设置U盘优先启动各主板进入 BIOS 的按键不同,不确定的话建议都试一遍。
2.格式化硬盘并写盘
2. 格式化硬盘并写盘
- 进入PE环境中可以看到存在名为“分区助手”的软件打开它并将目标主机硬盘格式化注意不要分区不要分区不要设置文件系统否则后续可能无法编译点击左上角提交并执行
- 打开img写盘工具将openwrt包写入硬盘注意不要写进U盘里。
3.进入配置界面
3. 进入配置界面
- 重启系统并快速拔出U盘避免重新进入PE这时系统开始运行了。注意Esir固件是不跑码的无需担心。- 一个U盘与一台双网口物理机
- 当看到 `please press Enter to activate this console`这个提示的时候系统就安装完毕了。可使用 passwd 命令设置密码。软路由将自动获取IP地址随后我们在浏览器中打开该地址即可看到 Lucl 界面。
4.如果你使用官方固件,注意:
4. 如果你使用官方固件,注意:
- 硬盘空间有一部分没有被格式化可以手动格式化为ext4并挂载。
- 注意初始IP往往是192.168.1.1,如果和光猫冲突需要在网络-接口中更改。
- 基本系统主题比较简陋可以使用luci-theme-argon。
@ -100,14 +119,8 @@ tags = ["综合工程"]
uci commit luci
/etc/init.d/uhttpd restart``
然后重新访问 Web 界面,查看是否恢复正常。
- 一般要安装的包:
```
openssh-sftp-server
libpcap
luci-app-upnp
luci-app-ttyd
kmod-nft-xxx
```
## **X86平台本地编译完整openwrt**
- **系统版本Debian 11 或者 Ubuntu LTS**
@ -144,7 +157,7 @@ sudo apt clean
```
useradd -m openwrt # 新建一个名为 openwrt 的用户
```
> 不可以使用Root用户进行编译!!
> 不可以使用Root用户进行编译!!!
- **修改用户默认的 Shell**
```
@ -158,50 +171,66 @@ su openwrt
cd ~
```
- **拉取源码,这里用的是 LEDE 分支源码:**
- **拉取源码,这里用的是 ImmortalWrt 24.10 分支源码:**
```
git clone https://github.com/coolsnowwolf/lede
cd lede
git clone https://github.com/immortalwrt/immortalwrt.git
cd immortalwrt
```
- **选择分支**
如果你想要编译稳定版(stable),使用
```
git checkout xxx #例如git checkout v24.10.2
```
如果你想要编译最新版(snapshot),使用
```
git switch xxx #例如git switch openwrt-24.10
```
### 目录说明
- buildroot: OpenWrt 的核心目录,包含构建系统相关的文件。
- `feeds.conf.default`:定义软件包源的配置文件。
- `files/`:存放自定义文件,用于覆盖默认的 root 文件系统。
- target: 包含目标设备架构的配置和构建信息。
- `linux/`:包含与 Linux 内核相关的代码和配置。
- `generic/`:通用配置文件。
- `platform/`:针对具体设备平台的特定配置。
- package: 包含所有 OpenWrt 的软件包。
- `base/`:基本功能相关的软件包(如 BusyBox、opkg
- `kernel/`:与内核相关的补丁或模块。
- `network/`:网络工具和协议(如 DHCP、DNS
- `utils/`:各种实用工具(如编解码器、文件工具)。
- config: 存放默认配置文件,例如 `Config.in`,用于定义菜单项。
- scripts: 构建过程中使用的辅助脚本(如生成补丁、编译镜像)。
- toolchain: 构建工具链所需的文件,如编译器、链接器。
- tools: 一些构建系统依赖的额外工具(如 `autoconf`、`zlib`)。
- include: 存放 Makefile 的通用模板和其他全局定义文件。
- feeds: 包含通过 `feeds.conf` 配置的外部软件包源。
- documentation: 包含与 OpenWrt 项目相关的文档,如构建指南和开发文档。
| 名称 | 作用 |
| -------------------- | ---------------------------------------------------------------------- |
| `Makefile` | **整个 OpenWrt 构建系统的总入口点**(顶层 Makefile运行 `make menuconfig`、`make` 都依赖它 |
| `Config.in` | Kconfig 系统的入口配置文件,决定 `make menuconfig` 菜单显示什么选项 |
| `config/` | 构建系统的默认配置模板、菜单逻辑,和 `menuconfig` 相关 |
| `include/` | 包含通用 makefile 片段的目录(比如编译选项、函数定义) |
| `rules.mk` | 所有包编译通用规则都写在这里,`include $(TOPDIR)/rules.mk` 是常见语句 |
| `feeds.conf.default` | 定义 Feed 源(即可选的软件源),可用于管理外部包,比如 `luci`、`packages` |
| `feeds/` *(克隆后还没出现)* | `./scripts/feeds update -a` 后才会出现,用来保存外部 feed 的代码 |
| `package/` | OpenWrt 自带的核心包和第三方包(除 feeds 外的)都在这,结构是 `package/<分类>/<包名>` |
| `target/` | 支持的平台架构,比如 `x86`、`ramips`、`ath79`、`mediatek` 等都在里面 |
| `toolchain/` | 编译器链、glibc/musl、binutils、gcc 都在这里构建 |
| `tools/` | 构建工具目录,编译前工具如 `m4`、`autoconf`、`xz`、`patch` 等放在这 |
| `scripts/` | 脚本工具目录,如 `feeds` 管理、镜像合并、menuconfig 支持等 |
| `LICENSES/` | 所有包/组件的许可证归档 |
| `COPYING` | OpenWrt 的主许可证GPLv2 |
| `README.md` | 简要介绍如何开始使用 OpenWrt 的说明文档 |
| `BSDmakefile` | 为 BSD 系统一些兼容 makefileLinux 用户用不到 |
- **添加软件源,可自行添加软件源至 feeds.conf.default 文件也可以直接git添加需要的软件到lede目录下**
- **添加软件源,可自行添加软件源至 feeds.conf.default 文件**
```
vim feeds.conf.default
```
**常用源**
```
常用源
src-git kenzo https://github.com/kenzok8/openwrt-packages
src-git small https://github.com/kenzok8/small
src-git haibo https://github.com/haiibo/openwrt-packages
src-git liuran001 https://github.com/liuran001/openwrt-packages
```
**常用仓库**
```
src/gz kwrt_core https://dl.openwrt.ai/releases/24.10/targets/x86/64/6.6.83
src/gz kwrt_base https://dl.openwrt.ai/releases/24.10/packages/x86_64/base
src/gz kwrt_packages https://dl.openwrt.ai/releases/24.10/packages/x86_64/packages
src/gz kwrt_luci https://dl.openwrt.ai/releases/24.10/packages/x86_64/luci
src/gz kwrt_routing https://dl.openwrt.ai/releases/24.10/packages/x86_64/routing
src/gz kwrt_kiddin9 https://dl.openwrt.ai/releases/24.10/packages/x86_64/kiddin9
```
- **单独添加**(在更新并安装插件之前执行)例如:
@ -215,126 +244,129 @@ git clone https://github.com/chenmozhijin/turboacc.git
./scripts/feeds update -a
./scripts/feeds install -a
```
| `./scripts/feeds update -a` | 同步/更新 **外部 feed**packages、luci、routing 等)的 Git 仓库到本地 `feeds/` 目录 |
| ---------------------------- | ----------------------------------------------------------------- |
| `./scripts/feeds install -a` | 把你在 feeds 里选要用的包 **链接** 到源码树的 `package/feeds/`,让它们参与编译 |
- **自定义配置**
**修改默认IP为 10.0.0.2**
```
sed -i 's/192.168.1.1/192.168.2.1/g' package/base-files/files/bin/config_generate
```
#!/usr/bin/env bash
# diy-part2.sh — 在镜像生成时注入默认设置和定制 SSH 横幅及模型修复
**修改默认主机名**
```
sed -i '/uci commit system/i\uci set system.@system[0].hostname='OpenWrt'' package/lean/default-settings/files/zzz-default-settings
# 1. 默认 hostname可选
sed -i 's/=ImmortalWrt/=my-device/' package/base-files/files/bin/config_generate
# 2. 默认 IP 地址(可选)
sed -i 's/192.168.1.1/192.168.5.1/' package/base-files/files/bin/config_generate
# 3. 默认 root 密码(请换成安全密码)
HASH=$(openssl passwd -1 'yourpassword')
sed -i "s|root::0:0:99999|root:${HASH}:0:0:99999|" package/base-files/files/etc/shadow
# 4. 设置默认 LuCI 主题为 argon内置在 luci feeds
cat >>package/base-files/files/etc/uci-defaults/99_set_theme <<'EOF'
uci set luci.main.mediaurlbase=/luci-static/argon
uci commit luci
EOF
chmod +x package/base-files/files/etc/uci-defaults/99_set_theme
# 5. 默认加载 BBR 拥塞控制算法
mkdir -p package/base-files/files/etc/sysctl.d
cat >>package/base-files/files/etc/sysctl.d/99-bbr.conf <<'EOF'
net.core.default_qdisc=fq_codel
net.ipv4.tcp_congestion_control=bbr
EOF
# 检查BBR: sysctl net.ipv4.tcp_congestion_control
# 6. 将默认 shell 修改为 bash
sed -i "s|/bin/ash|/bin/bash|g" package/base-files/files/etc/passwd
# 请在 .config 中添加 TARGET_PACKAGES += bash
# 7. 自定义 SSH 登录横幅banner
mkdir -p package/base-files/files/etc
if [ -f "scripts/custom-files/banner.txt" ]; then
cp scripts/custom-files/banner.txt package/base-files/files/etc/banner
else
cat >package/base-files/files/etc/banner <<'EOF'
Welcome to MyDevice (ImmortalWrt)\n
EOF
fi
# 8. 自定义 LuCI 概览设备型号 🛠
# 通过 uci-defaults 脚本写入 /tmp/sysinfo/model
cat >>package/base-files/files/etc/uci-defaults/99-model-fix <<'EOF'
#!/bin/sh
# 设置自定义设备型号
mkdir -p /tmp/sysinfo
echo "Your Router Model" > /tmp/sysinfo/model
exit 0
EOF
chmod +x package/base-files/files/etc/uci-defaults/99-model-fix
```
**加入编译者信息**
```
sed -i "s/OpenWrt /smith build $(TZ=UTC-8 date "+%Y.%m.%d") @ OpenWrt /g" package/lean/default-settings/files/zzz-default-settings
```
- 执行 **make menuconfig** 命令进入编译菜单。
**修改默认主题**
```
sed -i "s/luci-theme-bootstrap/luci-theme-argon/g" feeds/luci/collections/luci/Makefile
```
执行 **make menuconfig** 命令进入编译菜单。
| 命令 | 功能描述 | 优点 | 适用场景 |
| ----------------- | ---------------------------------------------------- | -------------------- | -------------- |
| `make menuconfig` | 以 ncurses 界面交互式地浏览、修改当前 `.config` 与最新 Kconfig 中的所有选项 | 界面友好,支持搜索和分类;可直观调整 | 想手动挑选/调整配置时 |
| `make oldconfig` | 在命令行逐项对比 `.config` 与最新 Kconfig保留原值、提示新增项、删除废弃项 | 快速同步,只对新增选项发出提示;无需界面 | 自动化脚本或快速同步配置时 |
| `make defconfig` | 忽略当前 `.config`,直接加载架构/板级目录下的默认配置(`defconfig` | 一键生成官方/平台推荐的「干净」配置 | 想重置到官方默认或重新开始时 |
### **编译配置菜单说明(部分)**
```
Target System (Broadcom BCM27xx) # 选择处理器架构
└── Subtarget (BCM2711 boards (64 bit)) # 选择处理器
└── Target Profile (Raspberry Pi 4B/400/4CM (64bit)) # 预制配置文件
└── Target Images # 固件像设置
── ramdisk # 内存盘
├── Compression # 压缩等级 (none 表示压缩)
├── Root filesystem archives # 根文件系统存档类型
── cpio.gz
│ └── tar.gz
├── Root filesystem images # 根文件系统格式
│ ├── ext4 # 适用于大容量闪存
│ ├── squashfs # 适用于小容量闪存
│ └── Gzip images # Gzip 存档
└── Image Options
├── Kernel partition size # 内核分区大小
├── Root filesystem partition size # 跟文件系统分区大小
└── Make /var persistent # 持久化 /var
Target System (x86) # 选择目标平台
└── Subtarget (x86_64) # 选择 64-bit 子架构
└── Target Profile (Generic) # “Generic” 表示通用 x86_64 设备
└── Target Images # 固件像设置
── ramdisk # 可选内存盘镜像
├── Compression # 压缩类型(如 none 表示压缩
├── Root filesystem archives # 压缩存档cpio.gz 或 tar.gz
── Root filesystem images # 文件系统镜像ext4、squashfs、Gzip
└── Image Options # 镜像选项
├── Kernel partition size # 内核分配分区大小
├── Root filesystem partition size # 根文件系统分区大小
└── Make /var persistent # 是否保留 /var 持久化
Enable experimental features by default # 默认启用实验性功能
Global build settings # 全局编译设置
Advanced configuration options (for developers) # 高级选项(仅供开发者)
Build the OpenWrt Image Builder # 编译 OpenWrt 镜像编译器
Build the OpenWrt SDK # 编译 OpenWrt SDK
Package the OpenWrt-based Toolchain # 打包 OpenWrt 工具链
Image configuration # 镜像选项
Global build settings # 全局构建设置
Advanced configuration options (for developers) # 开发者高级选项
Build the OpenWrt Image Builder # 编译镜像构建器
Build the OpenWrt SDK # 构建交叉编译 SDK
Package the OpenWrtbased Toolchain # 打包 OpenWrt 工具链
Image configuration # 镜像总体配置页面
Base system # 基本组件
Administration # 管理工具
Boot Loaders # 引导程序
Development # 开发者工具
Extra packages # 额外包
Firmware # 固件工具
Fonts # 字体
Kernel modules # 内核模块
Languages # 额外的语言 (Python3, PHP, NodeJS 等)
Libraries # 系统库
LuCI # LuCI 插件(一般只需修改应用和主题)
Base system # 系统基础组件
Administration # 管理工具(如 ssh、管理员脚本
Boot Loaders # 引导程序(如 grub、syslinux
Development # 编译/调试辅助工具
Extra packages # 附加应用(如 wget、curl
Firmware # 固件工具
Fonts # 字体支持
Kernel modules # x86 内核模块驱动
Languages # 编程语言包(如 Python3、Node.js
Libraries # 系统库依赖
LuCI # Web UI 前端
└── Collections
└── Modules
└── Applications
└── Themes
└── Protocols
└── Libraries
└── default-settings # 默认选项(自动配置语言包)
└── defaultsettings
Mail # 邮件
Multimedia # 媒体
Network # 网络相关
Sound # 音频
Utilities # 各类实用软件(比如 VIM
Xorg
```
Mail # 邮件客户端
Multimedia # 媒体工具(如 ffmpeg
Network # 网络功能(如 openvpn、wireguard
Sound # 音频相关软件
Utilities # 常用实用程序(如 vim、htop
Xorg # 桌面环境支持X11 图形系统)
### **菜单选项说明**
**选择 CPU 类型**
```
Target System (x86) --> # 软路由选择 x86硬路由根据型号厂家自行选择
Subtarget (x86_64) --> # CPU 子选项
Target Profile (Generic x86/64) --> # 厂家具体型号
```
**设置镜像编译的格式squashfsext4**
```
Target Images --> # 默认 squashfs
```
**添加较多插件时为了避免空间不足建议修改下面两项默认大小x86/64**
```
Target Images --> (16) Kernel partition size (in MB) # 默认是16建议修改为256
```
**开启 IPv6 支持**
```
Extra packages --> ipv6helper选定这个后下面几项会自动选择
```
**开启适用于 VMware 的 VMware Tools**
```
Utilities --> open-vm-tools
Utilities --> open-vm-tools-fuse
```
**选择插件**
```
LuCI --> Applications # 根据需要选择,* 代表编入固件M 表示编译成模块或者IPK包为空表示不编译
```
**选择主题**
```
LuCI --> Themes # 选择喜欢的主题,可以选多个
```
配置完成后使用编译菜单底部的 Save 保存,然后退出菜单 Exit开始下载软件包
- **预下载编译所需的软件包**
```
@ -349,115 +381,76 @@ find dl -size -1024c -exec ls -l {} \;
```
find dl -size -1024c -exec rm -f {} \;
```
最后编译固件,编译完成后输出路径是 **bin/targets**,默认密码是 **password**.
- **编译固件(-j 后面是线程数,首次编译推荐用单线程)**
- **最后编译固件(-j 后面是线程数,首次编译推荐用单线程)编译完成后输出路径是bin/targets.**
```
make V=s -j1
或者使用 make world -j1 V=s 2>&1 | tee world_debug.log
如果报错可查看 grep -E "(error|fatal|Cannot install package)" world_debug.log -n
```
- **二次编译**
| make层级 | 目录示例 | 说明 |
| -------- | ---------------------------- | ---------------- |
| make\[1] | 顶层 Makefile | 解析依赖,调度模块 |
| make\[2] | `tools/` | 编译辅助工具 |
| make\[2] | `toolchain/` | 编译交叉编译工具链 |
| make\[2] | `target/linux/` | 编译内核及设备树 |
| make\[2] | `package/` | 进入包管理,调度包构建 |
| make\[3] | `package/libs/libc` | 单个包的 Makefile |
| make\[3] | `package/utils/busybox` | 单个包的 Makefile |
| make\[4] | `build_dir/target-...` | 包源码目录,运行源码的 make |
| make\[4] | `build_dir/target-linux-...` | 内核源码目录 |
拉取最新 OpenWrt 源码和更新 feeds 源中的软件包源码
## 二次编译
| 命令 | 清除内容 | 保留内容 | 适用场景 |
| ---------------- | ------------------------------------------------------------- | --------------------------------------- | ---------------------------------------------- |
| `make clean` | 删除 `bin/` 镜像、`build_dir/` 编译产物 | `.config`、`staging_dir/`、`toolchain/` 等 | 小修改后重建镜像,速度快,常用于增量编译。|
| `make dirclean` | 和 `make clean` 一样,还删除 `staging_dir/`、`toolchain/`、`logs` | `.config` | 彻底重建交叉编译环境,适合更改编译配置如 `.config`、feeds 等。 |
| `make distclean` | 删除 `make dirclean` 的所有内容 + feeds 下载文件 + `.config`、patch 等所有状态 | 只有源码目录保持不变 | 专用于回到一个“零配置、重做一切”的状态,完全从头开始构建。 |
恢复所有修改(包括未跟踪文件):
```
cd lede
git pull
./scripts/feeds update -a
./scripts/feeds install -a
```
清除旧的编译产物和目录(可选)
```
make clean
```
- 源码有大规模更新或者内核更新后执行,以保证编译质量;此操作会删除 /bin 和 /build_dir 目录中的文件
```
make dirclean
```
> 更换架构编译前必须执行
> 此操作会删除 /bin 和 /build_dir 目录的中的文件make clean以及 /staging_dir、/toolchain、/tmp 和 /logs 中的文件
同首次编译,多线程编译失败后自动进入单线程编译,失败则输出详细日志
```
make defconfig
make download -j8
find dl -size -1024c -exec ls -l {} \;
make -j$(nproc) || make -j1 || make -j1 V=s
```
### 如果需要重新配置
```
rm -rf ./tmp && rm -rf .config # 清除临时文件和编译配置文件
make menuconfig
make download -j8
find dl -size -1024c -exec ls -l {} \;
make -j$(nproc) || make -j1 || make -j1 V=s
git clean -fd
git restore --source=v24.10.2 --staged --worktree .
```
## Dwrt 方案
| 作用 | 组件 |
| ----------- | -------------------- |
| 主题 | argon |
| Shell | bash |
| SSH 服务器 | dropbear |
| Web 服务器 | uhttpd |
| DNS/DHCP 服务 | dnsmasqfull |
| 加密库 | openssl |
| 压缩算法 | zram+zstd |
| 拥塞控制 | bbr |
| 防火墙 | nftables + iptables |
| 调度模块 | BPF + kmod-sched-xxx |
| 时间同步 | ntpd-full |
| 文本编辑 | vim-fullvim-runtime |
| 编译优化 | LTO + O3 |
## Arm平台安装OpenWrt
相比X86平台arm架构的设备兼容性不高不能随便找一个包就能安装。以下是一般步骤
- 首先得知道你的设备的CPU比如ipq40XX系列然后在对应的[仓库](https://archive.openwrt.org/releases/23.05.4/targets/)查看并下载包体。
- 当然也可以在[这里](https://firmware-selector.openwrt.org/)直接下载相关型号对应的固件,其中 Sysupgrade 映像是用来更新现有运行 OpenWrt 的设备,使用 Factory 映像在首次刷机时刷入。
- 随后开启Telnet或者SSH或者TTL串口连接到路由器将对应的Uboot刷入如果没有适配的包就无法刷openwrt。
- 通过Uboot的网络界面刷入Factory包随后就可以在后台如192.168.1.1进入openwrt的管理界面。
## 在ubuntu上单独编译openwrt的ipk包
这里以ubuntu环境为例我们假设你有一台虚拟机或者WSL。
> ``注意编译不能使用Root用户``
**随后安装编译依赖的各个包:**
要启用的软件包
**base**
```
sudo apt update
sudo apt install -y \
ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
bzip2 ccache clang cmake cpio curl device-tree-compiler diffutils diffstat findutils flex gawk \
gcc-multilib g++-multilib git gettext gperf grep haveged help2man intltool \
libelf-dev libfuse-dev libgmp3-dev libgl1-mesa-dev libgraphene-1.0-dev libglib2.0-dev \
libltdl-dev libmpc-dev libmpfr-dev libncurses-dev libpython3-dev libreadline-dev libssl-dev \
libtool lrzsz make mesa-common-dev msmtp ninja-build p7zip p7zip-full patch pkgconf \
perl python-is-python3 python3 python3-dev python3-distutils-extra python3-pip python3-pyelftools \
python3-setuptools qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs \
upx-ucl unzip vim wget gnu-which xmlto xxd zlib1g-dev genisoimage llvm llvm-runtime docutils-common \
ecj fastjar java-wrappers libeclipse-jdt-core-java libgnutls-dane0t64 \
libgnutls-openssl27t64 libgnutls28-dev libidn2-dev libp11-kit-dev libtasn1-6-dev libtasn1-doc \
libunbound8 libyaml-dev lld lld-18 nettle-dev python3-docutils python3-ply python3-roman re2c
autocore base-files bash block-mount ca-bundle coremark curl dnsmasq-full dropbear ds-lite e2fsprogs fdisk firewall4 fstools grub2-bios-setup htop kmod-8139cp kmod-8139too kmod-amazon-ena kmod-amd-xgbe kmod-atlantic kmod-bnx2 kmod-bnx2x kmod-button-hotplug kmod-drm-amdgpu kmod-drm-i915 kmod-dwmac-intel kmod-e1000 kmod-e1000e kmod-forcedeth kmod-fs-f2fs kmod-fs-vfat kmod-i40e kmod-iavf kmod-igb kmod-igbvf kmod-igc kmod-ixgbe kmod-ixgbevf kmod-lib-zstd kmod-mlx4-core kmod-mlx5-core kmod-mmc kmod-pcnet32 kmod-phy-broadcom kmod-r8101 kmod-r8125 kmod-r8126 kmod-r8168 kmod-sdhci kmod-tcp-bbr kmod-tg3 kmod-tulip kmod-usb-hid kmod-vmxnet3 libc libgcc libustream-mbedtls lm-sensors-detect logd lsblk luci-app-fan luci-app-filemanager luci-app-firewall luci-app-log-viewer luci-app-package-manager luci-app-syscontrol luci-app-upnp luci-base luci-compat luci-lib-fs luci-lib-ipkg mkf2fs mtd nano netifd odhcp6c odhcpd-ipv6only openssh-sftp-server opkg partx-utils pciutils ppp ppp-mod-pppoe resolveip swconfig uci uclient-fetch urandom-seed urngd usbutils wget-ssl zram-swap
```
随后下载我们**刷入openwrt的对应的SDK包**,如
**cli**
```
btop iperf3 tcpdump
```
**luci**
```
luci-app-argon luci-app-upnp luci-app-ttyd luci-app-eqosplus luci-app-timecontrol luci-app-parentcontrol luci-app-homeproxy luci-app-daed
```
## 单独编译openwrt的ipk包
```
git clone https://github.com/immortalwrt/immortalwrt.git
```
**下载和安装仓库信息**
```
./scripts/feeds update -a
./scripts/feeds install -a
```
**下载并选中我们需要编译的包,这里以inyn为例**
**其他步骤同上,下载并选中我们需要编译的包,这里以inyn为例**
```
git clone https://github.com/diredocks/openwrt-inyn.git ./package/inyn
make menuconfig
@ -471,30 +464,6 @@ make package/inyn/compile V=s
## 如果不行则需要先编译工具链,即为 make j=4 j为CPU核数
```
## Github Actions 编译OpenWrt
Github为我们提供了免费的E5主机用来编译。
- 首先Fork[这个仓库](https://github.com/hugcabbage/shared-lede),可以看到有许多现成的配置,在**顶栏actions里面可以直接启动一个Workflow**来编译。
- 大体架构是选择**源码 -- 机型 -- 版本 -- 插件/主题 -- 配置IP/密码/Hostname/编译者)**由一个config文件管理这个文件在前面也提到过可以在本地生成并上传
- 想要什么插件可以直接git clone过来原仓库如果你想要添加其他架构和设备这里**使用templet里面的init.toml来创建**,按照类似的格式填好;
- 在actions里面运行produce注意这需要**GitHub Personal Access Token (PAT)**;如果没有,必须先添加:
- 打开 GitHub进入[GitHub Developer Settings](https://github.com/settings/tokens)点击 “Generate new token (classic)”,**勾选所需权限**(最关键的是 repo 和 workflow✅ repo所有子权限✅ workflow✅ read:packages **Token 过期时间**:选择 “No expiration”不过期否则过期后需要重新生成。**点击** “Generate token”
**复制 Token**(只显示一次,一定要保存好!)
- 然后添加 **PRODUCE_DEVICE** 到 **GitHub Secrets**
首先进入你的 GitHub 仓库,``依次进入Settings设置-
Secrets and variables-Actions-New repository secret
名称为PRODUCE_DEVICE``,值为粘贴刚刚复制的 GitHub Token点击 “Add secret” 完成添加。
- 随后``在actions里面运行produce``,完成后即可出现新架构的编译按钮.
## 常用命令:
```
# 更新软件列表
@ -505,8 +474,19 @@ opkg list-upgradable | grep luci- | cut -f 1 -d ' ' | xargs opkg upgrade
# 如果要更新所有软件,包括 OpenWRT 内核、固件等
opkg list-upgradable | cut -f 1 -d ' ' | xargs opkg upgrade
# 固件版本号
vim /etc/os-release
# 脚本&脚注
vim /etc/openwrt_release
# ASCII字符画
vim /etc/banner
# 登录脚本显示
vim /etc/profile
```
> 新版本的openwrt24.10已经改用APK包管理器。
## 常用科学插件
@ -516,6 +496,7 @@ opkg list-upgradable | cut -f 1 -d ' ' | xargs opkg upgrade
| **UI 管理** | ✅Web UI、桌面端 GUI | ✅OpenClash Web UI | ✅Luci Web UI | ❌Shell 终端管理) |
| **适用场景** | 性能较好,但分流设置复杂 | 适用于clash系,机场首选 | 操作简单,分流完善,但对路由器性能要求较高 | 没有UI界面性能最好支持完善可以通过clashapi安装UI |
## 校园网多设备防检测
**常见检测方法**

View File

@ -1,100 +0,0 @@
+++
title = "Linux之旅(1):构成与发行版"
date = 2023-07-20
[taxonomies]
tags = ["Linux"]
+++
前言 Linux 作为一款强大、灵活且免费的操作系统吸引了越来越多的用户。然而对于初学者来说Linux 可能显得有些陌生,甚至有些令人望而生畏。本文旨在为那些刚踏入 Linux 世界的新手提供一份指南帮助他们更好地了解、使用这个令人着迷的操作系统。我们将探讨Linux的基本概念解释为何选择Linux深入剖析其主要构成要素以及不同的发行版之间的差异。
<!-- more -->
## 一.什么是Linux
Linux 是一种开源的类 UNIX 操作系统内核。它由芬兰的 Linus Torvalds 于1991年开始开发是一个自由、免费的操作系统。Linux 内核是操作系统的核心,负责管理硬件资源,并提供各种系统服务。与 Windows 和 macOS 等操作系统不同Linux 的源代码对所有人开放,任何人都可以查看、修改和重新分发。这使得 Linux 具有极高的自由度和可定制性用户可以根据自己的需求和偏好来定制操作系统。Linux 广泛应用于各种设备,包括个人计算机、服务器、手机、嵌入式系统等,是一个功能强大且灵活多样的操作系统。
## 二.为什么要用Linux
1. **开源免费**Linux 是完全开源的,用户可以免费使用和修改源代码。
2. **稳定性和安全性**Linux 系统以其稳定性和安全性而闻名,适合长时间运行的服务。
3. **灵活性和可定制性**:用户可以根据需要定制 Linux 系统。
4. **广泛的软件支持**:有大量的开源软件可供选择,满足不同需求。
> Liunx可以用来玩游戏吗
实际上著名的 Steam Deck 的系统就是基于Arch linux 的。对于个人使用而言现在有不少原生支持linux 的游戏也可以使用Wine来运行Windows下的游戏。
>Linux上软件会不会太少
参见 [常用跨平台开源软件](https://blog.dich.ink/open-source-software)一文在社区的努力下如今软件生态已经非常丰富你也可以使用如Flatpak等商店安装软件或者直接使用Wine。如果有不得不在Windows下使用的软件可以装双系统。
## 三.Linux的主要构成
Linux操作系统主要由以下几个部分组成
1. **内核**操作系统的核心负责管理系统资源。如Zen内核LTS内核等。
2. **Shell**命令行界面用户通过它与系统交互如Bash,Zsh等。
3. **图形用户界面GUI**提供图形化操作界面如GNOME、KDE、XFCE等。
4. **文件系统**如ext4、Btrfs等用于组织和管理磁盘上的文件。
5. **系统库**:为应用程序提供运行时支持。
6. **应用程序**用户可以直接使用的软件如文本编辑器、网页浏览器等。其中也有著名的GNU工具如Vim,GCC等。
## 四.选择Linux发行版
从上文可以发现选择Linux发行版实际上是在选择 **内核/包管理器/图形界面** 等组件的排列组合。其中最主要的因素是包管理器。
Linux有许多不同的发行版但大致可以分为几个系
**Debian系**
DebianDebian以稳定性安全性和轻量级著称适合用于服务器和桌面环境。我们常说的Ubuntu就是基于Debian的发行版注重用户友好性和易用性。它提供了多种桌面环境选择以及许多现成的软件包。
```
APTAdvanced Package Tool是Debian系发行版的主要包管理器。它使用命令行工具如apt-get、aptitude等来管理软件包。
```
**Red Hat系**
- Red Hat Enterprise LinuxRHELRHEL是一款商业发行版专注于企业级应用和支持。它提供了长期支持和专业技术支持服务适用于企业级服务器和工作站。
- CentOSCentOS是基于RHEL源代码编译而成的免费发行版与RHEL兼容并提供类似的功能和性能。它也提供了长期支持版本和稳定性较高的特点。
- FedoraFedora是由Red Hat支持的社区驱动的发行版注重提供最新的软件特性和技术。它适用于开发者和技术爱好者提供了稳定的发布周期和丰富的软件包。
```
YUMYellowdog Updater, Modified是Red Hat系发行版的主要包管理器。最近的版本也开始采用DNFDandified YUM
```
**Arch系**
Arch LinuxArch Linux是一个简洁、轻量级且灵活的发行版注重简洁性和滚动更新。它采用“滚动发布”的方式用户可以通过自定义安装来构建自己的系统适合有一定Linux经验的用户。
```
PacmanPackage Manager是Arch Linux的主要包管理器。它使用简洁的命令来管理软件包如pacman -S安装软件包、pacman -Syu更新系统等。
```
**Gentoo系**
GentooGentoo是一个源码驱动的发行版用户可以通过源代码自定义编译软件包以满足自己的需求。它注重性能和灵活性适合高级用户和技术爱好者。
```
Portage是Gentoo的包管理器它是一个源代码驱动的包管理器允许用户从源代码构建和安装软件包。
```
除了以上列举的包管理器外还有其他一些较为特殊的包管理器如Slackware系的pkgtool、SUSE系的zypper等。
对于个人使用而言我个人建议新手使用Ubuntu,有比较易用的界面和完善的资料参考如果你是一个系统极客可以使用Arch linux 或者 NixOS。
## 五.个人日常使用需要注意什么?
1. **学习命令行**命令行是Linux的强大工具学习基本命令可以提高效率。
2. **选择合适的发行版**:根据个人需求和技术水平选择适合的发行版。
3. **系统备份**:定期备份重要数据,以防意外丢失。
4. **软件管理**:了解如何安装、更新和卸载软件。
5. **安全设置**:设置强密码,定期更新系统以修复安全漏洞。
6. **社区参与**Linux社区非常活跃遇到问题可以寻求社区帮助。
7. **硬件兼容性**检查你的硬件是否与选择的Linux发行版兼容。
8. **驱动程序**:确保你的硬件设备有可用的驱动程序,以避免兼容性问题。

View File

@ -1,127 +0,0 @@
+++
title = "Linux之旅(2):FHS与目录结构"
date = 2023-07-21
[taxonomies]
tags = ["Linux"]
+++
前言 在Linux世界中Filesystem Hierarchy StandardFHS是一座引导我们进入系统核心的桥梁它定义了Linux系统中目录结构的规范与作用为我们提供了一张清晰的地图指引我们轻松管理和理解系统。本文将深入探讨FHS规范与Linux系统目录结构解释各个目录的用途与功能帮助我们更好地理解和利用Linux系统。
<!-- more -->
## 一.认识FHS
FHS是Filesystem Hierarchy Standard文件系统层次结构标准的缩写。它是一个定义了Linux系统中目录结构和各个目录作用的规范。FHS规定了Linux系统中各个目录的用途和预期内容以便确保不同Linux发行版之间的兼容性并使得用户能够更轻松地理解和管理系统。
FHS规范最初由Linux基金会Linux Foundation和自由软件基金会Free Software Foundation共同发布并经过多次修订和更新。该规范不仅对Linux系统本身有用也适用于其他类UNIX操作系统。
FHS规范定义了一些基本的目录如/bin、/boot、/dev等并规定了每个目录的作用和预期内容。这样做有助于系统管理员和开发人员更好地组织和管理文件系统并使得用户能够更轻松地找到所需的文件和数据。
## 二.常见目录结构
在刚刚由Windows切换至Linux时往往会对目录感到不解不知道安装的软件放在哪个目录之下
以下是对Linux系统目录结构的详细说明
- **/(根目录)**
根目录是整个文件系统的起点包含了系统中所有其他目录和文件。在Linux系统中根目录被表示为/。
- **/bin二进制文件**
/bin目录存放着一些最基本的系统命令如ls、cp、mv等这些命令通常被所有用户使用。
- **/boot引导文件**
/boot目录存放着启动Linux系统所需的引导文件如内核映像vmlinuz、引导加载程序boot loader配置文件如GRUB配置文件等。
- **/dev设备文件**
/dev目录包含了系统中所有设备的特殊文件如硬盘、键盘、鼠标等。在Linux中一切皆文件设备被抽象为文件通过/dev目录中的特殊文件来表示。
- **/etc配置文件**
/etc目录包含了系统的配置文件如网络配置、用户账户信息、服务配置等。这些配置文件通常以纯文本的形式存在可以由系统管理员进行编辑和修改。
- **/home用户主目录**
/home目录是系统中所有普通用户的主目录所在地每个用户通常都有一个对应的子目录用于存放用户的个人文件和数据。
- **/lib库文件**
/lib目录存放着系统所需的共享库文件这些库文件包含了一些程序运行所需的函数和数据为程序提供了基本的支持。
- **/mnt挂载点**
/mnt目录用于挂载临时文件系统如光盘、移动硬盘等。系统管理员可以将其他设备或文件系统挂载到/mnt目录下以便访问其中的文件和数据。
- **/opt可选软件包**
/opt目录用于存放一些可选的软件包和应用程序这些软件包通常不属于Linux发行版的默认安装范围但可以被用户自行安装和管理。
- **/proc进程信息**
/proc目录是一个虚拟的文件系统包含了系统运行时的各种进程信息和系统状态信息。用户可以通过读取/proc目录中的特殊文件来获取系统信息。
- **/sbin系统命令**
/sbin目录存放着一些系统管理和维护命令这些命令通常只能由超级用户root执行用于系统的管理和维护。
- **/srv服务数据**
/srv目录用于存放一些服务相关的数据文件如Web服务器的网站数据、FTP服务器的文件等。每个服务通常都会有一个对应的子目录。
- **/tmp临时文件**
/tmp目录用于存放临时文件和临时数据这些文件通常在系统重启时会被删除。任何用户都可以在/tmp目录下创建临时文件。
- **/usr用户程序**
/usr目录包含了系统中大部分用户可用的程序和文件如用户应用程序、共享库文件、文档等。它通常是系统的二级目录类似于Windows系统中的Program Files目录。
- **/var可变数据**
/var目录用于存放系统运行时产生的可变数据如日志文件、邮件、缓存文件等。这些数据通常会随着系统的运行而不断变化。
> 注意NixOS不符合FHS标准
## 三.分区大小
对各个分区进行容量分配时,需要根据系统的实际需求和用途来进行规划。一般而言在安装引导时可以选择让程序自动分区。
- **根目录(/**根目录是整个文件系统的起点通常会分配较大的空间以确保系统和应用程序有足够的空间运行。建议分配至少20GB的空间给根目录。
- **/home目录**/home目录用于存放用户的个人文件和数据因此需要根据用户数量和存储需求来进行容量分配。一般情况下建议为每个用户分配至少10GB的空间。
- **/var目录**/var目录用于存放系统运行时产生的可变数据如日志文件、邮件、缓存文件等。根据系统的运行情况和日志文件的大小来进行容量分配一般建议分配10-20GB的空间。
- **/tmp目录**/tmp目录用于存放临时文件和临时数据通常不需要分配太大的空间。建议分配至少1-2GB的空间给/tmp目录。
- **/boot目录**/boot目录存放着启动Linux系统所需的引导文件通常只需要分配几百MB的空间即可。
- **Swap分区**Swap分区是一种虚拟内存用于暂时存放不常用的内存数据。当系统内存不足时Linux会将一部分内存数据移动到Swap分区中以避免内存耗尽导致系统崩溃。Swap分区的大小通常与系统内存大小有关一般建议为系统内存的1.5-2倍。例如如果系统内存为4GB则建议设置Swap分区大小为6-8GB。
> 这里特别讲讲Swap分区
Swap分区可以通过以下几种方式实现
- 交换分区Swap Partition创建一个独立的交换分区通常是一个专门的分区用于存放Swap数据。
- 交换文件Swap File创建一个专门的文件用于存放Swap数据而不是创建独立的分区。这种方式更加灵活可以根据需要动态调整Swap的大小。
- Swap大小Swap的大小应该根据系统的内存大小和使用情况来确定一般建议为系统内存的1.5-2倍。
- Swap分区/文件的位置Swap分区/文件应该位于较快的存储介质上,以确保交换操作的效率。
Swap的优先级如果同时存在多个Swap分区/文件可以通过设置优先级来指定系统使用的Swap空间。
## 四.将 `home` 目录下的文件夹改为英文
可以使用 `xdg-user-dirs-update` 工具来更新用户目录为英文版本。你可以按照以下步骤进行:
1. **编辑用户目录配置文件**
打开或创建 `~/.config/user-dirs.dirs` 文件,用文本编辑器编辑它:
```bash
nano ~/.config/user-dirs.dirs
```
2. **将目录名称更改为英文**
在该文件中,你可以看到类似以下的条目:
```bash
XDG_DESKTOP_DIR="$HOME/桌面"
XDG_DOWNLOAD_DIR="$HOME/下载"
XDG_DOCUMENTS_DIR="$HOME/文档"
XDG_MUSIC_DIR="$HOME/音乐"
XDG_PICTURES_DIR="$HOME/图片"
XDG_VIDEOS_DIR="$HOME/视频"
```
将这些路径改为英文,例如:
```bash
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"
```
3. **重命名现有的文件夹**
手动将 `home` 目录下的文件夹重命名为英文版本:
```bash
mv ~/桌面 ~/Desktop
mv ~/下载 ~/Downloads
mv ~/文档 ~/Documents
mv ~/音乐 ~/Music
mv ~/图片 ~/Pictures
mv ~/视频 ~/Videos
```
4. **应用更改**
完成以上操作后,运行以下命令应用新配置:
```bash
xdg-user-dirs-update
```
这样,`home` 目录下的文件夹就会改为英文,并且系统也会正确识别这些新的目录路径。

View File

@ -1,176 +0,0 @@
+++
title = "Linux之旅(3):内核/shell/包管理/文件系统/桌面环境"
date = 2023-07-22
[taxonomies]
tags = ["Linux"]
+++
前言 在Linux世界中内核/shell/包管理/文件系统构成了Linux系统的核心它们相互配合共同构建了一个强大而稳定的操作环境。本文将深入探讨这些关键组成部分解释它们的作用和原理帮助读者更好地理解Linux系统的运作机制。
<!-- more -->
## **一.Linux内核**
有许多不同的版本每个版本都包含了一系列的功能改进、bug修复和性能优化。在Linux发行版中通常会使用某个特定版本的Linux内核或者在需要时进行升级。以下是一些常见的Linux内核及其主要特点
**Zen内核**
- Zen内核是Linux内核的一个变体旨在提供更好的性能和响应性。它通常包含了一些特定的调度程序和调优参数以提高系统的负载均衡和响应速度。Zen内核也可能包含一些来自其他内核变体的功能和补丁以进一步优化性能。
**LTS内核**
- LTSLong-Term Support内核是一种长期支持的内核版本它会获得更长时间的更新和维护。LTS内核通常会选择一些相对稳定和经过充分测试的功能并对其进行长期支持以确保系统的稳定性和安全性。
**Real-Time内核**
- Real-Time内核是一种专门针对实时应用场景进行优化的内核变体。它通常包含了一些实时调度算法和机制以确保系统能够及时响应各种事件并满足实时性要求。Real-Time内核适用于一些对实时性要求较高的应用如工业控制、机器人控制等领域。
**Hardened内核**
- Hardened内核是一种针对安全性进行优化的内核变体。它通常包含了一些安全增强功能和补丁以提高系统的安全性和抵御攻击的能力。Hardened内核适用于一些对安全性要求较高的应用如服务器、云计算等场景。
**XanMod内核**
- XanMod内核是一个基于Linux内核的自定义内核旨在提供更好的响应性和性能。它包含了一些针对桌面和工作站系统优化的功能和补丁如MuQSS调度器、BFQ I/O调度器等以提高系统的响应速度和性能稳定性。XanMod内核还支持一些实时性应用如音视频处理等适用于对系统响应速度要求较高的用户。
**CachyOS内核**
- CachyOS内核是一个专门针对缓存优化的Linux内核变体。它包含了一些针对缓存系统优化的功能和调整以提高系统的缓存性能和数据访问速度。CachyOS内核通常适用于需要高性能缓存的应用场景如数据库服务器、Web服务器等。
这些内核变体针对不同的需求和使用场景进行了优化可以根据具体的应用需求来选择合适的内核版本。例如如果您需要更好的性能和响应性可以选择Zen内核如果您需要长期支持和稳定性可以选择LTS内核如果您需要实时性能可以选择Real-Time内核如果您需要更高的安全性可以选择Hardened内核。
## **二.Linux Shell**
在Linux系统中有许多不同的Shell命令行解释器每种Shell都有自己的特点和用途。以下是一些常见的Linux Shell及其主要特点
**BashBourne Again Shell**
- Bash是Linux系统中最常用的Shell之一也是默认的命令行解释器。它是Bourne Shell的增强版提供了丰富的功能和扩展性包括命令历史、命令补全、作业控制等。Bash具有良好的兼容性和易用性适用于日常的系统管理和脚本编程。
**ZshZ Shell**
- Zsh是一种功能强大的Shell提供了丰富的功能和扩展性如更强大的命令补全、自动纠正拼写错误、主题和插件系统等。Zsh具有良好的可定制性和用户体验适用于高级用户和程序员。
**FishFriendly Interactive Shell**
- Fish是一种用户友好的交互式Shell提供了直观的命令提示和自动补全功能以及丰富的语法高亮和命令提示信息。Fish具有良好的用户体验和易用性适用于初学者和普通用户。
**DashDebian Almquist Shell**
- Dash是一种轻量级的Shell专门设计用于系统启动过程和脚本执行。Dash具有较高的执行速度和较低的内存占用适用于系统启动脚本和简单的脚本编程。
Bash是最常用的Shell之一具有良好的兼容性和功能性Zsh提供了更多的高级特性和定制选项适用于高级用户和程序员Fish具有友好的交互式体验和直观的用户界面适用于初学者和普通用户Dash则是一个轻量级的Shell专门用于系统启动过程和简单的脚本编程。用户可以根据自己的需求和偏好选择合适的Shell。
## **三.Linux包管理器**
在Linux系统中有几种常见的包管理器它们各自管理着不同的发行版具有不同的特点和用途。以下是一些常见的Linux包管理器及其主要特点
**APTAdvanced Package Tool**
- APT是Debian系如Debian、Ubuntu中最常用的包管理器之一。它使用基于命令行的工具`apt-get``apt-cache`等来安装、升级和删除软件包。APT还支持依赖关系的自动解决使得软件包的安装和管理变得更加方便。
**YUMYellowdog Updater, Modified**
- YUM是Red Hat系如CentOS、Fedora中常用的包管理器之一。它使用基于命令行的工具`yum`来管理软件包。YUM具有良好的依赖关系解决能力和事务处理功能使得系统升级和软件包管理变得更加简单和可靠。
**DNFDandified YUM**
- DNF是YUM的下一代版本逐渐取代了YUM在Fedora和RHEL系列中的地位。DNF具有更快的包查询和事务处理能力以及更友好的用户界面。它是未来主流的包管理器之一。
**PacmanPackage Manager**
- Pacman是Arch Linux中常用的包管理器也被一些其他发行版如Manjaro采用。Pacman使用简洁的命令`pacman -S`安装软件包、`pacman -Syu`更新系统等来管理软件包。Pacman具有简单、直观的界面和快速的操作速度适用于对系统有一定了解的用户。
**zypper**
- zypper是openSUSE中常用的包管理器它使用基于命令行的工具`zypper install``zypper update`等来管理软件包。zypper具有良好的依赖关系解决能力和事务处理功能使得系统升级和软件包管理变得更加简单和可靠。
**dpkg**
- dpkg是Debian系如Debian、Ubuntu中的低级别软件包管理工具用于直接管理软件包的安装、升级和删除。它提供了一系列的命令`dpkg -i`安装软件包、`dpkg -r`删除软件包等。
**RPMRPM Package Manager**
- RPM是Red Hat系如CentOS、Fedora中的低级别软件包管理工具用于直接管理软件包的安装、升级和删除。它提供了一系列的命令`rpm -i`安装软件包、`rpm -e`删除软件包等。
**Portage**
- Portage是Gentoo Linux中的包管理器它使用源代码进行软件包的安装和管理。Portage具有高度定制化和灵活性允许用户根据需要自定义软件包的编译参数和依赖关系。
**Snap**
- Snap是一种跨发行版的软件包格式和包管理器允许用户在不同的Linux发行版上安装和管理软件包。Snap具有自包含性和隔离性使得软件包的安装和升级变得更加简单和安全。
**Flatpak**
- Flatpak是另一种跨发行版的软件包格式和包管理器类似于Snap允许用户在不同的Linux发行版上安装和管理软件包。Flatpak提供了一种统一的应用分发和运行环境使得软件包的安装和升级更加简单和可靠。
## **四.Linux文件系统**
Linux系统支持多种文件系统每种文件系统都有自己的特点和优势适用于不同的应用场景和需求。以下是一些常见的Linux文件系统及其主要特点
**ext4**
- ext4是Linux系统中最常用的文件系统之一它是ext文件系统的后续版本提供了更好的性能和扩展性。ext4支持更大的文件和分区大小更快的文件系统检查和恢复速度以及更高的性能和稳定性。
**Btrfs**
- Btrfs是一种先进的文件系统具有许多先进的功能和特性如快照、数据校验、数据压缩等。Btrfs支持在线扩展和收缩分区大小以及动态添加和删除磁盘适用于需要高级特性和灵活性的应用场景。此外Btrfs对快照功能支持较好。
> 快照功能是一种文件系统的特性,它允许用户在特定时间点对文件系统的状态进行快照或备份,并且可以在需要时一键恢复到该时间点的状态。
快照允许用户轻松地创建文件系统的历史版本,并在需要时回滚到特定的版本;快照允许用户在文件系统中进行实验和测试,并在测试失败或不需要时轻松地回滚到初始状态,以避免对系统造成影响。在升级或安装过程中出现问题时快速恢复到原始状态
**XFS**
- XFS是一种高性能的日志文件系统适用于大型文件和高吞吐量的应用场景。XFS支持大容量的文件和分区具有较低的碎片化和较高的并发性能适用于大规模存储和数据分析等应用。
**ZFS**
- ZFS是一种先进的文件系统具有强大的数据管理和保护功能如快照、数据校验、数据压缩等。ZFS支持软件RAID和存储池pool以及动态添加和删除磁盘适用于数据中心和大规模存储等应用场景。
**F2FS**
- F2FS是一种针对闪存存储设备进行优化的文件系统具有高性能和高可靠性。F2FS支持闪存特性如块擦除计数block erase count和块生命周期管理block lifetime management适用于固态硬盘SSD和闪存卡等闪存设备。
## **五.Linux桌面环境**
Linux系统有多种不同的桌面环境每种环境都有其独特的特点、风格和用户体验。以下是一些常见的Linux桌面环境及其主要特点
**GNOME**
- GNOME是一个功能强大、现代化的桌面环境具有直观的用户界面和丰富的功能。它采用了扁平化的设计风格和简洁的用户界面提供了丰富的应用程序和插件适用于普通用户和开发人员。
**KDE Plasma**
- KDE Plasma是一个灵活、可定制的桌面环境提供了丰富的特性和选项如桌面特效、窗口管理器、小部件等。它采用了现代化的设计风格和强大的桌面管理功能适用于高级用户和技术爱好者。
**XFCE**
- XFCE是一个轻量级、快速的桌面环境具有简洁的用户界面和低资源消耗。它采用了传统的桌面布局和简约的设计风格提供了基本的桌面管理功能和应用程序适用于老旧计算机和资源有限的环境。
**LXQt**
- LXQt是一个轻量级、快速的桌面环境是LXDE和Razor-qt的合并项目。它采用了现代化的设计风格和简洁的用户界面提供了丰富的特性和可定制选项适用于资源有限的环境和嵌入式系统。
**Cinnamon**
- Cinnamon是一个基于GNOME的桌面环境具有类似于传统Windows桌面的用户界面和功能。它采用了传统的桌面布局和直观的用户体验提供了丰富的特性和可定制选项适用于对传统桌面风格有需求的用户。
GNOME和KDE Plasma提供了丰富的特性和高度定制化选项适用于高级用户和开发人员XFCE和LXQt则提供了轻量级和快速的用户体验适用于资源有限的环境Cinnamon则提供了类似于传统Windows桌面的用户界面和功能适用于对传统桌面风格有需求的用户。可以根据自己的需求和偏好选择合适的桌面环境。
> 当然,也可以使用轻量级的窗口管理器。
窗口管理器是Linux系统中控制窗口布局、管理窗口行为的关键组件。它们决定了窗口的外观和行为方式以及如何管理和排列窗口。以下是一些常见的窗口管理器及其主要特点
**X Window Manager (XWM)**
- X Window Manager是最基本的窗口管理器用于管理X Window系统中的窗口。它提供了最基本的窗口布局和管理功能如窗口移动、调整大小、最小化等。XWM本身并不提供任何外观效果但可以与其他工具配合使用来实现更丰富的窗口管理和外观特性。
**Openbox**
- Openbox是一个轻量级的窗口管理器具有简洁的用户界面和低资源消耗。它提供了丰富的自定义选项和扩展功能如虚拟桌面、窗口装饰、键盘快捷键等。Openbox适用于资源有限的环境和对简洁风格有需求的用户。
**i3**
- i3是一个动态平铺窗口管理器采用了平铺式布局将窗口按照一定规则自动排列在屏幕上。它提供了快速的窗口切换和管理功能支持键盘操作和自动布局调整适用于需要高效多任务处理的用户。
**Awesome**
- Awesome是一个高度可定制的动态平铺窗口管理器具有丰富的特性和扩展功能。它采用Lua脚本语言进行配置和定制支持强大的自定义选项和扩展功能适用于高级用户和技术爱好者。
**KWin**
- KWin是KDE桌面环境中的默认窗口管理器具有丰富的特性和功能。它提供了多种窗口布局和管理选项支持虚拟桌面、窗口效果、窗口组织等功能适用于需要丰富特性和高度定制化的用户。
这些窗口管理器之间的主要异同在于窗口布局、外观效果、自定义选项和功能特性等方面。Openbox和i3提供了简洁的用户界面和低资源消耗适用于资源有限的环境Awesome和KWin则提供了丰富的特性和扩展功能适用于高级用户和技术爱好者。用户可以根据自己的需求和偏好选择合适的窗口管理器。
> Wayland和X11
Wayland和X11都是用于Linux系统的图形显示协议它们负责管理图形用户界面GUI的显示和交互。下面是它们的简要介绍以及异同点
- **X11X Window System**
X11是一个由MIT开发的图形显示协议长期以来一直是Linux系统中最常用的图形显示系统。它采用客户端-服务器模型图形应用程序客户端通过X服务器与显示设备服务器进行通信。X11提供了丰富的图形特性和功能如窗口管理、窗口装饰、多任务处理等。
- **Wayland**
Wayland是一个由Red Hat主导开发的新一代图形显示协议旨在取代X11成为Linux系统的标准图形显示系统。Wayland采用了现代化的设计理念和架构取消了X11中复杂的客户端-服务器模型将图形显示功能直接集成到操作系统中。Wayland具有更低的延迟和更高的性能支持更好的硬件加速和多触摸设备以及更简洁的代码结构。
**异同点**
- **架构差异**X11采用了客户端-服务器模型图形应用程序通过X服务器与显示设备进行通信而Wayland取消了这种模型将图形显示功能直接集成到操作系统中减少了中间层的复杂性。
- **性能差异**Wayland具有更低的延迟和更高的性能支持更好的硬件加速和多触摸设备使得图形显示更加流畅和响应。
- **功能差异**X11提供了丰富的图形特性和功能如窗口管理、窗口装饰、多任务处理等Wayland在功能上相对较少但提供了更简洁的代码结构和更好的性能。
- **兼容性差异**X11在Linux系统中被广泛使用拥有大量的应用程序和工具的支持而Wayland在兼容性方面仍在发展中尚未完全取代X11成为Linux系统的标准图形显示系统。
总的来说Wayland是未来Linux系统中的趋势具有更好的性能和更简洁的架构但在兼容性和功能丰富度上仍有待改进。X11则是当前仍然广泛使用的图形显示系统拥有丰富的生态和大量的应用程序支持。
## **六.后记**
个人使用推荐Zen+Zsh+Pacman+Btrfs+Hyprland,并使用 paru xxx 来搜索软件包使用paru -S xxx 安装软件。

View File

@ -1,82 +0,0 @@
+++
title = "Linux之旅(4):TerminalConsole and Shell"
date = 2023-07-23
[taxonomies]
tags = ["Linux"]
+++
前言 在linux的学习过程中我们常常遇到诸如 TerminalConsolebash,zsh,shell,tty 等概念,这些概念常常被混淆,似乎都和命令行相关。本文从历史角度出发介绍它们的前世今生。
<!-- more -->
## 终端和控制台
终端,英文叫做 terminal ,通常简称为 term控制台英文叫做 console。
要明白这两者的关系,还得从最初的计算机说起。当时的计算机价格昂贵,一台计算机一般是由多个人同时使用的。在这种情况下一台计算机需要连接上许多套键盘和显示器来供多个人使用。在以前专门有这种可以连上一台电脑的设备,只有显示器和键盘,还有简单的处理电路,本身不具有处理计算机信息的能力,他是负责连接到一台正常的计算机上(通常是通过串口) ,然后登陆计算机,并对该计算机进行操作。当然,那时候的计算机操作系统都是多任务多用户的操作系统。这样一台只有显示器和键盘能够通过串口连接到计算机的设备就叫做终端。
而控制台又是什么回事呢?其概念来自于管风琴的控制台。顾名思义,控制台就是一个直接控制设备的台面(一个面板,上面有很多控制按钮)。 在计算机里,把那套直接连接在电脑上的键盘和显示器就叫做控制台。
终端是通过串口连接上的,不是计算机本身就有的设备,而控制台是计算机本身就有的设备,一个计算机只有一个控制台。计算机启动的时候,所有的信息都会显示到控制台上,而不会显示到终端上。也就是说,控制台是计算机的基本设备,而终端是附加设备。 当然,由于控制台也有终端一样的功能,控制台有时候也被模糊的统称为终端。
以上是控制台和终端的历史遗留区别。现在由于计算机硬件越来越便宜,终端和控制台的概念也慢慢演化了。终端和控制台由硬件的概念,演化成了软件的概念。
  
## 内核与外壳
内核( Kernel )和外壳( Shell )是 linux 的两个主要部分。Kernel 是操作系统的核心,系统的文件管理、进程管理、内存管理、设备管理这些功能,都是由 Kernel 提供的。
用户和操作系统内核交流需要一个工具,那么这个工具就是 Shell。
什么是 Shell在 Linux 中,最常见的 Shell 形式有命令行界面命令行界面和图形界面两种。并不是打开的那个终端窗口就是 Shell如Alacritty、Gnome-Terminal、xterm 、kitty等程序它们不是 Shell而它们里面运行的 Bash、Zsh、fish 等命令行解释器程序,才是 Shell。
那 Alacritty、Gnome-Terminal、xtermxterm 是什么?
它们是终端模拟器。
前面提到过,在远古时代,终端和控制台都是有实体的。控制台直接和计算机在一起,你可以通过控制台控制计算机。终端通过数据线和计算机连接,终端也提供一个键盘和一个屏幕,你可以通过键盘向计算机下达指令,然后通过屏幕观察输出。
但是现在的计算机组成和以前不一样了,一般一台电脑都是自带键盘和屏幕,很少再外接终端设备。
所以 Linux 提供了另外一个更高级的功能,那就是虚拟终端。那就是在一台电脑上,通过软件的模拟,好像有好几个终端连接在这台计算机上一样。
现在说的终端,比如 linux 中的虚拟终端,都是软件的概念。虚拟终端称之为 ttytty 是电传打字机电传打字机 Teletypewriter 的缩写在带显示屏的视频终端出现之前tty是最流行的终端设备。每一个 tty 都有一个编号,在/dev目录下有相应的设备文件。其中/dev/tty1到/dev/tty7可以通过 Ctrl+Alt+F1 到 Ctrl+Alt+F7 进行切换,也可以通过 chvt 命令进行切换,就好比是以前多人公用的计算机中的六个终端设备,这就是为什么这个叫“虚拟终端”的原因。
## 时代变迁
随着时间的推移,我们看到了从硬件到软件的转变,以及从多用户共享到个人使用的转变。这种变迁不仅影响了终端和控制台的概念,也塑造了我们对计算机的理解和期待。

View File

@ -1,130 +0,0 @@
+++
title = "Linux之旅(5):BIOS-UEFI-MBR-GPT-GRUB"
date = 2023-07-24
[taxonomies]
tags = ["Linux"]
+++
前言 在计算机领域系统引导和磁盘分区是至关重要的。本文将介绍BIOS与UEFIMBR与GPT以及它们之间的异同点。此外我们还会讨论与这些概念密切相关的引导加载程序——GRUB。
<!-- more -->
## BIOS
> `BIOSBasic Input Output System`,直译成中文名称就是"`基本输入输出系统`"。它是一组固化到主板中一个ROM芯片上的程序它可以从CMOS中读写系统设置的具体信息。此程序保存着计算机最重要的基本输入输出程序、开机后的自检程序和系统自启动程序。简单来说BIOS只认识设备不认识分区、不认识文件。
## UEFI
> UEFI统一可扩展固件接口是一个公开的规范定义了操作系统和平台固件之间的软件接口。UEFI 是传统 PC BIOS 的继承者是取代传统BIOS的相比传统BIOS来说它更易实现容错和纠错特性也更强。 它将引导数据存储在 .efi 文件中,而不是固件中。你经常会在新款的主板中找到 UEFI 启动模式。UEFI 启动模式包含一个特殊的 EFI 分区,用于存储 .efi 文件并用于引导过程和引导加载程序。
> UEFI使用GPT的分区引导方案支持更大的硬盘。由于省去了BIOS自检的过程所以启动速度更快。传统BIOS主要支持MBR引导UEFI则是取代传统BIOS它加入了对新硬件的支持其中就有支持2TB以上硬盘。
## MBR
> 全新硬盘在使用之前必须进行分区格式化,硬盘分区初始化的格式主要有两种,分别为`MBR`格式和`GPT`格式。MBR是传统的分区表类型当一台电脑启动时它会先启动主板上的BIOS系统BIOS再从硬盘上读取MBR主引导记录硬盘上的MBR运行后就会启动操作系统但最大的缺点则是不支持容量大于2T的硬盘。
## GPT
> 而GPT是另一种更先进的磁盘系统分区方式它的出现弥补了MBR这个缺点最大支持`18EB`的硬盘,是基于`UEFI`使用的磁盘分区架构。目前所有Windows系统均支持`MBR`,而`GPT`只有`64`位系统才能支持。`BIOS只支持MBR引导系统而GPT仅可用UEFI引导系统`。正因为这样现在主板大多采用BIOS集成UEFI或UEFI集成BIOS以此达到同时兼容MBR和GPT引导系统的目的。
## GRUB
> GRUBGRand unified bootloader,多操作系统启动程序。它允许用户可以在计算机内同时拥有多个操作系统,并在计算机启动时选择希望运行的操作系统。
>
> GRUB可用于选择操作系统分区上的不同内核也可用于向这些内核传递启动参数。`它是一个多重操作系统启动管理器,用来引导不同系统`如Windows、Linux。Linux常见的引导程序包括LILO、GRUB、GRUB2。
## Legacy
> 如果你遇到过刚制作的U盘启动盘无法启动或者新买的固态硬盘做好系统后无法启动那么大概率的问题就出现在BIOS的引导模式的选择上是UEFI还是Legacy。legacy启动模式是指BIOS 固件用来初始化硬件设备的引导过程Legacy启动模式包含一系列已安装的设备这些设备在引导过程中计算机执行 POST (开机自检)测试时会被初始化。传统引导将检查所有连接设备的主引导记录 (MBR),通常位于磁盘的第一个扇区。
当它在设备中找不到引导加载程序时Legacy会切换到列表中的下一个设备并不断重复此过程直到找到引导加载程序否则返回错误。
## 表格
### BIOS/UEFI
| BIOS | UEFI |
| ---------------------------------- | --------------------------------------------------------------- |
| 用于初始化计算机硬件并引导操作系统 | 在计算机启动时运行 |
| 具有较少功能和灵活性 | 具有更多功能和灵活性 |
| | 支持更大的硬盘容量、更快的启动速度、更好的安全性和更多的扩展性v |
| | 通常具有图形用户界面GUI |
### MBR/GPT
| MBR | GPT |
| ----------------------------------------- | ---------------------------------------------------------------------------------- |
| 用于分区磁盘并存储分区布局信息 | 用于分区磁盘并存储分区布局信息 |
| 支持最多4个主分区或3个主分区加1个扩展分区 | 支持最多4个主分区或3个主分区加1个扩展分区支持最多4个主分区或3个主分区加1个扩展分区 |
| | 具有更好的数据完整性和可靠性,使用校验和检测数据损坏 |
| | UEFI需要GPT格式的磁盘才能引导 |
### UEFI/Legacy
| UEFI 引导模式 | Legacy引导模式 |
| ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------- |
| UEFI 提供了更好的用户界面 | Legacy引导模式是传统的且非常基本的 |
| 使用 GPT 分区方案 | 使用 MBR 分区方案 |
| UEFI 提供更快的启动时间 | 相比UEFI它的速度较慢 |
| 由于 UEFI 使用 GPT 分区方案,因此它可以支持多达 9 zB 的存储设备 | Legacy使用的 MBR 分区方案仅支持最多 2 TB 存储设备 |
| UEFI 以 32 位和 64 位运行,支持鼠标和触摸板 | Legacy在仅支持键盘仅 16 位模式下运行 |
| 它允许安全启动防止加载未经授权的应用程序它还可能阻碍双启动因为它将操作系统OS视为应用程序 | 它不提供允许加载未经授权的应用程序的安全启动方法,未限制双启动 |
| 它具有更简单的更新过程 | 与UEFI相比它更复杂 |
## 组合
- **BIOS+MBR**
这是最传统的,系统都会支持;唯一的缺点就是`不支持容量大于2T的硬盘`
- **BIOS+GPT**
BIOS是可以使用GPT分区表的硬盘来作为数据盘的但不能引导系统若电脑同时带有容量小于2T的硬盘和容量大于2T的硬盘`小于2T的可以用MBR分区表安装系统而大于2T的可以使用GPT分区表来存放资料`。但系统须使用64位系统。
- **UEFI+MBR**
可以把UEFI设置成`Legacy模式`传统模式让其支持传统MBR启动效果同`BIOS+MBR`也可以建立FAT分区放置UEFI启动文件来可应用在U盘和移动硬盘上实现双模式启动。
- **UEFI+GPT**
如果要把大于2T的硬盘作为系统盘来安装系统的话就必须`UEFI+GPT`。而且系统须使用64位系统否则无法引导。但系统又不是传统在PE下安装后就能直接使用的引导还得经过处理才行。
## 系统的启动过程
从按下计算机的开机按钮到用户开始使用计算机,涉及了多个步骤和组件,让我们一起详细了解整个过程:
**1. 电源启动**
- 用户按下计算机的开机按钮电源开始供电计算机硬件开始初始化。电源将电流传递到主板上的BIOS/UEFI芯片。
**2. BIOS/UEFI启动**
- BIOS/UEFI芯片接收到电源信号后开始执行初始化过程。它首先进行自检POST检测主板、CPU、内存等硬件设备的工作状态并在显示屏上输出相关信息。
- BIOS/UEFI根据配置的启动顺序通常为硬盘、光盘、USB等搜索启动设备并加载位于启动设备上的引导加载程序。
**3. 引导加载程序加载**
- 引导加载程序如GRUB被加载到内存中它负责后续的操作系统加载过程。GRUB通常会显示启动菜单列出可用的操作系统选项。
- 用户可以在GRUB菜单中选择要启动的操作系统或者等待默认选项启动。
**4. 操作系统加载**
- 一旦选择了启动选项引导加载程序会加载操作系统的内核和初始化RAM磁盘initramfs/initrd
- 内核加载完成后,操作系统开始启动初始化过程,包括加载系统服务、挂载文件系统、启动用户界面等。
**5. 用户登录**
- 操作系统初始化完成后,显示登录界面(如果配置了图形用户界面),用户输入用户名和密码登录系统。
- 如果登录成功,操作系统加载用户的桌面环境或命令行界面,用户开始使用计算机。
## 各种引导加载程序
| 特性 | GRUBGRand Unified Bootloader | LILOLinux Loader | systemd-boot前身为 gummiboot | rEFIndUEFI 引导管理器) |
|--------------------|----------------------------------|-----------------------------------|----------------------------------|------------------------------------|
| **支持的系统类型** | BIOS 和 UEFI | 仅支持 BIOS 模式 | 仅支持 UEFI | 仅支持 UEFI |
| **多系统引导支持** | ✅ 强大支持 | ❌ 不支持多系统引导 | ✅ 支持(需手动配置) | ✅ 自动检测操作系统 |
| **图形界面支持** | ✅ 支持(可自定义主题) | ❌ 不支持 | ❌ 不支持 | ✅ 支持(可自定义主题) |
| **配置方式** | 配置文件(复杂) | 配置文件(简单) | 配置文件(简单) | 配置文件(简单) |
| **命令行支持** | ✅ 支持(交互式命令行) | ❌ 不支持 | ❌ 不支持 | ❌ 不支持 |
| **文件系统支持** | ✅ 支持多种文件系统 | ✅ 支持 ext2/ext3/ext4 等 | ✅ 支持 ext4、FAT 等 | ✅ 支持 ext4、FAT 等 |
| **安全启动支持** | ✅ 支持(需配置) | ❌ 不支持 | ✅ 支持(需配置) | ✅ 支持(需配置) |
| **安装复杂度** | 中等(需配置) | 较低 | 较低 | 中等(需配置) |
| **适用场景** | 多系统引导、复杂配置 | 简单系统引导 | 简单系统引导 | 多系统引导、美观界面 |
## 后记
- [聊聊BIOS、UEFI、MBR、GPT、GRUB……](https://segmentfault.com/a/1190000020850901)

View File

@ -1,231 +0,0 @@
+++
title = "Linux之旅(6):常用命令与性能分析"
date = 2023-07-25
[taxonomies]
tags = ["Linux"]
+++
前言 在学习Linux操作系统时熟悉常用命令和性能分析工具是至关重要的。让我们一起探索Linux的世界提升技能解锁无限可能
<!-- more -->
> 翻译自https://medium.com/netflix-techblog/linux-performance-analysis-in-60-000-milliseconds-accc10403c55。
## **问题背景**
当登录到一台有性能问题的Linux服务器第一分钟要检查什么
在Netflix我们拥有庞大的EC2 Linux虚拟机云我们有众多性能分析工具来监视和诊断这些Linux服务器的性能。这些工具包括Atlas负责整个虚拟机云的监控和Vector负责按需对虚拟机实例进行性能分析。这些工具可以帮助我们解决大多数问题但有时我们需要登录到虚拟机实例并运行一些标准的Linux性能工具。
## **前60秒摘要**
在本文中Netflix性能工程团队将使用您应该使用的标准Linux工具在命令行中向您展示一个性能诊断过程的前60秒。在60秒内您可以通过运行以下十个命令来了解有关系统资源使用和运行进程的信息。最应该关注的是一些很容易理解的错误、饱和度指标和资源利用率等指标。饱和度是衡量资源负载超出其处理能力的指标它可以通过观察请求队列的长度或等待时间反映出来。
```
uptime
dmesg | tail
vmstat 1
mpstat -P ALL 1
pidstat 1
iostat -xz 1
free -m
sar -n DEV 1
sar -n TCP,ETCP 1
top
```
其中的一些命令需要安装sysstat软件包。这些命令暴露出的指标将帮助您完成一些USE方法一种查找性能瓶颈的方法。它们涉及检查所有资源CPU、内存、磁盘等的利用率饱和度和错误指标。在诊断过程中还应该注意检查和排除某些资源的问题。因为通过排除某些资源的问题可以缩小诊断的范围并指民后续的诊断。
## **uptime**
```
$ uptime
23:51:26 up 21:31, 1 user, load average: 30.02, 26.43, 19.02
```
这是快速查看平均负载的方法该平均负载指标了要运行的任务进程的数量。在Linux系统上这些数字包括要在CPU上运行的进程以及在不中断IO通常是磁盘IO中阻塞的进程。这里给出了资源负载高层次的概览但是没有其它工具就很难正确理解值得快速看一眼。
这三个数字是指数衰减移动平均值分别代表了1分钟、5分钟、15分钟的平均值。这三个数字使我们对负载如何随时间变化有了一定的了解。例如如果您去诊断一个有问题的服务器发现1分钟的值比15分钟的值低很多那么您可能已经登录得太晚了错过了问题。
在上面的例子中平均负载有所增加因为1分钟的值30相对15分钟的值19来说大了一些。数字变大意味着很多种可能有可能是CPU的需求变多了使用3和4中提到的vmstat或mpstat命令将可以进一步确认问题。
## **dmesg|tail**
```
$ dmesg | tail
[1880957.563150] perl invoked oom-killer: gfp_mask=0x280da, order=0, oom_score_adj=0
[...]
[1880957.563400] Out of memory: Kill process 18694 (perl) score 246 or sacrifice child
[1880957.563408] Killed process 18694 (perl) total-vm:1972392kB, anon-rss:1953348kB, file-rss:0kB
[2320864.954447] TCP: Possible SYN flooding on port 7001. Dropping request. Check SNMP counters.
```
该命令展示最近 10条系统消息。在这些系统消息中查找有可能引起性能问题的报错。上面的例子包括oom-killer和TCP丢弃了一个请求。
不能忘记这个步骤dmesg通常对诊断问题很有价值。
```
## **vmstat 1**
$ vmstat 1
procs ---------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
34 0 0 200889792 73708 591828 0 0 0 5 6 10 96 1 3 0 0
32 0 0 200889920 73708 591860 0 0 0 592 13284 4282 98 1 1 0 0
32 0 0 200890112 73708 591860 0 0 0 0 9501 2154 99 1 0 0 0
32 0 0 200889568 73712 591856 0 0 0 48 11900 2459 99 0 0 0 0
32 0 0 200890208 73712 591860 0 0 0 0 15898 4840 98 1 1 0 0
```
vmstat是虚拟内存统计(Virtual Memory Stat)的缩写vmstat(8)是一个通常可用的工具(最初是在之前的BSD时代创建的),它每行打印一行服务器关键统计的概览。
vmstat使用参数1运行意味着每1秒打印打印一次概览。命令输出的第一行展示的是从启动开始的平均值而不是最近一秒的平均值。因此跳过第一行除非您想学习并记住哪一列是哪一列。
要检查的列:
r在CPU上运行并等待回合的进程数。由于它不包含IO因此它比指示CPU饱和的平均负载提供了更多的信息。一个大于CPU核数的r值就是饱和的。
free空闲的内存单位的KB。如果计数很大说明服务器有足够的内存free -m命令将对空闲内存的状态有更好的说明。
si、so交换置入和交换置出。如果这两个值是非空说明物理内存用完了现在在使用交换内存了。
us、sy、id、wa、st这些是CPU时间的分类其是所有CPU的平均值。它们是用户时间、系统时间(内核)、空闲时间、等待IO和被偷窃时间被其它宾客系统进行使用或宾客系统隔离的驱动程序域Xen
通过将用户时间和系统时间这两个分类相加即可判断CPU是否繁忙。一定的等待IO时间说明磁盘有可能是性能瓶颈。你可以认为等待IO时间是另一种形式的空闲时间它提供了它是如何空闲的线索。
IO处理需要占用CPU系统时间。一个较高的CPU系统时间超过20%可能会很有趣有必要进一步研究也许内核在很低效地处理IO。
在上面的示例中CPU时间基本全在用户时间这说明应用程序本身在大量占用CPU时间。CPU的平均利用率也远远超过90%。这不一定是问题可以使用r列来检查饱和度。
## **mpstat -P ALL 1**
```
$ mpstat -P ALL 1
Linux 3.13.0-49-generic (titanclusters-xxxxx) 07/14/2015 _x86_64_ (32 CPU)
07:38:49 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
07:38:50 PM all 98.47 0.00 0.75 0.00 0.00 0.00 0.00 0.00 0.00 0.78
07:38:50 PM 0 96.04 0.00 2.97 0.00 0.00 0.00 0.00 0.00 0.00 0.99
07:38:50 PM 1 97.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 2.00
07:38:50 PM 2 98.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 1.00
07:38:50 PM 3 96.97 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 3.03
[...]
```
此命令显示每个CPU的CPU时间明细可用于检查不平衡的情况。单个热CPU说明是单线程应用程序在大量占用CPU时间。
## **pidstat 1**
```
$ pidstat 1
Linux 3.13.0-49-generic (titanclusters-xxxxx) 07/14/2015 _x86_64_ (32 CPU)
07:41:02 PM UID PID %usr %system %guest %CPU CPU Command
07:41:03 PM 0 9 0.00 0.94 0.00 0.94 1 rcuos/0
07:41:03 PM 0 4214 5.66 5.66 0.00 11.32 15 mesos-slave
07:41:03 PM 0 4354 0.94 0.94 0.00 1.89 8 java
07:41:03 PM 0 6521 1596.23 1.89 0.00 1598.11 27 java
07:41:03 PM 0 6564 1571.70 7.55 0.00 1579.25 28 java
07:41:03 PM 60004 60154 0.94 4.72 0.00 5.66 9 pidstat
07:41:03 PM UID PID %usr %system %guest %CPU CPU Command
07:41:04 PM 0 4214 6.00 2.00 0.00 8.00 15 mesos-slave
07:41:04 PM 0 6521 1590.00 1.00 0.00 1591.00 27 java
07:41:04 PM 0 6564 1573.00 10.00 0.00 1583.00 28 java
07:41:04 PM 108 6718 1.00 0.00 0.00 1.00 0 snmp-pass
07:41:04 PM 60004 60154 1.00 4.00 0.00 5.00 9 pidstat
```
pidstat有点像top的每个进程摘要但是会滚动打印而不是清屏再打印。这对于观察一段时间内的模式以及将所看到的内容复制&粘贴)记录到调查记录中很有用。
上面的示例显示两个Java进程要为消耗大量CPU负责。%CPU这一列是所有CPU核的总和1591%说明Java进程差不多消耗了16个核的CPU。
## **iostat -xz 1**
```
$ iostat -xz 1
Linux 3.13.0-49-generic (titanclusters-xxxxx) 07/14/2015 _x86_64_ (32 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
73.96 0.00 3.73 0.03 0.06 22.21
Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
xvda 0.00 0.23 0.21 0.18 4.52 2.08 34.37 0.00 9.98 13.80 5.42 2.44 0.09
xvdb 0.01 0.00 1.02 8.94 127.97 598.53 145.79 0.00 0.43 1.78 0.28 0.25 0.25
xvdc 0.01 0.00 1.02 8.86 127.79 595.94 146.50 0.00 0.45 1.82 0.30 0.27 0.26
dm-0 0.00 0.00 0.69 2.32 10.47 31.69 28.01 0.01 3.23 0.71 3.98 0.13 0.04
dm-1 0.00 0.00 0.00 0.94 0.01 3.78 8.00 0.33 345.84 0.04 346.81 0.01 0.00
dm-2 0.00 0.00 0.09 0.07 1.35 0.36 22.50 0.00 2.55 0.23 5.62 1.78 0.03
[...]
```
这是了解块设备(磁盘),应用的工作负载和产生的性能影响的绝佳工具。重点关注下面的指标:
- r/s、w/s、 rkB/s、 wkB/s这些是设备每秒交付的读取、写入、读取千字节和写入千字节。使用这些来表征块设备的工作负载。性能问题可能是由于向块设备施加了过多的工作负载。
- awaitIO的平均时间以毫秒为单位。这是应用程序所感受到的时间它包括IO排队时间和IO服务时间。大于预期的平均时间可能表示块设备饱和或设备出现问题了。
- avgqu-sz发给设备的平均请求数。值大于1可以表明已达到饱和状态尽管设备通常可以并行处理请求尤其是在多个后端磁盘所组成的前端虚拟设备的情况下
- %util设备利用率。这是一个表征繁忙度的百分比它表示设备每秒工作的时间。尽管它的值取决于设备但值大于60%通常会导致性能不佳也会通过await的值观察到。接近100%的值通常表示饱和。
如果存储设备是有许多后端磁盘组成的前端逻辑磁盘设备则100%的利用率可能仅意味着100%的时间正在处理某些IO但是后端磁盘可能远远没有饱和并且可能还可以处理更多的工作。
请记住性能不佳的磁盘IO不一定是应用问题通常可以使用许多技术以执行异步IO以便使应用程序不会被阻塞住而产生直接产生IO延迟例如预读和缓冲写入技术
## **free -m**
```
$ free -m
total used free shared buffers cached
Mem: 245998 24545 221453 83 59 541
-/+ buffers/cache: 23944 222053
Swap: 0 0 0
```
右边两列:
buffers缓冲区高速缓存用于块设备I / O
cached页面缓存由文件系统使用
我们只需要检查下它们的大小是否接近零。如果接近零的话这可能导致较高的磁盘IO可以使用iostat进行确认和较差的性能。上面的示例看起来不错每列都有较大的数据。
-/+ buffers/cache为已用和空闲内存提供较少让人产生混乱的值。Linux将可用内存用于高速缓存但是如果应用程序需要它们可以快速被回收。因此应以某种方式将缓存的内存包括在free列中这也就是这一行的所做的。甚至还有一个网站专门讨论了这种混乱。
如果在Linux上使用ZFS就像我们对某些服务所做的那么因为ZFS具有自己的文件系统缓存它们并不会反映在free -m的列中因此这种场景下这种混乱还将存在。所以会看到似乎系统的可用内存不足而实际上可根据需要从ZFS缓存中申请到内存。
## **sar -n DEV 1**
```
$ sar -n DEV 1
Linux 3.13.0-49-generic (titanclusters-xxxxx) 07/14/2015 _x86_64_ (32 CPU)
12:16:48 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil
12:16:49 AM eth0 18763.00 5032.00 20686.42 478.30 0.00 0.00 0.00 0.00
12:16:49 AM lo 14.00 14.00 1.36 1.36 0.00 0.00 0.00 0.00
12:16:49 AM docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
12:16:49 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil
12:16:50 AM eth0 19763.00 5101.00 21999.10 482.56 0.00 0.00 0.00 0.00
12:16:50 AM lo 20.00 20.00 3.25 3.25 0.00 0.00 0.00 0.00
12:16:50 AM docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
```
此工具可以检查网络接口的吞吐量rxkB/s和txkB/s作为工作负载的度量还可以检查是否已达到网络接口的限制。在上面的示例中eth0接收速率达到22MB/s即176Mbit/s远低于1Gbit/s的网络接口限制假设是千兆网卡
此版本还具有%ifutil用来指示设备利用率全双工双向这也是我们使用的Brendan的nicstat工具测量出来的。就像nicstat一样这个指标很难计算正确而且在本例中好像不起作用数据是0.00)。
## **sar -n TCP,ETCP 1**
```
$ sar -n TCP,ETCP 1
Linux 3.13.0-49-generic (titanclusters-xxxxx) 07/14/2015 _x86_64_ (32 CPU)
12:17:19 AM active/s passive/s iseg/s oseg/s
12:17:20 AM 1.00 0.00 10233.00 18846.00
12:17:19 AM atmptf/s estres/s retrans/s isegerr/s orsts/s
12:17:20 AM 0.00 0.00 0.00 0.00 0.00
12:17:20 AM active/s passive/s iseg/s oseg/s
12:17:21 AM 1.00 0.00 8359.00 6039.00
12:17:20 AM atmptf/s estres/s retrans/s isegerr/s orsts/s
12:17:21 AM 0.00 0.00 0.00 0.00 0.00
```
这是一些关键的TCP指标的摘要包括
- active / s每秒本地启动的TCP连接数例如通过connect
- passive/s每秒远程启动的TCP连接数例如通过accept
- retrans / s每秒TCP重传的次数。
主动和被动计数通常作为服务器TCP负载的粗略度量新接受的连接数被动和新出站的连接数主动。将主动视为出站将被动视为入站可能对理解这两个指标有些帮助但这并不是严格意义上的例如考虑从localhost到localhost的连接
重新传输是网络或服务器问题的迹象它可能是不可靠的网络例如公共Internet也可能是由于服务器过载并丢弃了数据包。上面的示例仅显示每秒一个新的TCP连接。
## **top**
$ top
```
top - 00:15:40 up 21:56, 1 user, load average: 31.09, 29.87, 29.92
Tasks: 871 total, 1 running, 868 sleeping, 0 stopped, 2 zombie
%Cpu(s): 96.8 us, 0.4 sy, 0.0 ni, 2.7 id, 0.1 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 25190241+total, 24921688 used, 22698073+free, 60448 buffers
KiB Swap: 0 total, 0 used, 0 free. 554208 cached Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
20248 root 20 0 0.227t 0.012t 18748 S 3090 5.2 29812:58 java
4213 root 20 0 2722544 64640 44232 S 23.5 0.0 233:35.37 mesos-slave
66128 titancl+ 20 0 24344 2332 1172 R 1.0 0.0 0:00.07 top
5235 root 20 0 38.227g 547004 49996 S 0.7 0.2 2:02.74 java
4299 root 20 0 20.015g 2.682g 16836 S 0.3 1.1 33:14.42 java
1 root 20 0 33620 2920 1496 S 0.0 0.0 0:03.82 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.02 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:05.35 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
6 root 20 0 0 0 0 S 0.0 0.0 0:06.94 kworker/u256:0
8 root 20 0 0 0 0 S 0.0 0.0 2:38.05 rcu_sched
```
top命令包括我们之前检查的许多指标。运行它可以很方便地查看是否有任何东西与以前的命令有很大不同这表明负载是可变的。
top命令不太好的地方是随着时间的推移很难看到指标变化的模式这在提供滚动输出的vmstat和pidstat之类的工具中可能更清楚一点。如果您没有足够快地暂停输出Ctrl-S暂停Ctrl-Q继续在屏幕输出被top命令清除后间歇性问题的证据也可能被丢失了。

View File

@ -1,48 +0,0 @@
+++
title = "Linux之旅(7):系统与终端字体设置"
date = 2023-08-01
[taxonomies]
tags = ["Linux"]
+++
前言 一个好看的字体会提高工作效率与审美.Linux 下的字体可以很漂亮,但需要一些设置.
<!-- more -->
随着 FreeType2 由于专利过期默认开启了高质量的 LCD 优化,以及一批高质量的开源字体的公布,Linux 上的中文字体渲染比过去好了太多.
> Windows 的字体渲染从技术上来说是相当先进的,问题是在中文字体的选择上实在是一坨...
## 选择字体
近几年来出现了一大批自由字体(包括工作量极大的 CJK 字体),使 Linux 下的字体选择一下子丰富了起来.如果愿意花一点时间的话,可以去[ArchWiki](https://wiki.archlinux.org/title/Fonts#Font_packages) 上看看,里面涵盖了相当多的自由字体.
### 终端字体
[Maple Mono](https://github.com/subframe7536/maple-font?tab=readme-ov-file),这是一款字形整洁、拥有手写风格的斜体、细粒度配置、内置 Nerd-Font、中英文2:1等宽 的字体.我使用的:
```
MapleMono-Bold
```
### 阅读器字体
[霞鹜文楷](https://github.com/lxgw/LxgwWenKai),一款开源中文字体,基于 FONTWORKS 出品字体 Klee One 衍生.我使用的:
```
LXGW WenKai
```
### 浏览器字体
```
拉丁字体
├── Inter -无衬线,类似于 Roboto 但更适合屏幕显示的字体
├── Noto Serif -衬线
└── Sarasa Term SC -等宽,拉丁文字符严格为半宽的字体,中英文混排时较协调
├── 如果不适应这种较瘦的字体风格, 则可以尝试使用:
│ ├── Adobe Source Pro
│ ├── Cascadia Code
│ └── Fira Code
中文字体
├── Noto Sans CJK SC (思源黑体)
└── Noto Serif CJK SC思源宋体
```
---
**Done.**

View File

@ -515,76 +515,6 @@
::
<a class="post-tag" href="https://blog.dich.bid/tags/zong-he-gong-cheng/">#综合工程</a></span>
</li>
<li class="post-list">
<a href="https://blog.dich.bid/learn-linux-for-pc-7/">
<span class="post-date">2023-08-01</span>
:: <span class="post-list-title">Linux之旅(7):系统与终端字体设置</span></a>
<span class="post-tags-inline">
::
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
</li>
<li class="post-list">
<a href="https://blog.dich.bid/learn-linux-for-pc-6/">
<span class="post-date">2023-07-25</span>
:: <span class="post-list-title">Linux之旅(6):常用命令与性能分析</span></a>
<span class="post-tags-inline">
::
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
</li>
<li class="post-list">
<a href="https://blog.dich.bid/learn-linux-for-pc-5/">
<span class="post-date">2023-07-24</span>
:: <span class="post-list-title">Linux之旅(5):BIOS-UEFI-MBR-GPT-GRUB</span></a>
<span class="post-tags-inline">
::
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
</li>
<li class="post-list">
<a href="https://blog.dich.bid/learn-linux-for-pc-4/">
<span class="post-date">2023-07-23</span>
:: <span class="post-list-title">Linux之旅(4):TerminalConsole and Shell</span></a>
<span class="post-tags-inline">
::
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
</li>
<li class="post-list">
<a href="https://blog.dich.bid/learn-linux-for-pc-3/">
<span class="post-date">2023-07-22</span>
:: <span class="post-list-title">Linux之旅(3):内核&#x2F;shell&#x2F;包管理&#x2F;文件系统&#x2F;桌面环境</span></a>
<span class="post-tags-inline">
::
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
</li>
<li class="post-list">
<a href="https://blog.dich.bid/learn-linux-for-pc-2/">
<span class="post-date">2023-07-21</span>
:: <span class="post-list-title">Linux之旅(2):FHS与目录结构</span></a>
<span class="post-tags-inline">
::
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
</li>
<li class="post-list">
<a href="https://blog.dich.bid/learn-linux-for-pc-1/">
<span class="post-date">2023-07-20</span>
:: <span class="post-list-title">Linux之旅(1):构成与发行版</span></a>
<span class="post-tags-inline">
::
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
</li>
</ul>

View File

@ -1186,137 +1186,4 @@
<summary type="html">&lt;p&gt;前言 linux搭建安卓虚拟机有WaydroidQEMU和Docker三种方案各有不同。&lt;&#x2F;p&gt;</summary>
</entry>
<entry xml:lang="en">
<title>Linux之旅(7):系统与终端字体设置</title>
<published>2023-08-01T00:00:00+00:00</published>
<updated>2023-08-01T00:00:00+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="https://blog.dich.bid/learn-linux-for-pc-7/"/>
<id>https://blog.dich.bid/learn-linux-for-pc-7/</id>
<summary type="html">&lt;p&gt;前言 一个好看的字体会提高工作效率与审美.Linux 下的字体可以很漂亮,但需要一些设置.&lt;&#x2F;p&gt;</summary>
</entry>
<entry xml:lang="en">
<title>Linux之旅(6):常用命令与性能分析</title>
<published>2023-07-25T00:00:00+00:00</published>
<updated>2023-07-25T00:00:00+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="https://blog.dich.bid/learn-linux-for-pc-6/"/>
<id>https://blog.dich.bid/learn-linux-for-pc-6/</id>
<summary type="html">&lt;p&gt;前言 在学习Linux操作系统时熟悉常用命令和性能分析工具是至关重要的。让我们一起探索Linux的世界提升技能解锁无限可能&lt;&#x2F;p&gt;</summary>
</entry>
<entry xml:lang="en">
<title>Linux之旅(5):BIOS-UEFI-MBR-GPT-GRUB</title>
<published>2023-07-24T00:00:00+00:00</published>
<updated>2023-07-24T00:00:00+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="https://blog.dich.bid/learn-linux-for-pc-5/"/>
<id>https://blog.dich.bid/learn-linux-for-pc-5/</id>
<summary type="html">&lt;p&gt;前言 在计算机领域系统引导和磁盘分区是至关重要的。本文将介绍BIOS与UEFIMBR与GPT以及它们之间的异同点。此外我们还会讨论与这些概念密切相关的引导加载程序——GRUB。&lt;&#x2F;p&gt;</summary>
</entry>
<entry xml:lang="en">
<title>Linux之旅(4):TerminalConsole and Shell</title>
<published>2023-07-23T00:00:00+00:00</published>
<updated>2023-07-23T00:00:00+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="https://blog.dich.bid/learn-linux-for-pc-4/"/>
<id>https://blog.dich.bid/learn-linux-for-pc-4/</id>
<summary type="html">&lt;p&gt;前言 在linux的学习过程中我们常常遇到诸如 TerminalConsolebash,zsh,shell,tty 等概念,这些概念常常被混淆,似乎都和命令行相关。本文从历史角度出发介绍它们的前世今生。&lt;&#x2F;p&gt;</summary>
</entry>
<entry xml:lang="en">
<title>Linux之旅(3):内核&#x2F;shell&#x2F;包管理&#x2F;文件系统&#x2F;桌面环境</title>
<published>2023-07-22T00:00:00+00:00</published>
<updated>2023-07-22T00:00:00+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="https://blog.dich.bid/learn-linux-for-pc-3/"/>
<id>https://blog.dich.bid/learn-linux-for-pc-3/</id>
<summary type="html">&lt;p&gt;前言 在Linux世界中内核&#x2F;shell&#x2F;包管理&#x2F;文件系统构成了Linux系统的核心它们相互配合共同构建了一个强大而稳定的操作环境。本文将深入探讨这些关键组成部分解释它们的作用和原理帮助读者更好地理解Linux系统的运作机制。&lt;&#x2F;p&gt;</summary>
</entry>
<entry xml:lang="en">
<title>Linux之旅(2):FHS与目录结构</title>
<published>2023-07-21T00:00:00+00:00</published>
<updated>2023-07-21T00:00:00+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="https://blog.dich.bid/learn-linux-for-pc-2/"/>
<id>https://blog.dich.bid/learn-linux-for-pc-2/</id>
<summary type="html">&lt;p&gt;前言 在Linux世界中Filesystem Hierarchy StandardFHS是一座引导我们进入系统核心的桥梁它定义了Linux系统中目录结构的规范与作用为我们提供了一张清晰的地图指引我们轻松管理和理解系统。本文将深入探讨FHS规范与Linux系统目录结构解释各个目录的用途与功能帮助我们更好地理解和利用Linux系统。&lt;&#x2F;p&gt;</summary>
</entry>
<entry xml:lang="en">
<title>Linux之旅(1):构成与发行版</title>
<published>2023-07-20T00:00:00+00:00</published>
<updated>2023-07-20T00:00:00+00:00</updated>
<author>
<name>
Unknown
</name>
</author>
<link rel="alternate" type="text/html" href="https://blog.dich.bid/learn-linux-for-pc-1/"/>
<id>https://blog.dich.bid/learn-linux-for-pc-1/</id>
<summary type="html">&lt;p&gt;前言 Linux 作为一款强大、灵活且免费的操作系统吸引了越来越多的用户。然而对于初学者来说Linux 可能显得有些陌生,甚至有些令人望而生畏。本文旨在为那些刚踏入 Linux 世界的新手提供一份指南帮助他们更好地了解、使用这个令人着迷的操作系统。我们将探讨Linux的基本概念解释为何选择Linux深入剖析其主要构成要素以及不同的发行版之间的差异。&lt;&#x2F;p&gt;</summary>
</entry>
</feed>

View File

@ -448,6 +448,57 @@
</span><span># 切换到“省电”模式
</span><span>sudo powerprofilesctl set power-saver
</span></code></pre>
<h2 id="qi-ta-xing-neng-you-hua">其他性能优化</h2>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>Profilesyncdaemon
</span><span>将浏览器配置文件和缓存挂载到内存,退出时再写回磁盘:
</span><span>
</span><span>sudo pacman -S profile-sync-daemon
</span><span>systemctl --user enable --now psd.service
</span><span>
</span><span>Systemdoomd
</span><span>启用 systemd 自带的内存超载保护守护进程:
</span><span>
</span><span>sudo pacman -S systemd-oomd
</span><span>sudo systemctl enable --now systemd-oomd
</span><span>
</span><span>Bpftune
</span><span>加载 BPF 性能调优脚本网络、I/O、调度等
</span><span>
</span><span>sudo pacman -S bpftune
</span><span>sudo systemctl enable --now bpftune
</span><span>
</span><span>AnanicyCpp
</span><span>根据预设规则给游戏、多媒体和后台任务打优先级标签:
</span><span>
</span><span>sudo pacman -S ananicy-cpp
</span><span>sudo systemctl enable --now ananicy-cpp
</span></code></pre>
<h2 id="chang-yong-ming-ling">常用命令</h2>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>更新系统sudo pacman -Syu
</span><span>
</span><span>重新安装所有软件包sudo pacman -Qq | sudo pacman -S -
</span><span>
</span><span>Reset keyrings
</span><span>
</span><span>sudo rm -rf /etc/pacman.d/gnupg
</span><span>sudo pacman-key --init
</span><span>sudo pacman-key --populate archlinux
</span><span>
</span><span>移除数据库锁sudo rm -f /var/lib/pacman/db.lck
</span><span>
</span><span>清理软件包缓存sudo pacman -Sc (或 -Scc 完全清空)
</span><span>
</span><span>删除孤立软件包sudo pacman -Rns $(pacman -Qtdq)
</span><span>
</span><span>Install Gaming packagessudo pacman -S steam wine lutris dxvk
</span><span>
</span><span>排序镜像:
</span><span>
</span><span>sudo pacman -S reflector
</span><span>sudo reflector --latest 10 --sort rate --save /etc/pacman.d/mirrorlist
</span><span>
</span><span>更改 DNS 服务器:编辑 /etc/systemd/resolved.conf 中的 DNS=1.1.1.1 8.8.8.8,然后 sudo systemctl restart systemd-resolved
</span></code></pre>
<h2 id="zai-arch-linuxshang-an-zhuang-docker">在Arch Linux上安装Docker</h2>
<p>一般推荐在qemu虚拟机中安装这里仅做示例</p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>sudo pacman -S docker

View File

@ -132,9 +132,6 @@
<li>8.VPN配置回家</li>
<li>9.实现透明代理。</li>
</ul>
<blockquote>
<p>剩余专业路由功能可以由ROS替代服务则跑在NAS系统上避免ALL in Boom</p>
</blockquote>
<h2 id="da-zhi-si-lu">大致思路</h2>
<ul>
<li>使用高性能的X86主机管理拨号和 DHCP 内网的工作其他无线路由器桥接做APMesh组网</li>
@ -162,15 +159,44 @@
</li>
</ul>
<h2 id="ru-he-de-dao-yi-ge-openwrtxi-tong"><strong>如何得到一个openwrt系统</strong></h2>
<ol>
<li>使用编译好的现成的镜像:</li>
</ol>
<ul>
<li>可以在恩山论坛上使用他人编译好的现成的镜像,如"高大全","精品小包"等等,但存在一定风险;</li>
<li>可以使用<a href="https://downloads.openwrt.org/">官方固件</a>下载得到一个最小化的系统再一步步添加自己要用的包注意需要根据你的uboot来选择注意固件名称是否带了uboot_mod!</li>
<li>可以使用<a href="https://firmware-selector.openwrt.org/">Openwrt 在线编译</a><a href="https://openwrt.ai/?target=x86%2F64&amp;id=generic">Openwrt.ai</a>在线编译
<li>恩山论坛上"高大全","精品小包"等等,但存在一定风险;</li>
<li>使用<a href="https://downloads.openwrt.org">官方固件</a>下载得到一个最小化的系统再一步步添加自己要用的包注意需要根据你的uboot来选择注意固件名称是否带了uboot_mod!</li>
</ul>
<ol start="2">
<li>自行编译:</li>
</ol>
<ul>
<li><a href="https://openwrt.ai/?target=x86%2F64&amp;id=generic">Openwrt.ai</a>在线编译
一个固件;</li>
<li>可以使用GitHub action 云编译一个固件;</li>
<li>可以在本地linux环境中进行编译。</li>
</ul>
<h2 id="x86ping-tai-an-zhuang-zhun-bei"><strong>X86平台安装准备</strong></h2>
<ol start="3">
<li>ImageBuilder</li>
</ol>
<ul>
<li>使用<a href="https://firmware-selector.openwrt.org/">Openwrt 官方ImageBuilder编译</a></li>
<li>自行下载对应的ImageBuilder包并构建.</li>
</ul>
<h2 id="toolchain-sdk-imagebuilder">Toolchain/SDK/ImageBuilder</h2>
<table><thead><tr><th>特性</th><th><strong>Toolchain</strong></th><th><strong>SDK</strong></th><th><strong>Image Builder</strong></th></tr></thead><tbody>
<tr><td>包含内容</td><td>仅交叉编译工具链(二进制版 GCC、ld、musl、binutils</td><td>完整交叉编译环境 + feeds 脚本 + package 目录,用于 <code>.ipk</code> 包开发</td><td>预编译的根文件系统 + opkg 包(无需源码编译),用于快速定制固件映像</td></tr>
<tr><td>典型用途</td><td>用于编译第三方程序或 CI如 hello-world 示例</td><td>编写和编译 <code>.ipk</code> 包,本地或自动化环境中离线开发</td><td>快速生成可刷写的固件镜像,集成所需包且无需完整源码树</td></tr>
<tr><td>解压即用</td><td></td><td></td><td></td></tr>
<tr><td>在源码树中的作用</td><td><code>make toolchain/install</code> 自动识别并使用跳过编译流程</td><td>源码树中不会触发 SDK 安装,需要手动解压并进入其目录使用</td><td>不使用源码树,直接在 Image Builder 根目录下运行 <code>make image</code> 等命令</td></tr>
<tr><td>大小</td><td>较小(几十 MB</td><td>较大(上百 MB</td><td>中等(约数百 MB因包含预编译包</td></tr>
<tr><td>构建时间</td><td>几秒到几分钟</td><td>几分钟到十几分钟(取决于 feeds 大小)</td><td>极快,可在几十秒到几分钟内完成定制镜像</td></tr>
<tr><td>兼容性</td><td>与对应 Release 完全匹配</td><td>与对应 Release 完全匹配</td><td>与对应 Release 完全匹配</td></tr>
<tr><td>使用难度</td><td>简单,只需解压并设置 PATH</td><td>适中,需要理解 feeds 机制及包管理</td><td>最简单,适合终端用户或快速测试环境</td></tr>
</tbody></table>
<h2 id="x86ping-tai-an-zhuang-liu-cheng"><strong>X86平台安装流程</strong></h2>
<ol start="0">
<li>安装准备:</li>
</ol>
<ul>
<li>
<p>一个U盘与一台双网口物理机</p>
@ -188,23 +214,30 @@
<p><a href="https://www.roadkil.net/program.php?ProgramID=12#google_vignette">img 写盘工具</a></p>
</li>
</ul>
<h2 id="x86ping-tai-an-zhuang-liu-cheng"><strong>X86平台安装流程</strong></h2>
<p>1.进入PE环境</p>
<ol>
<li>进入PE环境</li>
</ol>
<ul>
<li>打开微PE将其安装进U盘中安装完成后将 img 工具和 openwrt 包一起放进去;</li>
<li>将U盘插入目标主机进入 BIOS-boot 设置U盘优先启动各主板进入 BIOS 的按键不同,不确定的话建议都试一遍。</li>
</ul>
<p>2.格式化硬盘并写盘</p>
<ol start="2">
<li>格式化硬盘并写盘</li>
</ol>
<ul>
<li>进入PE环境中可以看到存在名为“分区助手”的软件打开它并将目标主机硬盘格式化注意不要分区不要分区不要设置文件系统否则后续可能无法编译点击左上角提交并执行</li>
<li>打开img写盘工具将openwrt包写入硬盘注意不要写进U盘里。</li>
</ul>
<p>3.进入配置界面</p>
<ol start="3">
<li>进入配置界面</li>
</ol>
<ul>
<li>重启系统并快速拔出U盘避免重新进入PE这时系统开始运行了。注意Esir固件是不跑码的无需担心。- 一个U盘与一台双网口物理机</li>
<li>当看到 <code>please press Enter to activate this console</code>这个提示的时候系统就安装完毕了。可使用 passwd 命令设置密码。软路由将自动获取IP地址随后我们在浏览器中打开该地址即可看到 Lucl 界面。</li>
</ul>
<p>4.如果你使用官方固件,注意:</p>
<ol start="4">
<li>如果你使用官方固件,注意:</li>
</ol>
<ul>
<li>硬盘空间有一部分没有被格式化可以手动格式化为ext4并挂载。</li>
<li>注意初始IP往往是192.168.1.1,如果和光猫冲突需要在网络-接口中更改。</li>
@ -212,14 +245,7 @@
<li>刷错主题无法打开luci通过 SSH 登录路由器,切换到另一个已知正常的主题(例如 Bootstrap
<code>uci set luci.main.mediaurlbase='/luci-static/bootstrap' uci commit luci /etc/init.d/uhttpd restart</code>
然后重新访问 Web 界面,查看是否恢复正常。</li>
<li>一般要安装的包:</li>
</ul>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>openssh-sftp-server
</span><span>libpcap
</span><span>luci-app-upnp
</span><span>luci-app-ttyd
</span><span>kmod-nft-xxx
</span></code></pre>
<h2 id="x86ping-tai-ben-di-bian-yi-wan-zheng-openwrt"><strong>X86平台本地编译完整openwrt</strong></h2>
<ul>
<li>
@ -259,7 +285,7 @@
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>useradd -m openwrt # 新建一个名为 openwrt 的用户
</span></code></pre>
<blockquote>
<p>不可以使用Root用户进行编译!!</p>
<p>不可以使用Root用户进行编译!!!</p>
</blockquote>
<ul>
<li><strong>修改用户默认的 Shell</strong></li>
@ -274,70 +300,58 @@
</span><span>cd ~
</span></code></pre>
<ul>
<li><strong>拉取源码,这里用的是 LEDE 分支源码:</strong></li>
<li><strong>拉取源码,这里用的是 ImmortalWrt 24.10 分支源码:</strong></li>
</ul>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>git clone https://github.com/coolsnowwolf/lede
</span><span>cd lede
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>git clone https://github.com/immortalwrt/immortalwrt.git
</span><span>cd immortalwrt
</span></code></pre>
<ul>
<li><strong>选择分支</strong></li>
</ul>
<p>如果你想要编译稳定版(stable),使用</p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>git checkout xxx #例如git checkout v24.10.2
</span></code></pre>
<p>如果你想要编译最新版(snapshot),使用</p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>git switch xxx #例如git switch openwrt-24.10
</span></code></pre>
<h3 id="mu-lu-shuo-ming">目录说明</h3>
<table><thead><tr><th>名称</th><th>作用</th></tr></thead><tbody>
<tr><td><code>Makefile</code></td><td><strong>整个 OpenWrt 构建系统的总入口点</strong>(顶层 Makefile运行 <code>make menuconfig</code><code>make</code> 都依赖它</td></tr>
<tr><td><code>Config.in</code></td><td>Kconfig 系统的入口配置文件,决定 <code>make menuconfig</code> 菜单显示什么选项</td></tr>
<tr><td><code>config/</code></td><td>构建系统的默认配置模板、菜单逻辑,和 <code>menuconfig</code> 相关</td></tr>
<tr><td><code>include/</code></td><td>包含通用 makefile 片段的目录(比如编译选项、函数定义)</td></tr>
<tr><td><code>rules.mk</code></td><td>所有包编译通用规则都写在这里,<code>include $(TOPDIR)/rules.mk</code> 是常见语句</td></tr>
<tr><td><code>feeds.conf.default</code></td><td>定义 Feed 源(即可选的软件源),可用于管理外部包,比如 <code>luci</code><code>packages</code></td></tr>
<tr><td><code>feeds/</code> <em>(克隆后还没出现)</em></td><td><code>./scripts/feeds update -a</code> 后才会出现,用来保存外部 feed 的代码</td></tr>
<tr><td><code>package/</code></td><td>OpenWrt 自带的核心包和第三方包(除 feeds 外的)都在这,结构是 <code>package/&lt;分类&gt;/&lt;包名&gt;</code></td></tr>
<tr><td><code>target/</code></td><td>支持的平台架构,比如 <code>x86</code><code>ramips</code><code>ath79</code><code>mediatek</code> 等都在里面</td></tr>
<tr><td><code>toolchain/</code></td><td>编译器链、glibc/musl、binutils、gcc 都在这里构建</td></tr>
<tr><td><code>tools/</code></td><td>构建工具目录,编译前工具如 <code>m4</code><code>autoconf</code><code>xz</code><code>patch</code> 等放在这</td></tr>
<tr><td><code>scripts/</code></td><td>脚本工具目录,如 <code>feeds</code> 管理、镜像合并、menuconfig 支持等</td></tr>
<tr><td><code>LICENSES/</code></td><td>所有包/组件的许可证归档</td></tr>
<tr><td><code>COPYING</code></td><td>OpenWrt 的主许可证GPLv2</td></tr>
<tr><td><code>README.md</code></td><td>简要介绍如何开始使用 OpenWrt 的说明文档</td></tr>
<tr><td><code>BSDmakefile</code></td><td>为 BSD 系统一些兼容 makefileLinux 用户用不到</td></tr>
</tbody></table>
<ul>
<li>
<p>buildroot: OpenWrt 的核心目录,包含构建系统相关的文件。</p>
<ul>
<li><code>feeds.conf.default</code>:定义软件包源的配置文件。</li>
<li><code>files/</code>:存放自定义文件,用于覆盖默认的 root 文件系统。</li>
</ul>
</li>
<li>
<p>target: 包含目标设备架构的配置和构建信息。</p>
<ul>
<li><code>linux/</code>:包含与 Linux 内核相关的代码和配置。</li>
<li><code>generic/</code>:通用配置文件。</li>
<li><code>platform/</code>:针对具体设备平台的特定配置。</li>
</ul>
</li>
<li>
<p>package: 包含所有 OpenWrt 的软件包。</p>
<ul>
<li><code>base/</code>:基本功能相关的软件包(如 BusyBox、opkg</li>
<li><code>kernel/</code>:与内核相关的补丁或模块。</li>
<li><code>network/</code>:网络工具和协议(如 DHCP、DNS</li>
<li><code>utils/</code>:各种实用工具(如编解码器、文件工具)。</li>
</ul>
</li>
<li>
<p>config: 存放默认配置文件,例如 <code>Config.in</code>,用于定义菜单项。</p>
</li>
<li>
<p>scripts: 构建过程中使用的辅助脚本(如生成补丁、编译镜像)。</p>
</li>
<li>
<p>toolchain: 构建工具链所需的文件,如编译器、链接器。</p>
</li>
<li>
<p>tools: 一些构建系统依赖的额外工具(如 <code>autoconf</code><code>zlib</code>)。</p>
</li>
<li>
<p>include: 存放 Makefile 的通用模板和其他全局定义文件。</p>
</li>
<li>
<p>feeds: 包含通过 <code>feeds.conf</code> 配置的外部软件包源。</p>
</li>
<li>
<p>documentation: 包含与 OpenWrt 项目相关的文档,如构建指南和开发文档。</p>
</li>
<li>
<p><strong>添加软件源,可自行添加软件源至 feeds.conf.default 文件也可以直接git添加需要的软件到lede目录下</strong></p>
</li>
<li><strong>添加软件源,可自行添加软件源至 feeds.conf.default 文件</strong></li>
</ul>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>vim feeds.conf.default
</span></code></pre>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>常用源
</span><span>src-git kenzo https://github.com/kenzok8/openwrt-packages
<p><strong>常用源</strong></p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>src-git kenzo https://github.com/kenzok8/openwrt-packages
</span><span>src-git small https://github.com/kenzok8/small
</span><span>src-git haibo https://github.com/haiibo/openwrt-packages
</span><span>src-git liuran001 https://github.com/liuran001/openwrt-packages
</span></code></pre>
<p><strong>常用仓库</strong></p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>src/gz kwrt_core https://dl.openwrt.ai/releases/24.10/targets/x86/64/6.6.83
</span><span>src/gz kwrt_base https://dl.openwrt.ai/releases/24.10/packages/x86_64/base
</span><span>src/gz kwrt_packages https://dl.openwrt.ai/releases/24.10/packages/x86_64/packages
</span><span>src/gz kwrt_luci https://dl.openwrt.ai/releases/24.10/packages/x86_64/luci
</span><span>src/gz kwrt_routing https://dl.openwrt.ai/releases/24.10/packages/x86_64/routing
</span><span>src/gz kwrt_kiddin9 https://dl.openwrt.ai/releases/24.10/packages/x86_64/kiddin9
</span></code></pre>
<ul>
<li><strong>单独添加</strong>(在更新并安装插件之前执行)例如:</li>
</ul>
@ -350,104 +364,122 @@
</span><span>./scripts/feeds update -a
</span><span>./scripts/feeds install -a
</span></code></pre>
<table><thead><tr><th><code>./scripts/feeds update -a</code></th><th>同步/更新 <strong>外部 feed</strong>packages、luci、routing 等)的 Git 仓库到本地 <code>feeds/</code> 目录</th></tr></thead><tbody>
<tr><td><code>./scripts/feeds install -a</code></td><td>把你在 feeds 里选要用的包 <strong>链接</strong> 到源码树的 <code>package/feeds/</code>,让它们参与编译</td></tr>
</tbody></table>
<ul>
<li><strong>自定义配置</strong></li>
</ul>
<p><strong>修改默认IP为 10.0.0.2</strong></p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>sed -i &#39;s/192.168.1.1/192.168.2.1/g&#39; package/base-files/files/bin/config_generate
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>#!/usr/bin/env bash
</span><span># diy-part2.sh — 在镜像生成时注入默认设置和定制 SSH 横幅及模型修复
</span><span>
</span><span># 1. 默认 hostname可选
</span><span>sed -i &#39;s/=ImmortalWrt/=my-device/&#39; package/base-files/files/bin/config_generate
</span><span>
</span><span># 2. 默认 IP 地址(可选)
</span><span>sed -i &#39;s/192.168.1.1/192.168.5.1/&#39; package/base-files/files/bin/config_generate
</span><span>
</span><span># 3. 默认 root 密码(请换成安全密码)
</span><span>HASH=$(openssl passwd -1 &#39;yourpassword&#39;)
</span><span>sed -i &quot;s|root::0:0:99999|root:${HASH}:0:0:99999|&quot; package/base-files/files/etc/shadow
</span><span>
</span><span># 4. 设置默认 LuCI 主题为 argon内置在 luci feeds
</span><span>cat &gt;&gt;package/base-files/files/etc/uci-defaults/99_set_theme &lt;&lt;&#39;EOF&#39;
</span><span>uci set luci.main.mediaurlbase=/luci-static/argon
</span><span>uci commit luci
</span><span>EOF
</span><span>chmod +x package/base-files/files/etc/uci-defaults/99_set_theme
</span><span>
</span><span># 5. 默认加载 BBR 拥塞控制算法
</span><span>mkdir -p package/base-files/files/etc/sysctl.d
</span><span>cat &gt;&gt;package/base-files/files/etc/sysctl.d/99-bbr.conf &lt;&lt;&#39;EOF&#39;
</span><span>net.core.default_qdisc=fq_codel
</span><span>net.ipv4.tcp_congestion_control=bbr
</span><span>EOF
</span><span>
</span><span># 检查BBR: sysctl net.ipv4.tcp_congestion_control
</span><span>
</span><span># 6. 将默认 shell 修改为 bash
</span><span>sed -i &quot;s|/bin/ash|/bin/bash|g&quot; package/base-files/files/etc/passwd
</span><span># 请在 .config 中添加 TARGET_PACKAGES += bash
</span><span>
</span><span># 7. 自定义 SSH 登录横幅banner
</span><span>mkdir -p package/base-files/files/etc
</span><span>if [ -f &quot;scripts/custom-files/banner.txt&quot; ]; then
</span><span> cp scripts/custom-files/banner.txt package/base-files/files/etc/banner
</span><span>else
</span><span> cat &gt;package/base-files/files/etc/banner &lt;&lt;&#39;EOF&#39;
</span><span>Welcome to MyDevice (ImmortalWrt)\n
</span><span>EOF
</span><span>fi
</span><span>
</span><span># 8. 自定义 LuCI 概览设备型号 🛠
</span><span># 通过 uci-defaults 脚本写入 /tmp/sysinfo/model
</span><span>cat &gt;&gt;package/base-files/files/etc/uci-defaults/99-model-fix &lt;&lt;&#39;EOF&#39;
</span><span>#!/bin/sh
</span><span># 设置自定义设备型号
</span><span>mkdir -p /tmp/sysinfo
</span><span>echo &quot;Your Router Model&quot; &gt; /tmp/sysinfo/model
</span><span>exit 0
</span><span>EOF
</span><span>chmod +x package/base-files/files/etc/uci-defaults/99-model-fix
</span></code></pre>
<p><strong>修改默认主机名</strong></p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>sed -i &#39;/uci commit system/i\uci set system.@system[0].hostname=&#39;OpenWrt&#39;&#39; package/lean/default-settings/files/zzz-default-settings
</span></code></pre>
<p><strong>加入编译者信息</strong></p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>sed -i &quot;s/OpenWrt /smith build $(TZ=UTC-8 date &quot;+%Y.%m.%d&quot;) @ OpenWrt /g&quot; package/lean/default-settings/files/zzz-default-settings
</span></code></pre>
<p><strong>修改默认主题</strong></p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>sed -i &quot;s/luci-theme-bootstrap/luci-theme-argon/g&quot; feeds/luci/collections/luci/Makefile
</span></code></pre>
<p>执行 <strong>make menuconfig</strong> 命令进入编译菜单。</p>
<ul>
<li>执行 <strong>make menuconfig</strong> 命令进入编译菜单。</li>
</ul>
<table><thead><tr><th>命令</th><th>功能描述</th><th>优点</th><th>适用场景</th></tr></thead><tbody>
<tr><td><code>make menuconfig</code></td><td>以 ncurses 界面交互式地浏览、修改当前 <code>.config</code> 与最新 Kconfig 中的所有选项</td><td>界面友好,支持搜索和分类;可直观调整</td><td>想手动挑选/调整配置时</td></tr>
<tr><td><code>make oldconfig</code></td><td>在命令行逐项对比 <code>.config</code> 与最新 Kconfig保留原值、提示新增项、删除废弃项</td><td>快速同步,只对新增选项发出提示;无需界面</td><td>自动化脚本或快速同步配置时</td></tr>
<tr><td><code>make defconfig</code></td><td>忽略当前 <code>.config</code>,直接加载架构/板级目录下的默认配置(<code>defconfig</code></td><td>一键生成官方/平台推荐的「干净」配置</td><td>想重置到官方默认或重新开始时</td></tr>
</tbody></table>
<h3 id="bian-yi-pei-zhi-cai-dan-shuo-ming-bu-fen"><strong>编译配置菜单说明(部分)</strong></h3>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>Target System (Broadcom BCM27xx) # 选择处理器架构
</span><span>└── Subtarget (BCM2711 boards (64 bit)) # 选择处理器
</span><span> └── Target Profile (Raspberry Pi 4B/400/4CM (64bit)) # 预制配置文件
</span><span> └── Target Images # 固件像设置
</span><span> ── ramdisk # 内存盘
</span><span> ├── Compression # 压缩等级 (none 表示压缩)
</span><span> ├── Root filesystem archives # 根文件系统存档类型
</span><span> ── cpio.gz
</span><span> │ └── tar.gz
</span><span> ├── Root filesystem images # 根文件系统格式
</span><span> │ ├── ext4 # 适用于大容量闪存
</span><span> │ ├── squashfs # 适用于小容量闪存
</span><span> │ └── Gzip images # Gzip 存档
</span><span> └── Image Options
</span><span> ├── Kernel partition size # 内核分区大小
</span><span> ├── Root filesystem partition size # 跟文件系统分区大小
</span><span> └── Make /var persistent # 持久化 /var
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>Target System (x86) # 选择目标平台
</span><span>└── Subtarget (x86_64) # 选择 64-bit 子架构
</span><span> └── Target Profile (Generic) # “Generic” 表示通用 x86_64 设备
</span><span> └── Target Images # 固件像设置
</span><span> ── ramdisk # 可选内存盘镜像
</span><span> ├── Compression # 压缩类型(如 none 表示压缩
</span><span> ├── Root filesystem archives # 压缩存档cpio.gz 或 tar.gz
</span><span>── Root filesystem images # 文件系统镜像ext4、squashfs、Gzip
</span><span> └── Image Options # 镜像选项
</span><span> ├── Kernel partition size # 内核分配分区大小
</span><span> ├── Root filesystem partition size # 根文件系统分区大小
</span><span> └── Make /var persistent # 是否保留 /var 持久化
</span><span>
</span><span>Enable experimental features by default # 默认启用实验性功能
</span><span>Global build settings # 全局编译设置
</span><span>Advanced configuration options (for developers) # 高级选项(仅供开发者)
</span><span>Build the OpenWrt Image Builder # 编译 OpenWrt 镜像编译器
</span><span>Build the OpenWrt SDK # 编译 OpenWrt SDK
</span><span>Package the OpenWrt-based Toolchain # 打包 OpenWrt 工具链
</span><span>Image configuration # 镜像选项
</span><span>Global build settings # 全局构建设置
</span><span>Advanced configuration options (for developers) # 开发者高级选项
</span><span>Build the OpenWrt Image Builder # 编译镜像构建器
</span><span>Build the OpenWrt SDK # 构建交叉编译 SDK
</span><span>Package the OpenWrtbased Toolchain # 打包 OpenWrt 工具链
</span><span>Image configuration # 镜像总体配置页面
</span><span>
</span><span>Base system # 基本组件
</span><span>Administration # 管理工具
</span><span>Boot Loaders # 引导程序
</span><span>Development # 开发者工具
</span><span>Extra packages # 额外包
</span><span>Firmware # 固件工具
</span><span>Fonts # 字体
</span><span>Kernel modules # 内核模块
</span><span>Languages # 额外的语言 (Python3, PHP, NodeJS 等)
</span><span>Libraries # 系统库
</span><span>LuCI # LuCI 插件(一般只需修改应用和主题)
</span><span>Base system # 系统基础组件
</span><span>Administration # 管理工具(如 ssh、管理员脚本
</span><span>Boot Loaders # 引导程序(如 grub、syslinux
</span><span>Development # 编译/调试辅助工具
</span><span>Extra packages # 附加应用(如 wget、curl
</span><span>Firmware # 固件工具
</span><span>Fonts # 字体支持
</span><span>Kernel modules # x86 内核模块驱动
</span><span>Languages # 编程语言包(如 Python3、Node.js
</span><span>Libraries # 系统库依赖
</span><span>LuCI # Web UI 前端
</span><span>└── Collections
</span><span>└── Modules
</span><span>└── Applications
</span><span>└── Themes
</span><span>└── Protocols
</span><span>└── Libraries
</span><span>└── default-settings # 默认选项(自动配置语言包)
</span><span>└── defaultsettings
</span><span>
</span><span>Mail # 邮件
</span><span>Multimedia # 媒体
</span><span>Network # 网络相关
</span><span>Sound # 音频
</span><span>Utilities # 各类实用软件(比如 VIM
</span><span>Xorg
</span></code></pre>
<h3 id="cai-dan-xuan-xiang-shuo-ming"><strong>菜单选项说明</strong></h3>
<p><strong>选择 CPU 类型</strong></p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>Target System (x86) --&gt; # 软路由选择 x86硬路由根据型号厂家自行选择
</span><span>Mail # 邮件客户端
</span><span>Multimedia # 媒体工具(如 ffmpeg
</span><span>Network # 网络功能(如 openvpn、wireguard
</span><span>Sound # 音频相关软件
</span><span>Utilities # 常用实用程序(如 vim、htop
</span><span>Xorg # 桌面环境支持X11 图形系统)
</span><span>
</span><span>Subtarget (x86_64) --&gt; # CPU 子选项
</span><span>
</span><span>Target Profile (Generic x86/64) --&gt; # 厂家具体型号
</span></code></pre>
<p><strong>设置镜像编译的格式squashfsext4</strong></p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>Target Images --&gt; # 默认 squashfs
</span></code></pre>
<p><strong>添加较多插件时为了避免空间不足建议修改下面两项默认大小x86/64</strong></p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>Target Images --&gt; (16) Kernel partition size (in MB) # 默认是16建议修改为256
</span></code></pre>
<p><strong>开启 IPv6 支持</strong></p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>Extra packages --&gt; ipv6helper选定这个后下面几项会自动选择
</span></code></pre>
<p><strong>开启适用于 VMware 的 VMware Tools</strong></p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>Utilities --&gt; open-vm-tools
</span><span>
</span><span>Utilities --&gt; open-vm-tools-fuse
</span></code></pre>
<p><strong>选择插件</strong></p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>LuCI --&gt; Applications # 根据需要选择,* 代表编入固件M 表示编译成模块或者IPK包为空表示不编译
</span></code></pre>
<p><strong>选择主题</strong></p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>LuCI --&gt; Themes # 选择喜欢的主题,可以选多个
</span></code></pre>
<p>配置完成后使用编译菜单底部的 Save 保存,然后退出菜单 Exit开始下载软件包</p>
<ul>
<li><strong>预下载编译所需的软件包</strong></li>
</ul>
@ -461,103 +493,64 @@
<p>检查文件完整性命令可以列出下载不完整的文件小于1k的文件属于下载不完整如果存在则用下面的命令删除然后重新下载编译所需的软件包再次检查.确认所有文件完整可大大提高编译成功率,避免浪费时间</p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>find dl -size -1024c -exec rm -f {} \;
</span></code></pre>
<p>最后编译固件,编译完成后输出路径是 <strong>bin/targets</strong>,默认密码是 <strong>password</strong>.</p>
<ul>
<li><strong>编译固件(-j 后面是线程数,首次编译推荐用单线程)</strong></li>
<li><strong>最后编译固件(-j 后面是线程数,首次编译推荐用单线程)编译完成后输出路径是bin/targets.</strong></li>
</ul>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>make V=s -j1
</span><span>
</span><span>或者使用 make world -j1 V=s 2&gt;&amp;1 | tee world_debug.log
</span><span>
</span><span>如果报错可查看 grep -E &quot;(error|fatal|Cannot install package)&quot; world_debug.log -n
</span></code></pre>
<ul>
<li><strong>二次编译</strong></li>
</ul>
<p>拉取最新 OpenWrt 源码和更新 feeds 源中的软件包源码</p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>cd lede
</span><span>
</span><span>git pull
</span><span>
</span><span>./scripts/feeds update -a
</span><span>
</span><span>./scripts/feeds install -a
<table><thead><tr><th>make层级</th><th>目录示例</th><th>说明</th></tr></thead><tbody>
<tr><td>make[1]</td><td>顶层 Makefile</td><td>解析依赖,调度模块</td></tr>
<tr><td>make[2]</td><td><code>tools/</code></td><td>编译辅助工具</td></tr>
<tr><td>make[2]</td><td><code>toolchain/</code></td><td>编译交叉编译工具链</td></tr>
<tr><td>make[2]</td><td><code>target/linux/</code></td><td>编译内核及设备树</td></tr>
<tr><td>make[2]</td><td><code>package/</code></td><td>进入包管理,调度包构建</td></tr>
<tr><td>make[3]</td><td><code>package/libs/libc</code></td><td>单个包的 Makefile</td></tr>
<tr><td>make[3]</td><td><code>package/utils/busybox</code></td><td>单个包的 Makefile</td></tr>
<tr><td>make[4]</td><td><code>build_dir/target-...</code></td><td>包源码目录,运行源码的 make</td></tr>
<tr><td>make[4]</td><td><code>build_dir/target-linux-...</code></td><td>内核源码目录</td></tr>
</tbody></table>
<h2 id="er-ci-bian-yi">二次编译</h2>
<table><thead><tr><th>命令</th><th>清除内容</th><th>保留内容</th><th>适用场景</th></tr></thead><tbody>
<tr><td><code>make clean</code></td><td>删除 <code>bin/</code> 镜像、<code>build_dir/</code> 编译产物</td><td><code>.config</code><code>staging_dir/</code><code>toolchain/</code></td><td>小修改后重建镜像,速度快,常用于增量编译。</td></tr>
<tr><td><code>make dirclean</code></td><td><code>make clean</code> 一样,还删除 <code>staging_dir/</code><code>toolchain/</code><code>logs</code></td><td><code>.config</code></td><td>彻底重建交叉编译环境,适合更改编译配置如 <code>.config</code>、feeds 等。</td></tr>
<tr><td><code>make distclean</code></td><td>删除 <code>make dirclean</code> 的所有内容 + feeds 下载文件 + <code>.config</code>、patch 等所有状态</td><td>只有源码目录保持不变</td><td>专用于回到一个“零配置、重做一切”的状态,完全从头开始构建。</td></tr>
</tbody></table>
<p>恢复所有修改(包括未跟踪文件):</p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>git clean -fd
</span><span>git restore --source=v24.10.2 --staged --worktree .
</span></code></pre>
<p>清除旧的编译产物和目录(可选)</p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>make clean
<h2 id="dwrt-fang-an">Dwrt 方案</h2>
<table><thead><tr><th>作用</th><th>组件</th></tr></thead><tbody>
<tr><td>主题</td><td>argon</td></tr>
<tr><td>Shell</td><td>bash</td></tr>
<tr><td>SSH 服务器</td><td>dropbear</td></tr>
<tr><td>Web 服务器</td><td>uhttpd</td></tr>
<tr><td>DNS/DHCP 服务</td><td>dnsmasqfull</td></tr>
<tr><td>加密库</td><td>openssl</td></tr>
<tr><td>压缩算法</td><td>zram+zstd</td></tr>
<tr><td>拥塞控制</td><td>bbr</td></tr>
<tr><td>防火墙</td><td>nftables + iptables</td></tr>
<tr><td>调度模块</td><td>BPF + kmod-sched-xxx</td></tr>
<tr><td>时间同步</td><td>ntpd-full</td></tr>
<tr><td>文本编辑</td><td>vim-fullvim-runtime</td></tr>
<tr><td>编译优化</td><td>LTO + O3</td></tr>
</tbody></table>
<p>要启用的软件包:</p>
<p><strong>base</strong></p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>autocore base-files bash block-mount ca-bundle coremark curl dnsmasq-full dropbear ds-lite e2fsprogs fdisk firewall4 fstools grub2-bios-setup htop kmod-8139cp kmod-8139too kmod-amazon-ena kmod-amd-xgbe kmod-atlantic kmod-bnx2 kmod-bnx2x kmod-button-hotplug kmod-drm-amdgpu kmod-drm-i915 kmod-dwmac-intel kmod-e1000 kmod-e1000e kmod-forcedeth kmod-fs-f2fs kmod-fs-vfat kmod-i40e kmod-iavf kmod-igb kmod-igbvf kmod-igc kmod-ixgbe kmod-ixgbevf kmod-lib-zstd kmod-mlx4-core kmod-mlx5-core kmod-mmc kmod-pcnet32 kmod-phy-broadcom kmod-r8101 kmod-r8125 kmod-r8126 kmod-r8168 kmod-sdhci kmod-tcp-bbr kmod-tg3 kmod-tulip kmod-usb-hid kmod-vmxnet3 libc libgcc libustream-mbedtls lm-sensors-detect logd lsblk luci-app-fan luci-app-filemanager luci-app-firewall luci-app-log-viewer luci-app-package-manager luci-app-syscontrol luci-app-upnp luci-base luci-compat luci-lib-fs luci-lib-ipkg mkf2fs mtd nano netifd odhcp6c odhcpd-ipv6only openssh-sftp-server opkg partx-utils pciutils ppp ppp-mod-pppoe resolveip swconfig uci uclient-fetch urandom-seed urngd usbutils wget-ssl zram-swap
</span></code></pre>
<ul>
<li>源码有大规模更新或者内核更新后执行,以保证编译质量;此操作会删除 /bin 和 /build_dir 目录中的文件</li>
</ul>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>make dirclean
<p><strong>cli</strong></p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>btop iperf3 tcpdump
</span></code></pre>
<blockquote>
<p>更换架构编译前必须执行</p>
</blockquote>
<blockquote>
<p>此操作会删除 /bin 和 /build_dir 目录的中的文件make clean以及 /staging_dir、/toolchain、/tmp 和 /logs 中的文件</p>
</blockquote>
<p>同首次编译,多线程编译失败后自动进入单线程编译,失败则输出详细日志</p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>make defconfig
</span><span>
</span><span>make download -j8
</span><span>
</span><span>find dl -size -1024c -exec ls -l {} \;
</span><span>
</span><span>make -j$(nproc) || make -j1 || make -j1 V=s
<p><strong>luci</strong></p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>luci-app-argon luci-app-upnp luci-app-ttyd luci-app-eqosplus luci-app-timecontrol luci-app-parentcontrol luci-app-homeproxy luci-app-daed
</span></code></pre>
<h3 id="ru-guo-xu-yao-zhong-xin-pei-zhi">如果需要重新配置</h3>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>rm -rf ./tmp &amp;&amp; rm -rf .config # 清除临时文件和编译配置文件
</span><span>
</span><span>make menuconfig
</span><span>
</span><span>make download -j8
</span><span>
</span><span>find dl -size -1024c -exec ls -l {} \;
</span><span>
</span><span>make -j$(nproc) || make -j1 || make -j1 V=s
</span></code></pre>
<h2 id="armping-tai-an-zhuang-openwrt">Arm平台安装OpenWrt</h2>
<p>相比X86平台arm架构的设备兼容性不高不能随便找一个包就能安装。以下是一般步骤</p>
<ul>
<li>
<p>首先得知道你的设备的CPU比如ipq40XX系列然后在对应的<a href="https://archive.openwrt.org/releases/23.05.4/targets/">仓库</a>查看并下载包体。</p>
</li>
<li>
<p>当然也可以在<a href="https://firmware-selector.openwrt.org/">这里</a>直接下载相关型号对应的固件,其中 Sysupgrade 映像是用来更新现有运行 OpenWrt 的设备,使用 Factory 映像在首次刷机时刷入。</p>
</li>
<li>
<p>随后开启Telnet或者SSH或者TTL串口连接到路由器将对应的Uboot刷入如果没有适配的包就无法刷openwrt。</p>
</li>
<li>
<p>通过Uboot的网络界面刷入Factory包随后就可以在后台如192.168.1.1进入openwrt的管理界面。</p>
</li>
</ul>
<h2 id="zai-ubuntushang-dan-du-bian-yi-openwrtde-ipkbao">在ubuntu上单独编译openwrt的ipk包</h2>
<p>这里以ubuntu环境为例我们假设你有一台虚拟机或者WSL。</p>
<blockquote>
<p><code>注意编译不能使用Root用户</code></p>
</blockquote>
<p><strong>随后安装编译依赖的各个包:</strong></p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>sudo apt update
</span><span>sudo apt install -y \
</span><span> ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
</span><span> bzip2 ccache clang cmake cpio curl device-tree-compiler diffutils diffstat findutils flex gawk \
</span><span> gcc-multilib g++-multilib git gettext gperf grep haveged help2man intltool \
</span><span> libelf-dev libfuse-dev libgmp3-dev libgl1-mesa-dev libgraphene-1.0-dev libglib2.0-dev \
</span><span> libltdl-dev libmpc-dev libmpfr-dev libncurses-dev libpython3-dev libreadline-dev libssl-dev \
</span><span> libtool lrzsz make mesa-common-dev msmtp ninja-build p7zip p7zip-full patch pkgconf \
</span><span> perl python-is-python3 python3 python3-dev python3-distutils-extra python3-pip python3-pyelftools \
</span><span> python3-setuptools qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs \
</span><span> upx-ucl unzip vim wget gnu-which xmlto xxd zlib1g-dev genisoimage llvm llvm-runtime docutils-common \
</span><span> ecj fastjar java-wrappers libeclipse-jdt-core-java libgnutls-dane0t64 \
</span><span> libgnutls-openssl27t64 libgnutls28-dev libidn2-dev libp11-kit-dev libtasn1-6-dev libtasn1-doc \
</span><span> libunbound8 libyaml-dev lld lld-18 nettle-dev python3-docutils python3-ply python3-roman re2c
</span></code></pre>
<p>随后下载我们<strong>刷入openwrt的对应的SDK包</strong>,如</p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>git clone https://github.com/immortalwrt/immortalwrt.git
</span></code></pre>
<p><strong>下载和安装仓库信息</strong></p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>./scripts/feeds update -a
</span><span>./scripts/feeds install -a
</span></code></pre>
<p><strong>下载并选中我们需要编译的包,这里以inyn为例</strong></p>
<h2 id="dan-du-bian-yi-openwrtde-ipkbao">单独编译openwrt的ipk包</h2>
<p><strong>其他步骤同上,下载并选中我们需要编译的包,这里以inyn为例</strong></p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>git clone https://github.com/diredocks/openwrt-inyn.git ./package/inyn
</span><span>make menuconfig
</span></code></pre>
@ -566,33 +559,6 @@
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>make package/inyn/compile V=s
</span><span>## 如果不行则需要先编译工具链,即为 make j=4 j为CPU核数
</span></code></pre>
<h2 id="github-actions-bian-yi-openwrt">Github Actions 编译OpenWrt</h2>
<p>Github为我们提供了免费的E5主机用来编译。</p>
<ul>
<li>
<p>首先Fork<a href="https://github.com/hugcabbage/shared-lede">这个仓库</a>,可以看到有许多现成的配置,在<strong>顶栏actions里面可以直接启动一个Workflow</strong>来编译。</p>
</li>
<li>
<p>大体架构是选择<strong>源码 -- 机型 -- 版本 -- 插件/主题 -- 配置IP/密码/Hostname/编译者)</strong>由一个config文件管理这个文件在前面也提到过可以在本地生成并上传</p>
</li>
<li>
<p>想要什么插件可以直接git clone过来原仓库如果你想要添加其他架构和设备这里<strong>使用templet里面的init.toml来创建</strong>,按照类似的格式填好;</p>
</li>
<li>
<p>在actions里面运行produce注意这需要<strong>GitHub Personal Access Token (PAT)</strong>;如果没有,必须先添加:</p>
</li>
<li>
<p>打开 GitHub进入<a href="https://github.com/settings/tokens">GitHub Developer Settings</a>点击 “Generate new token (classic)”,<strong>勾选所需权限</strong>(最关键的是 repo 和 workflow✅ repo所有子权限✅ workflow✅ read:packages <strong>Token 过期时间</strong>:选择 “No expiration”不过期否则过期后需要重新生成。<strong>点击</strong> “Generate token”
<strong>复制 Token</strong>(只显示一次,一定要保存好!)</p>
</li>
<li>
<p>然后添加 <strong>PRODUCE_DEVICE</strong><strong>GitHub Secrets</strong>
首先进入你的 GitHub 仓库,<code>依次进入Settings设置- Secrets and variables-Actions-New repository secret 名称为PRODUCE_DEVICE</code>,值为粘贴刚刚复制的 GitHub Token点击 “Add secret” 完成添加。</p>
</li>
<li>
<p>随后<code>在actions里面运行produce</code>,完成后即可出现新架构的编译按钮.</p>
</li>
</ul>
<h2 id="chang-yong-ming-ling">常用命令:</h2>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span># 更新软件列表
</span><span>opkg update
@ -602,10 +568,19 @@
</span><span>
</span><span># 如果要更新所有软件,包括 OpenWRT 内核、固件等
</span><span>opkg list-upgradable | cut -f 1 -d &#39; &#39; | xargs opkg upgrade
</span><span>
</span><span># 固件版本号
</span><span>vim /etc/os-release
</span><span>
</span><span># 脚本&amp;脚注
</span><span>vim /etc/openwrt_release
</span><span>
</span><span># ASCII字符画
</span><span>vim /etc/banner
</span><span>
</span><span># 登录脚本显示
</span><span>vim /etc/profile
</span></code></pre>
<blockquote>
<p>新版本的openwrt24.10已经改用APK包管理器。</p>
</blockquote>
<h2 id="chang-yong-ke-xue-cha-jian">常用科学插件</h2>
<table><thead><tr><th>特性</th><th>HomeProxy</th><th>OpenClash</th><th>Passwall</th><th>ShellClash</th></tr></thead><tbody>
<tr><td><strong>核心</strong></td><td>Sing-box、Xray</td><td>Clash</td><td>Xray、Sing-box</td><td>Clash、Xray、Sing-box</td></tr>

View File

@ -415,13 +415,6 @@
<hr />
</div>
<div class="pagination__buttons">
<span class="button previous">
<a href="https://blog.dich.bid/learn-linux-for-pc-7/">
<span class="button__icon"></span>&nbsp;
<span class="button__text">Linux之旅(7):系统与终端字体设置</span>
</a>
</span>
<span class="button next">
<a href="https://blog.dich.bid/awesome-pve-mcsm/">

View File

@ -1,264 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Dich&#x27;blog</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta name="robots" content="noodp"/>
<link rel="stylesheet" href="https://blog.dich.bid/style.css">
<link rel="stylesheet" href="https://blog.dich.bid/color/blue.css">
<link rel="stylesheet" href="https://blog.dich.bid/color/background_dark.css">
<link rel="stylesheet" href="https://blog.dich.bid/font-hack-subset.css">
<meta name="description" content="">
<meta property="og:description" content="">
<meta property="og:title" content="Dich'blog">
<meta property="og:type" content="article">
<meta property="og:url" content="https://blog.dich.bid/learn-linux-for-pc-1/">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:description" content="">
<meta name="twitter:title" content="Dich'blog">
<meta property="twitter:domain" content="blog.dich.bid">
<meta property="twitter:url" content="https://blog.dich.bid/learn-linux-for-pc-1/">
<link rel="alternate" type="application/atom+xml" title="Dich&#x27;blog Atom Feed" href="https://blog.dich.bid/atom.xml" />
<link rel="icon" type="image/png" href=&#x2F;dich.webp />
<!-- ✅ Added center alignment styles -->
<style>
.footer {
text-align: center;
padding: 1rem 0;
}
.footer__inner {
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
.copyright {
text-align: center;
}
</style>
</head>
<body class="">
<div class="container">
<header class="header">
<div class="header__inner">
<div class="header__logo">
<a href="https://blog.dich.bid" style="text-decoration: none;">
<div class="logo">
Dich&#x27;blog
</div>
</a>
</div>
</div>
<nav class="menu">
<ul class="menu__inner">
<li class="active"><a href="https://blog.dich.bid">blog</a></li>
<li><a href="https://blog.dich.bid/archive">archive</a></li>
<li><a href="https://blog.dich.bid/tags">tags</a></li>
<li><a href="https://blog.dich.bid/weekly">weekly</a></li>
<li><a href="https://blog.dich.bid/search">search</a></li>
<li><a href="https://blog.dich.bid/about">about me</a></li>
<li><a href="https://blog.dich.bid/links">links</a></li>
<li><a href="https://blog.dich.bid/atom.xml">rss</a></li>
<li><a href="https://github.com/Dichgrem" target="_blank" rel="noopener noreferrer">github</a></li>
</ul>
</nav>
</header>
<div class="content">
<div class="post">
<h1 class="post-title"><a href="https://blog.dich.bid/learn-linux-for-pc-1/">Linux之旅(1):构成与发行版</a></h1>
<div class="post-meta-inline">
<span class="post-date">
2023-07-20
</span>
</div>
<span class="post-tags-inline">
:: tags:&nbsp;
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
<div class="post-content">
<p>前言 Linux 作为一款强大、灵活且免费的操作系统吸引了越来越多的用户。然而对于初学者来说Linux 可能显得有些陌生,甚至有些令人望而生畏。本文旨在为那些刚踏入 Linux 世界的新手提供一份指南帮助他们更好地了解、使用这个令人着迷的操作系统。我们将探讨Linux的基本概念解释为何选择Linux深入剖析其主要构成要素以及不同的发行版之间的差异。</p>
<span id="continue-reading"></span><h2 id="yi-shen-me-shi-linux">一.什么是Linux</h2>
<p>Linux 是一种开源的类 UNIX 操作系统内核。它由芬兰的 Linus Torvalds 于1991年开始开发是一个自由、免费的操作系统。Linux 内核是操作系统的核心,负责管理硬件资源,并提供各种系统服务。与 Windows 和 macOS 等操作系统不同Linux 的源代码对所有人开放,任何人都可以查看、修改和重新分发。这使得 Linux 具有极高的自由度和可定制性用户可以根据自己的需求和偏好来定制操作系统。Linux 广泛应用于各种设备,包括个人计算机、服务器、手机、嵌入式系统等,是一个功能强大且灵活多样的操作系统。</p>
<h2 id="er-wei-shen-me-yao-yong-linux">二.为什么要用Linux</h2>
<ol>
<li>
<p><strong>开源免费</strong>Linux 是完全开源的,用户可以免费使用和修改源代码。</p>
</li>
<li>
<p><strong>稳定性和安全性</strong>Linux 系统以其稳定性和安全性而闻名,适合长时间运行的服务。</p>
</li>
<li>
<p><strong>灵活性和可定制性</strong>:用户可以根据需要定制 Linux 系统。</p>
</li>
<li>
<p><strong>广泛的软件支持</strong>:有大量的开源软件可供选择,满足不同需求。</p>
</li>
</ol>
<blockquote>
<p>Liunx可以用来玩游戏吗
实际上著名的 Steam Deck 的系统就是基于Arch linux 的。对于个人使用而言现在有不少原生支持linux 的游戏也可以使用Wine来运行Windows下的游戏。</p>
</blockquote>
<blockquote>
<p>Linux上软件会不会太少
参见 <a href="https://blog.dich.ink/open-source-software">常用跨平台开源软件</a>一文在社区的努力下如今软件生态已经非常丰富你也可以使用如Flatpak等商店安装软件或者直接使用Wine。如果有不得不在Windows下使用的软件可以装双系统。</p>
</blockquote>
<h2 id="san-linuxde-zhu-yao-gou-cheng">三.Linux的主要构成</h2>
<p>Linux操作系统主要由以下几个部分组成</p>
<ol>
<li>
<p><strong>内核</strong>操作系统的核心负责管理系统资源。如Zen内核LTS内核等。</p>
</li>
<li>
<p><strong>Shell</strong>命令行界面用户通过它与系统交互如Bash,Zsh等。</p>
</li>
<li>
<p><strong>图形用户界面GUI</strong>提供图形化操作界面如GNOME、KDE、XFCE等。</p>
</li>
<li>
<p><strong>文件系统</strong>如ext4、Btrfs等用于组织和管理磁盘上的文件。</p>
</li>
<li>
<p><strong>系统库</strong>:为应用程序提供运行时支持。</p>
</li>
<li>
<p><strong>应用程序</strong>用户可以直接使用的软件如文本编辑器、网页浏览器等。其中也有著名的GNU工具如Vim,GCC等。</p>
</li>
</ol>
<h2 id="si-xuan-ze-linuxfa-xing-ban">四.选择Linux发行版</h2>
<p>从上文可以发现选择Linux发行版实际上是在选择 <strong>内核/包管理器/图形界面</strong> 等组件的排列组合。其中最主要的因素是包管理器。</p>
<p>Linux有许多不同的发行版但大致可以分为几个系</p>
<p><strong>Debian系</strong>
DebianDebian以稳定性安全性和轻量级著称适合用于服务器和桌面环境。我们常说的Ubuntu就是基于Debian的发行版注重用户友好性和易用性。它提供了多种桌面环境选择以及许多现成的软件包。</p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>APTAdvanced Package Tool是Debian系发行版的主要包管理器。它使用命令行工具如apt-get、aptitude等来管理软件包。
</span></code></pre>
<p><strong>Red Hat系</strong></p>
<ul>
<li>Red Hat Enterprise LinuxRHELRHEL是一款商业发行版专注于企业级应用和支持。它提供了长期支持和专业技术支持服务适用于企业级服务器和工作站。</li>
<li>CentOSCentOS是基于RHEL源代码编译而成的免费发行版与RHEL兼容并提供类似的功能和性能。它也提供了长期支持版本和稳定性较高的特点。</li>
<li>FedoraFedora是由Red Hat支持的社区驱动的发行版注重提供最新的软件特性和技术。它适用于开发者和技术爱好者提供了稳定的发布周期和丰富的软件包。</li>
</ul>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>YUMYellowdog Updater, Modified是Red Hat系发行版的主要包管理器。最近的版本也开始采用DNFDandified YUM
</span></code></pre>
<p><strong>Arch系</strong>
Arch LinuxArch Linux是一个简洁、轻量级且灵活的发行版注重简洁性和滚动更新。它采用“滚动发布”的方式用户可以通过自定义安装来构建自己的系统适合有一定Linux经验的用户。</p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>PacmanPackage Manager是Arch Linux的主要包管理器。它使用简洁的命令来管理软件包如pacman -S安装软件包、pacman -Syu更新系统等。
</span></code></pre>
<p><strong>Gentoo系</strong>
GentooGentoo是一个源码驱动的发行版用户可以通过源代码自定义编译软件包以满足自己的需求。它注重性能和灵活性适合高级用户和技术爱好者。</p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>Portage是Gentoo的包管理器它是一个源代码驱动的包管理器允许用户从源代码构建和安装软件包。
</span></code></pre>
<p>除了以上列举的包管理器外还有其他一些较为特殊的包管理器如Slackware系的pkgtool、SUSE系的zypper等。</p>
<p>对于个人使用而言我个人建议新手使用Ubuntu,有比较易用的界面和完善的资料参考如果你是一个系统极客可以使用Arch linux 或者 NixOS。</p>
<h2 id="wu-ge-ren-ri-chang-shi-yong-xu-yao-zhu-yi-shen-me">五.个人日常使用需要注意什么?</h2>
<ol>
<li>
<p><strong>学习命令行</strong>命令行是Linux的强大工具学习基本命令可以提高效率。</p>
</li>
<li>
<p><strong>选择合适的发行版</strong>:根据个人需求和技术水平选择适合的发行版。</p>
</li>
<li>
<p><strong>系统备份</strong>:定期备份重要数据,以防意外丢失。</p>
</li>
<li>
<p><strong>软件管理</strong>:了解如何安装、更新和卸载软件。</p>
</li>
<li>
<p><strong>安全设置</strong>:设置强密码,定期更新系统以修复安全漏洞。</p>
</li>
<li>
<p><strong>社区参与</strong>Linux社区非常活跃遇到问题可以寻求社区帮助。</p>
</li>
<li>
<p><strong>硬件兼容性</strong>检查你的硬件是否与选择的Linux发行版兼容。</p>
</li>
<li>
<p><strong>驱动程序</strong>:确保你的硬件设备有可用的驱动程序,以避免兼容性问题。</p>
</li>
</ol>
</div>
<div class="pagination">
<div class="pagination__title">
<span class="pagination__title-h">Thanks for reading! Read other posts?</span>
<hr />
</div>
<div class="pagination__buttons">
<span class="button next">
<a href="https://blog.dich.bid/learn-linux-for-pc-2/">
<span class="button__text">Linux之旅(2):FHS与目录结构</span>&nbsp;
<span class="button__icon"></span>
</a>
</span>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="footer__inner">
<div class="copyright">
<span>©
2025
Dichgrem</span>
<span class="copyright-theme">
<span class="copyright-theme-sep"> :: CC BY-SA 4.0 :: A friend comes from distant lands</span>
</a>
</span>
</div>
</div>
</footer>
</div>
</body>
</html>

View File

@ -1,282 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Dich&#x27;blog</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta name="robots" content="noodp"/>
<link rel="stylesheet" href="https://blog.dich.bid/style.css">
<link rel="stylesheet" href="https://blog.dich.bid/color/blue.css">
<link rel="stylesheet" href="https://blog.dich.bid/color/background_dark.css">
<link rel="stylesheet" href="https://blog.dich.bid/font-hack-subset.css">
<meta name="description" content="">
<meta property="og:description" content="">
<meta property="og:title" content="Dich'blog">
<meta property="og:type" content="article">
<meta property="og:url" content="https://blog.dich.bid/learn-linux-for-pc-2/">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:description" content="">
<meta name="twitter:title" content="Dich'blog">
<meta property="twitter:domain" content="blog.dich.bid">
<meta property="twitter:url" content="https://blog.dich.bid/learn-linux-for-pc-2/">
<link rel="alternate" type="application/atom+xml" title="Dich&#x27;blog Atom Feed" href="https://blog.dich.bid/atom.xml" />
<link rel="icon" type="image/png" href=&#x2F;dich.webp />
<!-- ✅ Added center alignment styles -->
<style>
.footer {
text-align: center;
padding: 1rem 0;
}
.footer__inner {
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
.copyright {
text-align: center;
}
</style>
</head>
<body class="">
<div class="container">
<header class="header">
<div class="header__inner">
<div class="header__logo">
<a href="https://blog.dich.bid" style="text-decoration: none;">
<div class="logo">
Dich&#x27;blog
</div>
</a>
</div>
</div>
<nav class="menu">
<ul class="menu__inner">
<li class="active"><a href="https://blog.dich.bid">blog</a></li>
<li><a href="https://blog.dich.bid/archive">archive</a></li>
<li><a href="https://blog.dich.bid/tags">tags</a></li>
<li><a href="https://blog.dich.bid/weekly">weekly</a></li>
<li><a href="https://blog.dich.bid/search">search</a></li>
<li><a href="https://blog.dich.bid/about">about me</a></li>
<li><a href="https://blog.dich.bid/links">links</a></li>
<li><a href="https://blog.dich.bid/atom.xml">rss</a></li>
<li><a href="https://github.com/Dichgrem" target="_blank" rel="noopener noreferrer">github</a></li>
</ul>
</nav>
</header>
<div class="content">
<div class="post">
<h1 class="post-title"><a href="https://blog.dich.bid/learn-linux-for-pc-2/">Linux之旅(2):FHS与目录结构</a></h1>
<div class="post-meta-inline">
<span class="post-date">
2023-07-21
</span>
</div>
<span class="post-tags-inline">
:: tags:&nbsp;
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
<div class="post-content">
<p>前言 在Linux世界中Filesystem Hierarchy StandardFHS是一座引导我们进入系统核心的桥梁它定义了Linux系统中目录结构的规范与作用为我们提供了一张清晰的地图指引我们轻松管理和理解系统。本文将深入探讨FHS规范与Linux系统目录结构解释各个目录的用途与功能帮助我们更好地理解和利用Linux系统。</p>
<span id="continue-reading"></span><h2 id="yi-ren-shi-fhs">一.认识FHS</h2>
<p>FHS是Filesystem Hierarchy Standard文件系统层次结构标准的缩写。它是一个定义了Linux系统中目录结构和各个目录作用的规范。FHS规定了Linux系统中各个目录的用途和预期内容以便确保不同Linux发行版之间的兼容性并使得用户能够更轻松地理解和管理系统。</p>
<p>FHS规范最初由Linux基金会Linux Foundation和自由软件基金会Free Software Foundation共同发布并经过多次修订和更新。该规范不仅对Linux系统本身有用也适用于其他类UNIX操作系统。</p>
<p>FHS规范定义了一些基本的目录如/bin、/boot、/dev等并规定了每个目录的作用和预期内容。这样做有助于系统管理员和开发人员更好地组织和管理文件系统并使得用户能够更轻松地找到所需的文件和数据。</p>
<h2 id="er-chang-jian-mu-lu-jie-gou">二.常见目录结构</h2>
<p>在刚刚由Windows切换至Linux时往往会对目录感到不解不知道安装的软件放在哪个目录之下</p>
<p>以下是对Linux系统目录结构的详细说明</p>
<ul>
<li><strong>/(根目录)</strong>
根目录是整个文件系统的起点包含了系统中所有其他目录和文件。在Linux系统中根目录被表示为/。</li>
<li><strong>/bin二进制文件</strong>
/bin目录存放着一些最基本的系统命令如ls、cp、mv等这些命令通常被所有用户使用。</li>
<li><strong>/boot引导文件</strong>
/boot目录存放着启动Linux系统所需的引导文件如内核映像vmlinuz、引导加载程序boot loader配置文件如GRUB配置文件等。</li>
<li><strong>/dev设备文件</strong>
/dev目录包含了系统中所有设备的特殊文件如硬盘、键盘、鼠标等。在Linux中一切皆文件设备被抽象为文件通过/dev目录中的特殊文件来表示。</li>
<li><strong>/etc配置文件</strong>
/etc目录包含了系统的配置文件如网络配置、用户账户信息、服务配置等。这些配置文件通常以纯文本的形式存在可以由系统管理员进行编辑和修改。</li>
<li><strong>/home用户主目录</strong>
/home目录是系统中所有普通用户的主目录所在地每个用户通常都有一个对应的子目录用于存放用户的个人文件和数据。</li>
<li><strong>/lib库文件</strong>
/lib目录存放着系统所需的共享库文件这些库文件包含了一些程序运行所需的函数和数据为程序提供了基本的支持。</li>
<li><strong>/mnt挂载点</strong>
/mnt目录用于挂载临时文件系统如光盘、移动硬盘等。系统管理员可以将其他设备或文件系统挂载到/mnt目录下以便访问其中的文件和数据。</li>
<li><strong>/opt可选软件包</strong>
/opt目录用于存放一些可选的软件包和应用程序这些软件包通常不属于Linux发行版的默认安装范围但可以被用户自行安装和管理。</li>
<li><strong>/proc进程信息</strong>
/proc目录是一个虚拟的文件系统包含了系统运行时的各种进程信息和系统状态信息。用户可以通过读取/proc目录中的特殊文件来获取系统信息。</li>
<li><strong>/sbin系统命令</strong>
/sbin目录存放着一些系统管理和维护命令这些命令通常只能由超级用户root执行用于系统的管理和维护。</li>
<li><strong>/srv服务数据</strong>
/srv目录用于存放一些服务相关的数据文件如Web服务器的网站数据、FTP服务器的文件等。每个服务通常都会有一个对应的子目录。</li>
<li><strong>/tmp临时文件</strong>
/tmp目录用于存放临时文件和临时数据这些文件通常在系统重启时会被删除。任何用户都可以在/tmp目录下创建临时文件。</li>
<li><strong>/usr用户程序</strong>
/usr目录包含了系统中大部分用户可用的程序和文件如用户应用程序、共享库文件、文档等。它通常是系统的二级目录类似于Windows系统中的Program Files目录。</li>
<li><strong>/var可变数据</strong>
/var目录用于存放系统运行时产生的可变数据如日志文件、邮件、缓存文件等。这些数据通常会随着系统的运行而不断变化。</li>
</ul>
<blockquote>
<p>注意NixOS不符合FHS标准</p>
</blockquote>
<h2 id="san-fen-qu-da-xiao">三.分区大小</h2>
<p>对各个分区进行容量分配时,需要根据系统的实际需求和用途来进行规划。一般而言在安装引导时可以选择让程序自动分区。</p>
<ul>
<li><strong>根目录(/</strong>根目录是整个文件系统的起点通常会分配较大的空间以确保系统和应用程序有足够的空间运行。建议分配至少20GB的空间给根目录。</li>
<li><strong>/home目录</strong>/home目录用于存放用户的个人文件和数据因此需要根据用户数量和存储需求来进行容量分配。一般情况下建议为每个用户分配至少10GB的空间。</li>
<li><strong>/var目录</strong>/var目录用于存放系统运行时产生的可变数据如日志文件、邮件、缓存文件等。根据系统的运行情况和日志文件的大小来进行容量分配一般建议分配10-20GB的空间。</li>
<li><strong>/tmp目录</strong>/tmp目录用于存放临时文件和临时数据通常不需要分配太大的空间。建议分配至少1-2GB的空间给/tmp目录。</li>
<li><strong>/boot目录</strong>/boot目录存放着启动Linux系统所需的引导文件通常只需要分配几百MB的空间即可。</li>
<li><strong>Swap分区</strong>Swap分区是一种虚拟内存用于暂时存放不常用的内存数据。当系统内存不足时Linux会将一部分内存数据移动到Swap分区中以避免内存耗尽导致系统崩溃。Swap分区的大小通常与系统内存大小有关一般建议为系统内存的1.5-2倍。例如如果系统内存为4GB则建议设置Swap分区大小为6-8GB。</li>
</ul>
<blockquote>
<p>这里特别讲讲Swap分区</p>
</blockquote>
<p>Swap分区可以通过以下几种方式实现</p>
<ul>
<li>交换分区Swap Partition创建一个独立的交换分区通常是一个专门的分区用于存放Swap数据。</li>
<li>交换文件Swap File创建一个专门的文件用于存放Swap数据而不是创建独立的分区。这种方式更加灵活可以根据需要动态调整Swap的大小。</li>
<li>Swap大小Swap的大小应该根据系统的内存大小和使用情况来确定一般建议为系统内存的1.5-2倍。</li>
<li>Swap分区/文件的位置Swap分区/文件应该位于较快的存储介质上,以确保交换操作的效率。
Swap的优先级如果同时存在多个Swap分区/文件可以通过设置优先级来指定系统使用的Swap空间。</li>
</ul>
<h2 id="si-jiang-home-mu-lu-xia-de-wen-jian-jia-gai-wei-ying-wen">四.将 <code>home</code> 目录下的文件夹改为英文</h2>
<p>可以使用 <code>xdg-user-dirs-update</code> 工具来更新用户目录为英文版本。你可以按照以下步骤进行:</p>
<ol>
<li>
<p><strong>编辑用户目录配置文件</strong>
打开或创建 <code>~/.config/user-dirs.dirs</code> 文件,用文本编辑器编辑它:</p>
<pre data-lang="bash" style="background-color:#151515;color:#e8e8d3;" class="language-bash "><code class="language-bash" data-lang="bash"><span style="color:#ffb964;">nano ~</span><span>/.config/user-dirs.dirs
</span></code></pre>
</li>
<li>
<p><strong>将目录名称更改为英文</strong>
在该文件中,你可以看到类似以下的条目:</p>
<pre data-lang="bash" style="background-color:#151515;color:#e8e8d3;" class="language-bash "><code class="language-bash" data-lang="bash"><span style="color:#ffb964;">XDG_DESKTOP_DIR</span><span>=</span><span style="color:#556633;">&quot;</span><span style="color:#99ad6a;">$</span><span style="color:#ffb964;">HOME</span><span style="color:#99ad6a;">/桌面</span><span style="color:#556633;">&quot;
</span><span style="color:#ffb964;">XDG_DOWNLOAD_DIR</span><span>=</span><span style="color:#556633;">&quot;</span><span style="color:#99ad6a;">$</span><span style="color:#ffb964;">HOME</span><span style="color:#99ad6a;">/下载</span><span style="color:#556633;">&quot;
</span><span style="color:#ffb964;">XDG_DOCUMENTS_DIR</span><span>=</span><span style="color:#556633;">&quot;</span><span style="color:#99ad6a;">$</span><span style="color:#ffb964;">HOME</span><span style="color:#99ad6a;">/文档</span><span style="color:#556633;">&quot;
</span><span style="color:#ffb964;">XDG_MUSIC_DIR</span><span>=</span><span style="color:#556633;">&quot;</span><span style="color:#99ad6a;">$</span><span style="color:#ffb964;">HOME</span><span style="color:#99ad6a;">/音乐</span><span style="color:#556633;">&quot;
</span><span style="color:#ffb964;">XDG_PICTURES_DIR</span><span>=</span><span style="color:#556633;">&quot;</span><span style="color:#99ad6a;">$</span><span style="color:#ffb964;">HOME</span><span style="color:#99ad6a;">/图片</span><span style="color:#556633;">&quot;
</span><span style="color:#ffb964;">XDG_VIDEOS_DIR</span><span>=</span><span style="color:#556633;">&quot;</span><span style="color:#99ad6a;">$</span><span style="color:#ffb964;">HOME</span><span style="color:#99ad6a;">/视频</span><span style="color:#556633;">&quot;
</span></code></pre>
<p>将这些路径改为英文,例如:</p>
<pre data-lang="bash" style="background-color:#151515;color:#e8e8d3;" class="language-bash "><code class="language-bash" data-lang="bash"><span style="color:#ffb964;">XDG_DESKTOP_DIR</span><span>=</span><span style="color:#556633;">&quot;</span><span style="color:#99ad6a;">$</span><span style="color:#ffb964;">HOME</span><span style="color:#99ad6a;">/Desktop</span><span style="color:#556633;">&quot;
</span><span style="color:#ffb964;">XDG_DOWNLOAD_DIR</span><span>=</span><span style="color:#556633;">&quot;</span><span style="color:#99ad6a;">$</span><span style="color:#ffb964;">HOME</span><span style="color:#99ad6a;">/Downloads</span><span style="color:#556633;">&quot;
</span><span style="color:#ffb964;">XDG_DOCUMENTS_DIR</span><span>=</span><span style="color:#556633;">&quot;</span><span style="color:#99ad6a;">$</span><span style="color:#ffb964;">HOME</span><span style="color:#99ad6a;">/Documents</span><span style="color:#556633;">&quot;
</span><span style="color:#ffb964;">XDG_MUSIC_DIR</span><span>=</span><span style="color:#556633;">&quot;</span><span style="color:#99ad6a;">$</span><span style="color:#ffb964;">HOME</span><span style="color:#99ad6a;">/Music</span><span style="color:#556633;">&quot;
</span><span style="color:#ffb964;">XDG_PICTURES_DIR</span><span>=</span><span style="color:#556633;">&quot;</span><span style="color:#99ad6a;">$</span><span style="color:#ffb964;">HOME</span><span style="color:#99ad6a;">/Pictures</span><span style="color:#556633;">&quot;
</span><span style="color:#ffb964;">XDG_VIDEOS_DIR</span><span>=</span><span style="color:#556633;">&quot;</span><span style="color:#99ad6a;">$</span><span style="color:#ffb964;">HOME</span><span style="color:#99ad6a;">/Videos</span><span style="color:#556633;">&quot;
</span></code></pre>
</li>
<li>
<p><strong>重命名现有的文件夹</strong>
手动将 <code>home</code> 目录下的文件夹重命名为英文版本:</p>
<pre data-lang="bash" style="background-color:#151515;color:#e8e8d3;" class="language-bash "><code class="language-bash" data-lang="bash"><span style="color:#ffb964;">mv ~</span><span>/桌面 </span><span style="color:#ffb964;">~</span><span>/Desktop
</span><span style="color:#ffb964;">mv ~</span><span>/下载 </span><span style="color:#ffb964;">~</span><span>/Downloads
</span><span style="color:#ffb964;">mv ~</span><span>/文档 </span><span style="color:#ffb964;">~</span><span>/Documents
</span><span style="color:#ffb964;">mv ~</span><span>/音乐 </span><span style="color:#ffb964;">~</span><span>/Music
</span><span style="color:#ffb964;">mv ~</span><span>/图片 </span><span style="color:#ffb964;">~</span><span>/Pictures
</span><span style="color:#ffb964;">mv ~</span><span>/视频 </span><span style="color:#ffb964;">~</span><span>/Videos
</span></code></pre>
</li>
<li>
<p><strong>应用更改</strong>
完成以上操作后,运行以下命令应用新配置:</p>
<pre data-lang="bash" style="background-color:#151515;color:#e8e8d3;" class="language-bash "><code class="language-bash" data-lang="bash"><span style="color:#ffb964;">xdg-user-dirs-update
</span></code></pre>
</li>
</ol>
<p>这样,<code>home</code> 目录下的文件夹就会改为英文,并且系统也会正确识别这些新的目录路径。</p>
</div>
<div class="pagination">
<div class="pagination__title">
<span class="pagination__title-h">Thanks for reading! Read other posts?</span>
<hr />
</div>
<div class="pagination__buttons">
<span class="button previous">
<a href="https://blog.dich.bid/learn-linux-for-pc-1/">
<span class="button__icon"></span>&nbsp;
<span class="button__text">Linux之旅(1):构成与发行版</span>
</a>
</span>
<span class="button next">
<a href="https://blog.dich.bid/learn-linux-for-pc-3/">
<span class="button__text">Linux之旅(3):内核&#x2F;shell&#x2F;包管理&#x2F;文件系统&#x2F;桌面环境</span>&nbsp;
<span class="button__icon"></span>
</a>
</span>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="footer__inner">
<div class="copyright">
<span>©
2025
Dichgrem</span>
<span class="copyright-theme">
<span class="copyright-theme-sep"> :: CC BY-SA 4.0 :: A friend comes from distant lands</span>
</a>
</span>
</div>
</div>
</footer>
</div>
</body>
</html>

View File

@ -1,358 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Dich&#x27;blog</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta name="robots" content="noodp"/>
<link rel="stylesheet" href="https://blog.dich.bid/style.css">
<link rel="stylesheet" href="https://blog.dich.bid/color/blue.css">
<link rel="stylesheet" href="https://blog.dich.bid/color/background_dark.css">
<link rel="stylesheet" href="https://blog.dich.bid/font-hack-subset.css">
<meta name="description" content="">
<meta property="og:description" content="">
<meta property="og:title" content="Dich'blog">
<meta property="og:type" content="article">
<meta property="og:url" content="https://blog.dich.bid/learn-linux-for-pc-3/">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:description" content="">
<meta name="twitter:title" content="Dich'blog">
<meta property="twitter:domain" content="blog.dich.bid">
<meta property="twitter:url" content="https://blog.dich.bid/learn-linux-for-pc-3/">
<link rel="alternate" type="application/atom+xml" title="Dich&#x27;blog Atom Feed" href="https://blog.dich.bid/atom.xml" />
<link rel="icon" type="image/png" href=&#x2F;dich.webp />
<!-- ✅ Added center alignment styles -->
<style>
.footer {
text-align: center;
padding: 1rem 0;
}
.footer__inner {
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
.copyright {
text-align: center;
}
</style>
</head>
<body class="">
<div class="container">
<header class="header">
<div class="header__inner">
<div class="header__logo">
<a href="https://blog.dich.bid" style="text-decoration: none;">
<div class="logo">
Dich&#x27;blog
</div>
</a>
</div>
</div>
<nav class="menu">
<ul class="menu__inner">
<li class="active"><a href="https://blog.dich.bid">blog</a></li>
<li><a href="https://blog.dich.bid/archive">archive</a></li>
<li><a href="https://blog.dich.bid/tags">tags</a></li>
<li><a href="https://blog.dich.bid/weekly">weekly</a></li>
<li><a href="https://blog.dich.bid/search">search</a></li>
<li><a href="https://blog.dich.bid/about">about me</a></li>
<li><a href="https://blog.dich.bid/links">links</a></li>
<li><a href="https://blog.dich.bid/atom.xml">rss</a></li>
<li><a href="https://github.com/Dichgrem" target="_blank" rel="noopener noreferrer">github</a></li>
</ul>
</nav>
</header>
<div class="content">
<div class="post">
<h1 class="post-title"><a href="https://blog.dich.bid/learn-linux-for-pc-3/">Linux之旅(3):内核&#x2F;shell&#x2F;包管理&#x2F;文件系统&#x2F;桌面环境</a></h1>
<div class="post-meta-inline">
<span class="post-date">
2023-07-22
</span>
</div>
<span class="post-tags-inline">
:: tags:&nbsp;
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
<div class="post-content">
<p>前言 在Linux世界中内核/shell/包管理/文件系统构成了Linux系统的核心它们相互配合共同构建了一个强大而稳定的操作环境。本文将深入探讨这些关键组成部分解释它们的作用和原理帮助读者更好地理解Linux系统的运作机制。</p>
<span id="continue-reading"></span><h2 id="yi-linuxnei-he"><strong>一.Linux内核</strong></h2>
<p>有许多不同的版本每个版本都包含了一系列的功能改进、bug修复和性能优化。在Linux发行版中通常会使用某个特定版本的Linux内核或者在需要时进行升级。以下是一些常见的Linux内核及其主要特点</p>
<p><strong>Zen内核</strong></p>
<ul>
<li>Zen内核是Linux内核的一个变体旨在提供更好的性能和响应性。它通常包含了一些特定的调度程序和调优参数以提高系统的负载均衡和响应速度。Zen内核也可能包含一些来自其他内核变体的功能和补丁以进一步优化性能。</li>
</ul>
<p><strong>LTS内核</strong></p>
<ul>
<li>LTSLong-Term Support内核是一种长期支持的内核版本它会获得更长时间的更新和维护。LTS内核通常会选择一些相对稳定和经过充分测试的功能并对其进行长期支持以确保系统的稳定性和安全性。</li>
</ul>
<p><strong>Real-Time内核</strong></p>
<ul>
<li>Real-Time内核是一种专门针对实时应用场景进行优化的内核变体。它通常包含了一些实时调度算法和机制以确保系统能够及时响应各种事件并满足实时性要求。Real-Time内核适用于一些对实时性要求较高的应用如工业控制、机器人控制等领域。</li>
</ul>
<p><strong>Hardened内核</strong></p>
<ul>
<li>Hardened内核是一种针对安全性进行优化的内核变体。它通常包含了一些安全增强功能和补丁以提高系统的安全性和抵御攻击的能力。Hardened内核适用于一些对安全性要求较高的应用如服务器、云计算等场景。</li>
</ul>
<p><strong>XanMod内核</strong></p>
<ul>
<li>XanMod内核是一个基于Linux内核的自定义内核旨在提供更好的响应性和性能。它包含了一些针对桌面和工作站系统优化的功能和补丁如MuQSS调度器、BFQ I/O调度器等以提高系统的响应速度和性能稳定性。XanMod内核还支持一些实时性应用如音视频处理等适用于对系统响应速度要求较高的用户。</li>
</ul>
<p><strong>CachyOS内核</strong></p>
<ul>
<li>CachyOS内核是一个专门针对缓存优化的Linux内核变体。它包含了一些针对缓存系统优化的功能和调整以提高系统的缓存性能和数据访问速度。CachyOS内核通常适用于需要高性能缓存的应用场景如数据库服务器、Web服务器等。</li>
</ul>
<p>这些内核变体针对不同的需求和使用场景进行了优化可以根据具体的应用需求来选择合适的内核版本。例如如果您需要更好的性能和响应性可以选择Zen内核如果您需要长期支持和稳定性可以选择LTS内核如果您需要实时性能可以选择Real-Time内核如果您需要更高的安全性可以选择Hardened内核。</p>
<h2 id="er-linux-shell"><strong>二.Linux Shell</strong></h2>
<p>在Linux系统中有许多不同的Shell命令行解释器每种Shell都有自己的特点和用途。以下是一些常见的Linux Shell及其主要特点</p>
<p><strong>BashBourne Again Shell</strong></p>
<ul>
<li>Bash是Linux系统中最常用的Shell之一也是默认的命令行解释器。它是Bourne Shell的增强版提供了丰富的功能和扩展性包括命令历史、命令补全、作业控制等。Bash具有良好的兼容性和易用性适用于日常的系统管理和脚本编程。</li>
</ul>
<p><strong>ZshZ Shell</strong></p>
<ul>
<li>Zsh是一种功能强大的Shell提供了丰富的功能和扩展性如更强大的命令补全、自动纠正拼写错误、主题和插件系统等。Zsh具有良好的可定制性和用户体验适用于高级用户和程序员。</li>
</ul>
<p><strong>FishFriendly Interactive Shell</strong></p>
<ul>
<li>Fish是一种用户友好的交互式Shell提供了直观的命令提示和自动补全功能以及丰富的语法高亮和命令提示信息。Fish具有良好的用户体验和易用性适用于初学者和普通用户。</li>
</ul>
<p><strong>DashDebian Almquist Shell</strong></p>
<ul>
<li>Dash是一种轻量级的Shell专门设计用于系统启动过程和脚本执行。Dash具有较高的执行速度和较低的内存占用适用于系统启动脚本和简单的脚本编程。</li>
</ul>
<p>Bash是最常用的Shell之一具有良好的兼容性和功能性Zsh提供了更多的高级特性和定制选项适用于高级用户和程序员Fish具有友好的交互式体验和直观的用户界面适用于初学者和普通用户Dash则是一个轻量级的Shell专门用于系统启动过程和简单的脚本编程。用户可以根据自己的需求和偏好选择合适的Shell。</p>
<h2 id="san-linuxbao-guan-li-qi"><strong>三.Linux包管理器</strong></h2>
<p>在Linux系统中有几种常见的包管理器它们各自管理着不同的发行版具有不同的特点和用途。以下是一些常见的Linux包管理器及其主要特点</p>
<p><strong>APTAdvanced Package Tool</strong></p>
<ul>
<li>APT是Debian系如Debian、Ubuntu中最常用的包管理器之一。它使用基于命令行的工具<code>apt-get</code><code>apt-cache</code>等来安装、升级和删除软件包。APT还支持依赖关系的自动解决使得软件包的安装和管理变得更加方便。</li>
</ul>
<p><strong>YUMYellowdog Updater, Modified</strong></p>
<ul>
<li>YUM是Red Hat系如CentOS、Fedora中常用的包管理器之一。它使用基于命令行的工具<code>yum</code>来管理软件包。YUM具有良好的依赖关系解决能力和事务处理功能使得系统升级和软件包管理变得更加简单和可靠。</li>
</ul>
<p><strong>DNFDandified YUM</strong></p>
<ul>
<li>DNF是YUM的下一代版本逐渐取代了YUM在Fedora和RHEL系列中的地位。DNF具有更快的包查询和事务处理能力以及更友好的用户界面。它是未来主流的包管理器之一。</li>
</ul>
<p><strong>PacmanPackage Manager</strong></p>
<ul>
<li>Pacman是Arch Linux中常用的包管理器也被一些其他发行版如Manjaro采用。Pacman使用简洁的命令<code>pacman -S</code>安装软件包、<code>pacman -Syu</code>更新系统等来管理软件包。Pacman具有简单、直观的界面和快速的操作速度适用于对系统有一定了解的用户。</li>
</ul>
<p><strong>zypper</strong></p>
<ul>
<li>zypper是openSUSE中常用的包管理器它使用基于命令行的工具<code>zypper install</code><code>zypper update</code>等来管理软件包。zypper具有良好的依赖关系解决能力和事务处理功能使得系统升级和软件包管理变得更加简单和可靠。</li>
</ul>
<p><strong>dpkg</strong></p>
<ul>
<li>dpkg是Debian系如Debian、Ubuntu中的低级别软件包管理工具用于直接管理软件包的安装、升级和删除。它提供了一系列的命令<code>dpkg -i</code>安装软件包、<code>dpkg -r</code>删除软件包等。</li>
</ul>
<p><strong>RPMRPM Package Manager</strong></p>
<ul>
<li>RPM是Red Hat系如CentOS、Fedora中的低级别软件包管理工具用于直接管理软件包的安装、升级和删除。它提供了一系列的命令<code>rpm -i</code>安装软件包、<code>rpm -e</code>删除软件包等。</li>
</ul>
<p><strong>Portage</strong></p>
<ul>
<li>Portage是Gentoo Linux中的包管理器它使用源代码进行软件包的安装和管理。Portage具有高度定制化和灵活性允许用户根据需要自定义软件包的编译参数和依赖关系。</li>
</ul>
<p><strong>Snap</strong></p>
<ul>
<li>Snap是一种跨发行版的软件包格式和包管理器允许用户在不同的Linux发行版上安装和管理软件包。Snap具有自包含性和隔离性使得软件包的安装和升级变得更加简单和安全。</li>
</ul>
<p><strong>Flatpak</strong></p>
<ul>
<li>Flatpak是另一种跨发行版的软件包格式和包管理器类似于Snap允许用户在不同的Linux发行版上安装和管理软件包。Flatpak提供了一种统一的应用分发和运行环境使得软件包的安装和升级更加简单和可靠。</li>
</ul>
<h2 id="si-linuxwen-jian-xi-tong"><strong>四.Linux文件系统</strong></h2>
<p>Linux系统支持多种文件系统每种文件系统都有自己的特点和优势适用于不同的应用场景和需求。以下是一些常见的Linux文件系统及其主要特点</p>
<p><strong>ext4</strong></p>
<ul>
<li>ext4是Linux系统中最常用的文件系统之一它是ext文件系统的后续版本提供了更好的性能和扩展性。ext4支持更大的文件和分区大小更快的文件系统检查和恢复速度以及更高的性能和稳定性。</li>
</ul>
<p><strong>Btrfs</strong></p>
<ul>
<li>Btrfs是一种先进的文件系统具有许多先进的功能和特性如快照、数据校验、数据压缩等。Btrfs支持在线扩展和收缩分区大小以及动态添加和删除磁盘适用于需要高级特性和灵活性的应用场景。此外Btrfs对快照功能支持较好。</li>
</ul>
<blockquote>
<p>快照功能是一种文件系统的特性,它允许用户在特定时间点对文件系统的状态进行快照或备份,并且可以在需要时一键恢复到该时间点的状态。
快照允许用户轻松地创建文件系统的历史版本,并在需要时回滚到特定的版本;快照允许用户在文件系统中进行实验和测试,并在测试失败或不需要时轻松地回滚到初始状态,以避免对系统造成影响。在升级或安装过程中出现问题时快速恢复到原始状态</p>
</blockquote>
<p><strong>XFS</strong></p>
<ul>
<li>XFS是一种高性能的日志文件系统适用于大型文件和高吞吐量的应用场景。XFS支持大容量的文件和分区具有较低的碎片化和较高的并发性能适用于大规模存储和数据分析等应用。</li>
</ul>
<p><strong>ZFS</strong></p>
<ul>
<li>ZFS是一种先进的文件系统具有强大的数据管理和保护功能如快照、数据校验、数据压缩等。ZFS支持软件RAID和存储池pool以及动态添加和删除磁盘适用于数据中心和大规模存储等应用场景。</li>
</ul>
<p><strong>F2FS</strong></p>
<ul>
<li>F2FS是一种针对闪存存储设备进行优化的文件系统具有高性能和高可靠性。F2FS支持闪存特性如块擦除计数block erase count和块生命周期管理block lifetime management适用于固态硬盘SSD和闪存卡等闪存设备。</li>
</ul>
<h2 id="wu-linuxzhuo-mian-huan-jing"><strong>五.Linux桌面环境</strong></h2>
<p>Linux系统有多种不同的桌面环境每种环境都有其独特的特点、风格和用户体验。以下是一些常见的Linux桌面环境及其主要特点</p>
<p><strong>GNOME</strong></p>
<ul>
<li>GNOME是一个功能强大、现代化的桌面环境具有直观的用户界面和丰富的功能。它采用了扁平化的设计风格和简洁的用户界面提供了丰富的应用程序和插件适用于普通用户和开发人员。</li>
</ul>
<p><strong>KDE Plasma</strong></p>
<ul>
<li>KDE Plasma是一个灵活、可定制的桌面环境提供了丰富的特性和选项如桌面特效、窗口管理器、小部件等。它采用了现代化的设计风格和强大的桌面管理功能适用于高级用户和技术爱好者。</li>
</ul>
<p><strong>XFCE</strong></p>
<ul>
<li>XFCE是一个轻量级、快速的桌面环境具有简洁的用户界面和低资源消耗。它采用了传统的桌面布局和简约的设计风格提供了基本的桌面管理功能和应用程序适用于老旧计算机和资源有限的环境。</li>
</ul>
<p><strong>LXQt</strong></p>
<ul>
<li>LXQt是一个轻量级、快速的桌面环境是LXDE和Razor-qt的合并项目。它采用了现代化的设计风格和简洁的用户界面提供了丰富的特性和可定制选项适用于资源有限的环境和嵌入式系统。</li>
</ul>
<p><strong>Cinnamon</strong></p>
<ul>
<li>Cinnamon是一个基于GNOME的桌面环境具有类似于传统Windows桌面的用户界面和功能。它采用了传统的桌面布局和直观的用户体验提供了丰富的特性和可定制选项适用于对传统桌面风格有需求的用户。</li>
</ul>
<p>GNOME和KDE Plasma提供了丰富的特性和高度定制化选项适用于高级用户和开发人员XFCE和LXQt则提供了轻量级和快速的用户体验适用于资源有限的环境Cinnamon则提供了类似于传统Windows桌面的用户界面和功能适用于对传统桌面风格有需求的用户。可以根据自己的需求和偏好选择合适的桌面环境。</p>
<blockquote>
<p>当然,也可以使用轻量级的窗口管理器。
窗口管理器是Linux系统中控制窗口布局、管理窗口行为的关键组件。它们决定了窗口的外观和行为方式以及如何管理和排列窗口。以下是一些常见的窗口管理器及其主要特点</p>
</blockquote>
<p><strong>X Window Manager (XWM)</strong></p>
<ul>
<li>X Window Manager是最基本的窗口管理器用于管理X Window系统中的窗口。它提供了最基本的窗口布局和管理功能如窗口移动、调整大小、最小化等。XWM本身并不提供任何外观效果但可以与其他工具配合使用来实现更丰富的窗口管理和外观特性。</li>
</ul>
<p><strong>Openbox</strong></p>
<ul>
<li>Openbox是一个轻量级的窗口管理器具有简洁的用户界面和低资源消耗。它提供了丰富的自定义选项和扩展功能如虚拟桌面、窗口装饰、键盘快捷键等。Openbox适用于资源有限的环境和对简洁风格有需求的用户。</li>
</ul>
<p><strong>i3</strong></p>
<ul>
<li>i3是一个动态平铺窗口管理器采用了平铺式布局将窗口按照一定规则自动排列在屏幕上。它提供了快速的窗口切换和管理功能支持键盘操作和自动布局调整适用于需要高效多任务处理的用户。</li>
</ul>
<p><strong>Awesome</strong></p>
<ul>
<li>Awesome是一个高度可定制的动态平铺窗口管理器具有丰富的特性和扩展功能。它采用Lua脚本语言进行配置和定制支持强大的自定义选项和扩展功能适用于高级用户和技术爱好者。</li>
</ul>
<p><strong>KWin</strong></p>
<ul>
<li>KWin是KDE桌面环境中的默认窗口管理器具有丰富的特性和功能。它提供了多种窗口布局和管理选项支持虚拟桌面、窗口效果、窗口组织等功能适用于需要丰富特性和高度定制化的用户。</li>
</ul>
<p>这些窗口管理器之间的主要异同在于窗口布局、外观效果、自定义选项和功能特性等方面。Openbox和i3提供了简洁的用户界面和低资源消耗适用于资源有限的环境Awesome和KWin则提供了丰富的特性和扩展功能适用于高级用户和技术爱好者。用户可以根据自己的需求和偏好选择合适的窗口管理器。</p>
<blockquote>
<p>Wayland和X11
Wayland和X11都是用于Linux系统的图形显示协议它们负责管理图形用户界面GUI的显示和交互。下面是它们的简要介绍以及异同点</p>
</blockquote>
<ul>
<li>
<p><strong>X11X Window System</strong>
X11是一个由MIT开发的图形显示协议长期以来一直是Linux系统中最常用的图形显示系统。它采用客户端-服务器模型图形应用程序客户端通过X服务器与显示设备服务器进行通信。X11提供了丰富的图形特性和功能如窗口管理、窗口装饰、多任务处理等。</p>
</li>
<li>
<p><strong>Wayland</strong>
Wayland是一个由Red Hat主导开发的新一代图形显示协议旨在取代X11成为Linux系统的标准图形显示系统。Wayland采用了现代化的设计理念和架构取消了X11中复杂的客户端-服务器模型将图形显示功能直接集成到操作系统中。Wayland具有更低的延迟和更高的性能支持更好的硬件加速和多触摸设备以及更简洁的代码结构。</p>
</li>
</ul>
<p><strong>异同点</strong></p>
<ul>
<li><strong>架构差异</strong>X11采用了客户端-服务器模型图形应用程序通过X服务器与显示设备进行通信而Wayland取消了这种模型将图形显示功能直接集成到操作系统中减少了中间层的复杂性。</li>
<li><strong>性能差异</strong>Wayland具有更低的延迟和更高的性能支持更好的硬件加速和多触摸设备使得图形显示更加流畅和响应。</li>
<li><strong>功能差异</strong>X11提供了丰富的图形特性和功能如窗口管理、窗口装饰、多任务处理等Wayland在功能上相对较少但提供了更简洁的代码结构和更好的性能。</li>
<li><strong>兼容性差异</strong>X11在Linux系统中被广泛使用拥有大量的应用程序和工具的支持而Wayland在兼容性方面仍在发展中尚未完全取代X11成为Linux系统的标准图形显示系统。</li>
</ul>
<p>总的来说Wayland是未来Linux系统中的趋势具有更好的性能和更简洁的架构但在兼容性和功能丰富度上仍有待改进。X11则是当前仍然广泛使用的图形显示系统拥有丰富的生态和大量的应用程序支持。</p>
<h2 id="liu-hou-ji"><strong>六.后记</strong></h2>
<p>个人使用推荐Zen+Zsh+Pacman+Btrfs+Hyprland,并使用 paru xxx 来搜索软件包使用paru -S xxx 安装软件。</p>
</div>
<div class="pagination">
<div class="pagination__title">
<span class="pagination__title-h">Thanks for reading! Read other posts?</span>
<hr />
</div>
<div class="pagination__buttons">
<span class="button previous">
<a href="https://blog.dich.bid/learn-linux-for-pc-2/">
<span class="button__icon"></span>&nbsp;
<span class="button__text">Linux之旅(2):FHS与目录结构</span>
</a>
</span>
<span class="button next">
<a href="https://blog.dich.bid/learn-linux-for-pc-4/">
<span class="button__text">Linux之旅(4):TerminalConsole and Shell</span>&nbsp;
<span class="button__icon"></span>
</a>
</span>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="footer__inner">
<div class="copyright">
<span>©
2025
Dichgrem</span>
<span class="copyright-theme">
<span class="copyright-theme-sep"> :: CC BY-SA 4.0 :: A friend comes from distant lands</span>
</a>
</span>
</div>
</div>
</footer>
</div>
</body>
</html>

View File

@ -1,191 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Dich&#x27;blog</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta name="robots" content="noodp"/>
<link rel="stylesheet" href="https://blog.dich.bid/style.css">
<link rel="stylesheet" href="https://blog.dich.bid/color/blue.css">
<link rel="stylesheet" href="https://blog.dich.bid/color/background_dark.css">
<link rel="stylesheet" href="https://blog.dich.bid/font-hack-subset.css">
<meta name="description" content="">
<meta property="og:description" content="">
<meta property="og:title" content="Dich'blog">
<meta property="og:type" content="article">
<meta property="og:url" content="https://blog.dich.bid/learn-linux-for-pc-4/">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:description" content="">
<meta name="twitter:title" content="Dich'blog">
<meta property="twitter:domain" content="blog.dich.bid">
<meta property="twitter:url" content="https://blog.dich.bid/learn-linux-for-pc-4/">
<link rel="alternate" type="application/atom+xml" title="Dich&#x27;blog Atom Feed" href="https://blog.dich.bid/atom.xml" />
<link rel="icon" type="image/png" href=&#x2F;dich.webp />
<!-- ✅ Added center alignment styles -->
<style>
.footer {
text-align: center;
padding: 1rem 0;
}
.footer__inner {
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
.copyright {
text-align: center;
}
</style>
</head>
<body class="">
<div class="container">
<header class="header">
<div class="header__inner">
<div class="header__logo">
<a href="https://blog.dich.bid" style="text-decoration: none;">
<div class="logo">
Dich&#x27;blog
</div>
</a>
</div>
</div>
<nav class="menu">
<ul class="menu__inner">
<li class="active"><a href="https://blog.dich.bid">blog</a></li>
<li><a href="https://blog.dich.bid/archive">archive</a></li>
<li><a href="https://blog.dich.bid/tags">tags</a></li>
<li><a href="https://blog.dich.bid/weekly">weekly</a></li>
<li><a href="https://blog.dich.bid/search">search</a></li>
<li><a href="https://blog.dich.bid/about">about me</a></li>
<li><a href="https://blog.dich.bid/links">links</a></li>
<li><a href="https://blog.dich.bid/atom.xml">rss</a></li>
<li><a href="https://github.com/Dichgrem" target="_blank" rel="noopener noreferrer">github</a></li>
</ul>
</nav>
</header>
<div class="content">
<div class="post">
<h1 class="post-title"><a href="https://blog.dich.bid/learn-linux-for-pc-4/">Linux之旅(4):TerminalConsole and Shell</a></h1>
<div class="post-meta-inline">
<span class="post-date">
2023-07-23
</span>
</div>
<span class="post-tags-inline">
:: tags:&nbsp;
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
<div class="post-content">
<p>前言 在linux的学习过程中我们常常遇到诸如 TerminalConsolebash,zsh,shell,tty 等概念,这些概念常常被混淆,似乎都和命令行相关。本文从历史角度出发介绍它们的前世今生。</p>
<span id="continue-reading"></span><h2 id="zhong-duan-he-kong-zhi-tai">终端和控制台</h2>
<p>终端,英文叫做 terminal ,通常简称为 term控制台英文叫做 console。</p>
<p>要明白这两者的关系,还得从最初的计算机说起。当时的计算机价格昂贵,一台计算机一般是由多个人同时使用的。在这种情况下一台计算机需要连接上许多套键盘和显示器来供多个人使用。在以前专门有这种可以连上一台电脑的设备,只有显示器和键盘,还有简单的处理电路,本身不具有处理计算机信息的能力,他是负责连接到一台正常的计算机上(通常是通过串口) ,然后登陆计算机,并对该计算机进行操作。当然,那时候的计算机操作系统都是多任务多用户的操作系统。这样一台只有显示器和键盘能够通过串口连接到计算机的设备就叫做终端。</p>
<p>而控制台又是什么回事呢?其概念来自于管风琴的控制台。顾名思义,控制台就是一个直接控制设备的台面(一个面板,上面有很多控制按钮)。 在计算机里,把那套直接连接在电脑上的键盘和显示器就叫做控制台。</p>
<p>终端是通过串口连接上的,不是计算机本身就有的设备,而控制台是计算机本身就有的设备,一个计算机只有一个控制台。计算机启动的时候,所有的信息都会显示到控制台上,而不会显示到终端上。也就是说,控制台是计算机的基本设备,而终端是附加设备。 当然,由于控制台也有终端一样的功能,控制台有时候也被模糊的统称为终端。</p>
<p>以上是控制台和终端的历史遗留区别。现在由于计算机硬件越来越便宜,终端和控制台的概念也慢慢演化了。终端和控制台由硬件的概念,演化成了软件的概念。
  </p>
<h2 id="nei-he-yu-wai-ke">内核与外壳</h2>
<p>内核( Kernel )和外壳( Shell )是 linux 的两个主要部分。Kernel 是操作系统的核心,系统的文件管理、进程管理、内存管理、设备管理这些功能,都是由 Kernel 提供的。</p>
<p>用户和操作系统内核交流需要一个工具,那么这个工具就是 Shell。</p>
<p>什么是 Shell在 Linux 中,最常见的 Shell 形式有命令行界面命令行界面和图形界面两种。并不是打开的那个终端窗口就是 Shell如Alacritty、Gnome-Terminal、xterm 、kitty等程序它们不是 Shell而它们里面运行的 Bash、Zsh、fish 等命令行解释器程序,才是 Shell。</p>
<p>那 Alacritty、Gnome-Terminal、xtermxterm 是什么?</p>
<p>它们是终端模拟器。</p>
<p>前面提到过,在远古时代,终端和控制台都是有实体的。控制台直接和计算机在一起,你可以通过控制台控制计算机。终端通过数据线和计算机连接,终端也提供一个键盘和一个屏幕,你可以通过键盘向计算机下达指令,然后通过屏幕观察输出。</p>
<p>但是现在的计算机组成和以前不一样了,一般一台电脑都是自带键盘和屏幕,很少再外接终端设备。</p>
<p>所以 Linux 提供了另外一个更高级的功能,那就是虚拟终端。那就是在一台电脑上,通过软件的模拟,好像有好几个终端连接在这台计算机上一样。</p>
<p>现在说的终端,比如 linux 中的虚拟终端,都是软件的概念。虚拟终端称之为 ttytty 是电传打字机电传打字机 Teletypewriter 的缩写在带显示屏的视频终端出现之前tty是最流行的终端设备。每一个 tty 都有一个编号,在/dev目录下有相应的设备文件。其中/dev/tty1到/dev/tty7可以通过 Ctrl+Alt+F1 到 Ctrl+Alt+F7 进行切换,也可以通过 chvt 命令进行切换,就好比是以前多人公用的计算机中的六个终端设备,这就是为什么这个叫“虚拟终端”的原因。</p>
<h2 id="shi-dai-bian-qian">时代变迁</h2>
<p>随着时间的推移,我们看到了从硬件到软件的转变,以及从多用户共享到个人使用的转变。这种变迁不仅影响了终端和控制台的概念,也塑造了我们对计算机的理解和期待。</p>
</div>
<div class="pagination">
<div class="pagination__title">
<span class="pagination__title-h">Thanks for reading! Read other posts?</span>
<hr />
</div>
<div class="pagination__buttons">
<span class="button previous">
<a href="https://blog.dich.bid/learn-linux-for-pc-3/">
<span class="button__icon"></span>&nbsp;
<span class="button__text">Linux之旅(3):内核&#x2F;shell&#x2F;包管理&#x2F;文件系统&#x2F;桌面环境</span>
</a>
</span>
<span class="button next">
<a href="https://blog.dich.bid/learn-linux-for-pc-5/">
<span class="button__text">Linux之旅(5):BIOS-UEFI-MBR-GPT-GRUB</span>&nbsp;
<span class="button__icon"></span>
</a>
</span>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="footer__inner">
<div class="copyright">
<span>©
2025
Dichgrem</span>
<span class="copyright-theme">
<span class="copyright-theme-sep"> :: CC BY-SA 4.0 :: A friend comes from distant lands</span>
</a>
</span>
</div>
</div>
</footer>
</div>
</body>
</html>

View File

@ -1,287 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Dich&#x27;blog</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta name="robots" content="noodp"/>
<link rel="stylesheet" href="https://blog.dich.bid/style.css">
<link rel="stylesheet" href="https://blog.dich.bid/color/blue.css">
<link rel="stylesheet" href="https://blog.dich.bid/color/background_dark.css">
<link rel="stylesheet" href="https://blog.dich.bid/font-hack-subset.css">
<meta name="description" content="">
<meta property="og:description" content="">
<meta property="og:title" content="Dich'blog">
<meta property="og:type" content="article">
<meta property="og:url" content="https://blog.dich.bid/learn-linux-for-pc-5/">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:description" content="">
<meta name="twitter:title" content="Dich'blog">
<meta property="twitter:domain" content="blog.dich.bid">
<meta property="twitter:url" content="https://blog.dich.bid/learn-linux-for-pc-5/">
<link rel="alternate" type="application/atom+xml" title="Dich&#x27;blog Atom Feed" href="https://blog.dich.bid/atom.xml" />
<link rel="icon" type="image/png" href=&#x2F;dich.webp />
<!-- ✅ Added center alignment styles -->
<style>
.footer {
text-align: center;
padding: 1rem 0;
}
.footer__inner {
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
.copyright {
text-align: center;
}
</style>
</head>
<body class="">
<div class="container">
<header class="header">
<div class="header__inner">
<div class="header__logo">
<a href="https://blog.dich.bid" style="text-decoration: none;">
<div class="logo">
Dich&#x27;blog
</div>
</a>
</div>
</div>
<nav class="menu">
<ul class="menu__inner">
<li class="active"><a href="https://blog.dich.bid">blog</a></li>
<li><a href="https://blog.dich.bid/archive">archive</a></li>
<li><a href="https://blog.dich.bid/tags">tags</a></li>
<li><a href="https://blog.dich.bid/weekly">weekly</a></li>
<li><a href="https://blog.dich.bid/search">search</a></li>
<li><a href="https://blog.dich.bid/about">about me</a></li>
<li><a href="https://blog.dich.bid/links">links</a></li>
<li><a href="https://blog.dich.bid/atom.xml">rss</a></li>
<li><a href="https://github.com/Dichgrem" target="_blank" rel="noopener noreferrer">github</a></li>
</ul>
</nav>
</header>
<div class="content">
<div class="post">
<h1 class="post-title"><a href="https://blog.dich.bid/learn-linux-for-pc-5/">Linux之旅(5):BIOS-UEFI-MBR-GPT-GRUB</a></h1>
<div class="post-meta-inline">
<span class="post-date">
2023-07-24
</span>
</div>
<span class="post-tags-inline">
:: tags:&nbsp;
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
<div class="post-content">
<p>前言 在计算机领域系统引导和磁盘分区是至关重要的。本文将介绍BIOS与UEFIMBR与GPT以及它们之间的异同点。此外我们还会讨论与这些概念密切相关的引导加载程序——GRUB。</p>
<span id="continue-reading"></span><h2 id="bios">BIOS</h2>
<blockquote>
<p><code>BIOSBasic Input Output System</code>,直译成中文名称就是"<code>基本输入输出系统</code>"。它是一组固化到主板中一个ROM芯片上的程序它可以从CMOS中读写系统设置的具体信息。此程序保存着计算机最重要的基本输入输出程序、开机后的自检程序和系统自启动程序。简单来说BIOS只认识设备不认识分区、不认识文件。</p>
</blockquote>
<h2 id="uefi">UEFI</h2>
<blockquote>
<p>UEFI统一可扩展固件接口是一个公开的规范定义了操作系统和平台固件之间的软件接口。UEFI 是传统 PC BIOS 的继承者是取代传统BIOS的相比传统BIOS来说它更易实现容错和纠错特性也更强。 它将引导数据存储在 .efi 文件中,而不是固件中。你经常会在新款的主板中找到 UEFI 启动模式。UEFI 启动模式包含一个特殊的 EFI 分区,用于存储 .efi 文件并用于引导过程和引导加载程序。</p>
</blockquote>
<blockquote>
<p>UEFI使用GPT的分区引导方案支持更大的硬盘。由于省去了BIOS自检的过程所以启动速度更快。传统BIOS主要支持MBR引导UEFI则是取代传统BIOS它加入了对新硬件的支持其中就有支持2TB以上硬盘。</p>
</blockquote>
<h2 id="mbr">MBR</h2>
<blockquote>
<p>全新硬盘在使用之前必须进行分区格式化,硬盘分区初始化的格式主要有两种,分别为<code>MBR</code>格式和<code>GPT</code>格式。MBR是传统的分区表类型当一台电脑启动时它会先启动主板上的BIOS系统BIOS再从硬盘上读取MBR主引导记录硬盘上的MBR运行后就会启动操作系统但最大的缺点则是不支持容量大于2T的硬盘。</p>
</blockquote>
<h2 id="gpt">GPT</h2>
<blockquote>
<p>而GPT是另一种更先进的磁盘系统分区方式它的出现弥补了MBR这个缺点最大支持<code>18EB</code>的硬盘,是基于<code>UEFI</code>使用的磁盘分区架构。目前所有Windows系统均支持<code>MBR</code>,而<code>GPT</code>只有<code>64</code>位系统才能支持。<code>BIOS只支持MBR引导系统而GPT仅可用UEFI引导系统</code>。正因为这样现在主板大多采用BIOS集成UEFI或UEFI集成BIOS以此达到同时兼容MBR和GPT引导系统的目的。</p>
</blockquote>
<h2 id="grub">GRUB</h2>
<blockquote>
<p>GRUBGRand unified bootloader,多操作系统启动程序。它允许用户可以在计算机内同时拥有多个操作系统,并在计算机启动时选择希望运行的操作系统。</p>
<p>GRUB可用于选择操作系统分区上的不同内核也可用于向这些内核传递启动参数。<code>它是一个多重操作系统启动管理器,用来引导不同系统</code>如Windows、Linux。Linux常见的引导程序包括LILO、GRUB、GRUB2。</p>
</blockquote>
<h2 id="legacy">Legacy</h2>
<blockquote>
<p>如果你遇到过刚制作的U盘启动盘无法启动或者新买的固态硬盘做好系统后无法启动那么大概率的问题就出现在BIOS的引导模式的选择上是UEFI还是Legacy。legacy启动模式是指BIOS 固件用来初始化硬件设备的引导过程Legacy启动模式包含一系列已安装的设备这些设备在引导过程中计算机执行 POST (开机自检)测试时会被初始化。传统引导将检查所有连接设备的主引导记录 (MBR),通常位于磁盘的第一个扇区。<br />
当它在设备中找不到引导加载程序时Legacy会切换到列表中的下一个设备并不断重复此过程直到找到引导加载程序否则返回错误。</p>
</blockquote>
<h2 id="biao-ge">表格</h2>
<h3 id="bios-uefi">BIOS/UEFI</h3>
<table><thead><tr><th>BIOS</th><th>UEFI</th></tr></thead><tbody>
<tr><td>用于初始化计算机硬件并引导操作系统</td><td>在计算机启动时运行</td></tr>
<tr><td>具有较少功能和灵活性</td><td>具有更多功能和灵活性</td></tr>
<tr><td></td><td>支持更大的硬盘容量、更快的启动速度、更好的安全性和更多的扩展性v</td></tr>
<tr><td></td><td>通常具有图形用户界面GUI</td></tr>
</tbody></table>
<h3 id="mbr-gpt">MBR/GPT</h3>
<table><thead><tr><th>MBR</th><th>GPT</th></tr></thead><tbody>
<tr><td>用于分区磁盘并存储分区布局信息</td><td>用于分区磁盘并存储分区布局信息</td></tr>
<tr><td>支持最多4个主分区或3个主分区加1个扩展分区</td><td>支持最多4个主分区或3个主分区加1个扩展分区支持最多4个主分区或3个主分区加1个扩展分区</td></tr>
<tr><td></td><td>具有更好的数据完整性和可靠性,使用校验和检测数据损坏</td></tr>
<tr><td></td><td>UEFI需要GPT格式的磁盘才能引导</td></tr>
</tbody></table>
<h3 id="uefi-legacy">UEFI/Legacy</h3>
<table><thead><tr><th>UEFI 引导模式</th><th>Legacy引导模式</th></tr></thead><tbody>
<tr><td>UEFI 提供了更好的用户界面</td><td>Legacy引导模式是传统的且非常基本的</td></tr>
<tr><td>使用 GPT 分区方案</td><td>使用 MBR 分区方案</td></tr>
<tr><td>UEFI 提供更快的启动时间</td><td>相比UEFI它的速度较慢</td></tr>
<tr><td>由于 UEFI 使用 GPT 分区方案,因此它可以支持多达 9 zB 的存储设备</td><td>Legacy使用的 MBR 分区方案仅支持最多 2 TB 存储设备</td></tr>
<tr><td>UEFI 以 32 位和 64 位运行,支持鼠标和触摸板</td><td>Legacy在仅支持键盘仅 16 位模式下运行</td></tr>
<tr><td>它允许安全启动防止加载未经授权的应用程序它还可能阻碍双启动因为它将操作系统OS视为应用程序</td><td>它不提供允许加载未经授权的应用程序的安全启动方法,未限制双启动</td></tr>
<tr><td>它具有更简单的更新过程</td><td>与UEFI相比它更复杂</td></tr>
</tbody></table>
<h2 id="zu-he">组合</h2>
<ul>
<li>
<p><strong>BIOS+MBR</strong></p>
<p>这是最传统的,系统都会支持;唯一的缺点就是<code>不支持容量大于2T的硬盘</code></p>
</li>
<li>
<p><strong>BIOS+GPT</strong></p>
<p>BIOS是可以使用GPT分区表的硬盘来作为数据盘的但不能引导系统若电脑同时带有容量小于2T的硬盘和容量大于2T的硬盘<code>小于2T的可以用MBR分区表安装系统而大于2T的可以使用GPT分区表来存放资料</code>。但系统须使用64位系统。</p>
</li>
<li>
<p><strong>UEFI+MBR</strong></p>
<p>可以把UEFI设置成<code>Legacy模式</code>传统模式让其支持传统MBR启动效果同<code>BIOS+MBR</code>也可以建立FAT分区放置UEFI启动文件来可应用在U盘和移动硬盘上实现双模式启动。</p>
</li>
<li>
<p><strong>UEFI+GPT</strong></p>
<p>如果要把大于2T的硬盘作为系统盘来安装系统的话就必须<code>UEFI+GPT</code>。而且系统须使用64位系统否则无法引导。但系统又不是传统在PE下安装后就能直接使用的引导还得经过处理才行。</p>
</li>
</ul>
<h2 id="xi-tong-de-qi-dong-guo-cheng">系统的启动过程</h2>
<p>从按下计算机的开机按钮到用户开始使用计算机,涉及了多个步骤和组件,让我们一起详细了解整个过程:</p>
<p><strong>1. 电源启动</strong></p>
<ul>
<li>用户按下计算机的开机按钮电源开始供电计算机硬件开始初始化。电源将电流传递到主板上的BIOS/UEFI芯片。</li>
</ul>
<p><strong>2. BIOS/UEFI启动</strong></p>
<ul>
<li>BIOS/UEFI芯片接收到电源信号后开始执行初始化过程。它首先进行自检POST检测主板、CPU、内存等硬件设备的工作状态并在显示屏上输出相关信息。</li>
<li>BIOS/UEFI根据配置的启动顺序通常为硬盘、光盘、USB等搜索启动设备并加载位于启动设备上的引导加载程序。</li>
</ul>
<p><strong>3. 引导加载程序加载</strong></p>
<ul>
<li>引导加载程序如GRUB被加载到内存中它负责后续的操作系统加载过程。GRUB通常会显示启动菜单列出可用的操作系统选项。</li>
<li>用户可以在GRUB菜单中选择要启动的操作系统或者等待默认选项启动。</li>
</ul>
<p><strong>4. 操作系统加载</strong></p>
<ul>
<li>一旦选择了启动选项引导加载程序会加载操作系统的内核和初始化RAM磁盘initramfs/initrd</li>
<li>内核加载完成后,操作系统开始启动初始化过程,包括加载系统服务、挂载文件系统、启动用户界面等。</li>
</ul>
<p><strong>5. 用户登录</strong></p>
<ul>
<li>操作系统初始化完成后,显示登录界面(如果配置了图形用户界面),用户输入用户名和密码登录系统。</li>
<li>如果登录成功,操作系统加载用户的桌面环境或命令行界面,用户开始使用计算机。</li>
</ul>
<h2 id="ge-chong-yin-dao-jia-zai-cheng-xu">各种引导加载程序</h2>
<table><thead><tr><th>特性</th><th>GRUBGRand Unified Bootloader</th><th>LILOLinux Loader</th><th>systemd-boot前身为 gummiboot</th><th>rEFIndUEFI 引导管理器)</th></tr></thead><tbody>
<tr><td><strong>支持的系统类型</strong></td><td>BIOS 和 UEFI</td><td>仅支持 BIOS 模式</td><td>仅支持 UEFI</td><td>仅支持 UEFI</td></tr>
<tr><td><strong>多系统引导支持</strong></td><td>✅ 强大支持</td><td>❌ 不支持多系统引导</td><td>✅ 支持(需手动配置)</td><td>✅ 自动检测操作系统</td></tr>
<tr><td><strong>图形界面支持</strong></td><td>✅ 支持(可自定义主题)</td><td>❌ 不支持</td><td>❌ 不支持</td><td>✅ 支持(可自定义主题)</td></tr>
<tr><td><strong>配置方式</strong></td><td>配置文件(复杂)</td><td>配置文件(简单)</td><td>配置文件(简单)</td><td>配置文件(简单)</td></tr>
<tr><td><strong>命令行支持</strong></td><td>✅ 支持(交互式命令行)</td><td>❌ 不支持</td><td>❌ 不支持</td><td>❌ 不支持</td></tr>
<tr><td><strong>文件系统支持</strong></td><td>✅ 支持多种文件系统</td><td>✅ 支持 ext2/ext3/ext4 等</td><td>✅ 支持 ext4、FAT 等</td><td>✅ 支持 ext4、FAT 等</td></tr>
<tr><td><strong>安全启动支持</strong></td><td>✅ 支持(需配置)</td><td>❌ 不支持</td><td>✅ 支持(需配置)</td><td>✅ 支持(需配置)</td></tr>
<tr><td><strong>安装复杂度</strong></td><td>中等(需配置)</td><td>较低</td><td>较低</td><td>中等(需配置)</td></tr>
<tr><td><strong>适用场景</strong></td><td>多系统引导、复杂配置</td><td>简单系统引导</td><td>简单系统引导</td><td>多系统引导、美观界面</td></tr>
</tbody></table>
<h2 id="hou-ji">后记</h2>
<ul>
<li><a href="https://segmentfault.com/a/1190000020850901">聊聊BIOS、UEFI、MBR、GPT、GRUB……</a></li>
</ul>
</div>
<div class="pagination">
<div class="pagination__title">
<span class="pagination__title-h">Thanks for reading! Read other posts?</span>
<hr />
</div>
<div class="pagination__buttons">
<span class="button previous">
<a href="https://blog.dich.bid/learn-linux-for-pc-4/">
<span class="button__icon"></span>&nbsp;
<span class="button__text">Linux之旅(4):TerminalConsole and Shell</span>
</a>
</span>
<span class="button next">
<a href="https://blog.dich.bid/learn-linux-for-pc-6/">
<span class="button__text">Linux之旅(6):常用命令与性能分析</span>&nbsp;
<span class="button__icon"></span>
</a>
</span>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="footer__inner">
<div class="copyright">
<span>©
2025
Dichgrem</span>
<span class="copyright-theme">
<span class="copyright-theme-sep"> :: CC BY-SA 4.0 :: A friend comes from distant lands</span>
</a>
</span>
</div>
</div>
</footer>
</div>
</body>
</html>

View File

@ -1,353 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Dich&#x27;blog</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta name="robots" content="noodp"/>
<link rel="stylesheet" href="https://blog.dich.bid/style.css">
<link rel="stylesheet" href="https://blog.dich.bid/color/blue.css">
<link rel="stylesheet" href="https://blog.dich.bid/color/background_dark.css">
<link rel="stylesheet" href="https://blog.dich.bid/font-hack-subset.css">
<meta name="description" content="">
<meta property="og:description" content="">
<meta property="og:title" content="Dich'blog">
<meta property="og:type" content="article">
<meta property="og:url" content="https://blog.dich.bid/learn-linux-for-pc-6/">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:description" content="">
<meta name="twitter:title" content="Dich'blog">
<meta property="twitter:domain" content="blog.dich.bid">
<meta property="twitter:url" content="https://blog.dich.bid/learn-linux-for-pc-6/">
<link rel="alternate" type="application/atom+xml" title="Dich&#x27;blog Atom Feed" href="https://blog.dich.bid/atom.xml" />
<link rel="icon" type="image/png" href=&#x2F;dich.webp />
<!-- ✅ Added center alignment styles -->
<style>
.footer {
text-align: center;
padding: 1rem 0;
}
.footer__inner {
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
.copyright {
text-align: center;
}
</style>
</head>
<body class="">
<div class="container">
<header class="header">
<div class="header__inner">
<div class="header__logo">
<a href="https://blog.dich.bid" style="text-decoration: none;">
<div class="logo">
Dich&#x27;blog
</div>
</a>
</div>
</div>
<nav class="menu">
<ul class="menu__inner">
<li class="active"><a href="https://blog.dich.bid">blog</a></li>
<li><a href="https://blog.dich.bid/archive">archive</a></li>
<li><a href="https://blog.dich.bid/tags">tags</a></li>
<li><a href="https://blog.dich.bid/weekly">weekly</a></li>
<li><a href="https://blog.dich.bid/search">search</a></li>
<li><a href="https://blog.dich.bid/about">about me</a></li>
<li><a href="https://blog.dich.bid/links">links</a></li>
<li><a href="https://blog.dich.bid/atom.xml">rss</a></li>
<li><a href="https://github.com/Dichgrem" target="_blank" rel="noopener noreferrer">github</a></li>
</ul>
</nav>
</header>
<div class="content">
<div class="post">
<h1 class="post-title"><a href="https://blog.dich.bid/learn-linux-for-pc-6/">Linux之旅(6):常用命令与性能分析</a></h1>
<div class="post-meta-inline">
<span class="post-date">
2023-07-25
</span>
</div>
<span class="post-tags-inline">
:: tags:&nbsp;
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
<div class="post-content">
<p>前言 在学习Linux操作系统时熟悉常用命令和性能分析工具是至关重要的。让我们一起探索Linux的世界提升技能解锁无限可能</p>
<span id="continue-reading"></span>
<blockquote>
<p>翻译自https://medium.com/netflix-techblog/linux-performance-analysis-in-60-000-milliseconds-accc10403c55。</p>
</blockquote>
<h2 id="wen-ti-bei-jing"><strong>问题背景</strong></h2>
<p>当登录到一台有性能问题的Linux服务器第一分钟要检查什么</p>
<p>在Netflix我们拥有庞大的EC2 Linux虚拟机云我们有众多性能分析工具来监视和诊断这些Linux服务器的性能。这些工具包括Atlas负责整个虚拟机云的监控和Vector负责按需对虚拟机实例进行性能分析。这些工具可以帮助我们解决大多数问题但有时我们需要登录到虚拟机实例并运行一些标准的Linux性能工具。</p>
<h2 id="qian-60miao-zhai-yao"><strong>前60秒摘要</strong></h2>
<p>在本文中Netflix性能工程团队将使用您应该使用的标准Linux工具在命令行中向您展示一个性能诊断过程的前60秒。在60秒内您可以通过运行以下十个命令来了解有关系统资源使用和运行进程的信息。最应该关注的是一些很容易理解的错误、饱和度指标和资源利用率等指标。饱和度是衡量资源负载超出其处理能力的指标它可以通过观察请求队列的长度或等待时间反映出来。</p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>uptime
</span><span>dmesg | tail
</span><span>vmstat 1
</span><span>mpstat -P ALL 1
</span><span>pidstat 1
</span><span>iostat -xz 1
</span><span>free -m
</span><span>sar -n DEV 1
</span><span>sar -n TCP,ETCP 1
</span><span>top
</span></code></pre>
<p>其中的一些命令需要安装sysstat软件包。这些命令暴露出的指标将帮助您完成一些USE方法一种查找性能瓶颈的方法。它们涉及检查所有资源CPU、内存、磁盘等的利用率饱和度和错误指标。在诊断过程中还应该注意检查和排除某些资源的问题。因为通过排除某些资源的问题可以缩小诊断的范围并指民后续的诊断。</p>
<h2 id="uptime"><strong>uptime</strong></h2>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>$ uptime
</span><span>23:51:26 up 21:31, 1 user, load average: 30.02, 26.43, 19.02
</span></code></pre>
<p>这是快速查看平均负载的方法该平均负载指标了要运行的任务进程的数量。在Linux系统上这些数字包括要在CPU上运行的进程以及在不中断IO通常是磁盘IO中阻塞的进程。这里给出了资源负载高层次的概览但是没有其它工具就很难正确理解值得快速看一眼。</p>
<p>这三个数字是指数衰减移动平均值分别代表了1分钟、5分钟、15分钟的平均值。这三个数字使我们对负载如何随时间变化有了一定的了解。例如如果您去诊断一个有问题的服务器发现1分钟的值比15分钟的值低很多那么您可能已经登录得太晚了错过了问题。</p>
<p>在上面的例子中平均负载有所增加因为1分钟的值30相对15分钟的值19来说大了一些。数字变大意味着很多种可能有可能是CPU的需求变多了使用3和4中提到的vmstat或mpstat命令将可以进一步确认问题。</p>
<h2 id="dmesg-tail"><strong>dmesg|tail</strong></h2>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>$ dmesg | tail
</span><span>[1880957.563150] perl invoked oom-killer: gfp_mask=0x280da, order=0, oom_score_adj=0
</span><span>[...]
</span><span>[1880957.563400] Out of memory: Kill process 18694 (perl) score 246 or sacrifice child
</span><span>[1880957.563408] Killed process 18694 (perl) total-vm:1972392kB, anon-rss:1953348kB, file-rss:0kB
</span><span>[2320864.954447] TCP: Possible SYN flooding on port 7001. Dropping request. Check SNMP counters.
</span></code></pre>
<p>该命令展示最近 10条系统消息。在这些系统消息中查找有可能引起性能问题的报错。上面的例子包括oom-killer和TCP丢弃了一个请求。</p>
<p>不能忘记这个步骤dmesg通常对诊断问题很有价值。</p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>## **vmstat 1**
</span><span>$ vmstat 1
</span><span>procs ---------memory---------- ---swap-- -----io---- -system-- ------cpu-----
</span><span> r b swpd free buff cache si so bi bo in cs us sy id wa st
</span><span>34 0 0 200889792 73708 591828 0 0 0 5 6 10 96 1 3 0 0
</span><span>32 0 0 200889920 73708 591860 0 0 0 592 13284 4282 98 1 1 0 0
</span><span>32 0 0 200890112 73708 591860 0 0 0 0 9501 2154 99 1 0 0 0
</span><span>32 0 0 200889568 73712 591856 0 0 0 48 11900 2459 99 0 0 0 0
</span><span>32 0 0 200890208 73712 591860 0 0 0 0 15898 4840 98 1 1 0 0
</span></code></pre>
<p>vmstat是虚拟内存统计(Virtual Memory Stat)的缩写vmstat(8)是一个通常可用的工具(最初是在之前的BSD时代创建的),它每行打印一行服务器关键统计的概览。</p>
<p>vmstat使用参数1运行意味着每1秒打印打印一次概览。命令输出的第一行展示的是从启动开始的平均值而不是最近一秒的平均值。因此跳过第一行除非您想学习并记住哪一列是哪一列。</p>
<p>要检查的列:</p>
<p>r在CPU上运行并等待回合的进程数。由于它不包含IO因此它比指示CPU饱和的平均负载提供了更多的信息。一个大于CPU核数的r值就是饱和的。
free空闲的内存单位的KB。如果计数很大说明服务器有足够的内存free -m命令将对空闲内存的状态有更好的说明。
si、so交换置入和交换置出。如果这两个值是非空说明物理内存用完了现在在使用交换内存了。
us、sy、id、wa、st这些是CPU时间的分类其是所有CPU的平均值。它们是用户时间、系统时间(内核)、空闲时间、等待IO和被偷窃时间被其它宾客系统进行使用或宾客系统隔离的驱动程序域Xen
通过将用户时间和系统时间这两个分类相加即可判断CPU是否繁忙。一定的等待IO时间说明磁盘有可能是性能瓶颈。你可以认为等待IO时间是另一种形式的空闲时间它提供了它是如何空闲的线索。</p>
<p>IO处理需要占用CPU系统时间。一个较高的CPU系统时间超过20%可能会很有趣有必要进一步研究也许内核在很低效地处理IO。</p>
<p>在上面的示例中CPU时间基本全在用户时间这说明应用程序本身在大量占用CPU时间。CPU的平均利用率也远远超过90%。这不一定是问题可以使用r列来检查饱和度。</p>
<h2 id="mpstat-p-all-1"><strong>mpstat -P ALL 1</strong></h2>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>$ mpstat -P ALL 1
</span><span>Linux 3.13.0-49-generic (titanclusters-xxxxx) 07/14/2015 _x86_64_ (32 CPU)
</span><span>07:38:49 PM CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle
</span><span>07:38:50 PM all 98.47 0.00 0.75 0.00 0.00 0.00 0.00 0.00 0.00 0.78
</span><span>07:38:50 PM 0 96.04 0.00 2.97 0.00 0.00 0.00 0.00 0.00 0.00 0.99
</span><span>07:38:50 PM 1 97.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 2.00
</span><span>07:38:50 PM 2 98.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 1.00
</span><span>07:38:50 PM 3 96.97 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 3.03
</span><span>[...]
</span></code></pre>
<p>此命令显示每个CPU的CPU时间明细可用于检查不平衡的情况。单个热CPU说明是单线程应用程序在大量占用CPU时间。</p>
<h2 id="pidstat-1"><strong>pidstat 1</strong></h2>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>$ pidstat 1
</span><span>Linux 3.13.0-49-generic (titanclusters-xxxxx) 07/14/2015 _x86_64_ (32 CPU)
</span><span>07:41:02 PM UID PID %usr %system %guest %CPU CPU Command
</span><span>07:41:03 PM 0 9 0.00 0.94 0.00 0.94 1 rcuos/0
</span><span>07:41:03 PM 0 4214 5.66 5.66 0.00 11.32 15 mesos-slave
</span><span>07:41:03 PM 0 4354 0.94 0.94 0.00 1.89 8 java
</span><span>07:41:03 PM 0 6521 1596.23 1.89 0.00 1598.11 27 java
</span><span>07:41:03 PM 0 6564 1571.70 7.55 0.00 1579.25 28 java
</span><span>07:41:03 PM 60004 60154 0.94 4.72 0.00 5.66 9 pidstat
</span><span>07:41:03 PM UID PID %usr %system %guest %CPU CPU Command
</span><span>07:41:04 PM 0 4214 6.00 2.00 0.00 8.00 15 mesos-slave
</span><span>07:41:04 PM 0 6521 1590.00 1.00 0.00 1591.00 27 java
</span><span>07:41:04 PM 0 6564 1573.00 10.00 0.00 1583.00 28 java
</span><span>07:41:04 PM 108 6718 1.00 0.00 0.00 1.00 0 snmp-pass
</span><span>07:41:04 PM 60004 60154 1.00 4.00 0.00 5.00 9 pidstat
</span></code></pre>
<p>pidstat有点像top的每个进程摘要但是会滚动打印而不是清屏再打印。这对于观察一段时间内的模式以及将所看到的内容复制&amp;粘贴)记录到调查记录中很有用。</p>
<p>上面的示例显示两个Java进程要为消耗大量CPU负责。%CPU这一列是所有CPU核的总和1591%说明Java进程差不多消耗了16个核的CPU。</p>
<h2 id="iostat-xz-1"><strong>iostat -xz 1</strong></h2>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>$ iostat -xz 1
</span><span>Linux 3.13.0-49-generic (titanclusters-xxxxx) 07/14/2015 _x86_64_ (32 CPU)
</span><span>avg-cpu: %user %nice %system %iowait %steal %idle
</span><span> 73.96 0.00 3.73 0.03 0.06 22.21
</span><span>Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
</span><span>xvda 0.00 0.23 0.21 0.18 4.52 2.08 34.37 0.00 9.98 13.80 5.42 2.44 0.09
</span><span>xvdb 0.01 0.00 1.02 8.94 127.97 598.53 145.79 0.00 0.43 1.78 0.28 0.25 0.25
</span><span>xvdc 0.01 0.00 1.02 8.86 127.79 595.94 146.50 0.00 0.45 1.82 0.30 0.27 0.26
</span><span>dm-0 0.00 0.00 0.69 2.32 10.47 31.69 28.01 0.01 3.23 0.71 3.98 0.13 0.04
</span><span>dm-1 0.00 0.00 0.00 0.94 0.01 3.78 8.00 0.33 345.84 0.04 346.81 0.01 0.00
</span><span>dm-2 0.00 0.00 0.09 0.07 1.35 0.36 22.50 0.00 2.55 0.23 5.62 1.78 0.03
</span><span>[...]
</span></code></pre>
<p>这是了解块设备(磁盘),应用的工作负载和产生的性能影响的绝佳工具。重点关注下面的指标:</p>
<ul>
<li>r/s、w/s、 rkB/s、 wkB/s这些是设备每秒交付的读取、写入、读取千字节和写入千字节。使用这些来表征块设备的工作负载。性能问题可能是由于向块设备施加了过多的工作负载。</li>
<li>awaitIO的平均时间以毫秒为单位。这是应用程序所感受到的时间它包括IO排队时间和IO服务时间。大于预期的平均时间可能表示块设备饱和或设备出现问题了。</li>
<li>avgqu-sz发给设备的平均请求数。值大于1可以表明已达到饱和状态尽管设备通常可以并行处理请求尤其是在多个后端磁盘所组成的前端虚拟设备的情况下</li>
<li>%util设备利用率。这是一个表征繁忙度的百分比它表示设备每秒工作的时间。尽管它的值取决于设备但值大于60%通常会导致性能不佳也会通过await的值观察到。接近100%的值通常表示饱和。</li>
</ul>
<p>如果存储设备是有许多后端磁盘组成的前端逻辑磁盘设备则100%的利用率可能仅意味着100%的时间正在处理某些IO但是后端磁盘可能远远没有饱和并且可能还可以处理更多的工作。</p>
<p>请记住性能不佳的磁盘IO不一定是应用问题通常可以使用许多技术以执行异步IO以便使应用程序不会被阻塞住而产生直接产生IO延迟例如预读和缓冲写入技术</p>
<h2 id="free-m"><strong>free -m</strong></h2>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>$ free -m
</span><span> total used free shared buffers cached
</span><span>Mem: 245998 24545 221453 83 59 541
</span><span>-/+ buffers/cache: 23944 222053
</span><span>Swap: 0 0 0
</span></code></pre>
<p>右边两列:</p>
<p>buffers缓冲区高速缓存用于块设备I / O
cached页面缓存由文件系统使用
我们只需要检查下它们的大小是否接近零。如果接近零的话这可能导致较高的磁盘IO可以使用iostat进行确认和较差的性能。上面的示例看起来不错每列都有较大的数据。</p>
<p>-/+ buffers/cache为已用和空闲内存提供较少让人产生混乱的值。Linux将可用内存用于高速缓存但是如果应用程序需要它们可以快速被回收。因此应以某种方式将缓存的内存包括在free列中这也就是这一行的所做的。甚至还有一个网站专门讨论了这种混乱。</p>
<p>如果在Linux上使用ZFS就像我们对某些服务所做的那么因为ZFS具有自己的文件系统缓存它们并不会反映在free -m的列中因此这种场景下这种混乱还将存在。所以会看到似乎系统的可用内存不足而实际上可根据需要从ZFS缓存中申请到内存。</p>
<h2 id="sar-n-dev-1"><strong>sar -n DEV 1</strong></h2>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>$ sar -n DEV 1
</span><span>Linux 3.13.0-49-generic (titanclusters-xxxxx) 07/14/2015 _x86_64_ (32 CPU)
</span><span>12:16:48 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil
</span><span>12:16:49 AM eth0 18763.00 5032.00 20686.42 478.30 0.00 0.00 0.00 0.00
</span><span>12:16:49 AM lo 14.00 14.00 1.36 1.36 0.00 0.00 0.00 0.00
</span><span>12:16:49 AM docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
</span><span>12:16:49 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil
</span><span>12:16:50 AM eth0 19763.00 5101.00 21999.10 482.56 0.00 0.00 0.00 0.00
</span><span>12:16:50 AM lo 20.00 20.00 3.25 3.25 0.00 0.00 0.00 0.00
</span><span>12:16:50 AM docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
</span></code></pre>
<p>此工具可以检查网络接口的吞吐量rxkB/s和txkB/s作为工作负载的度量还可以检查是否已达到网络接口的限制。在上面的示例中eth0接收速率达到22MB/s即176Mbit/s远低于1Gbit/s的网络接口限制假设是千兆网卡</p>
<p>此版本还具有%ifutil用来指示设备利用率全双工双向这也是我们使用的Brendan的nicstat工具测量出来的。就像nicstat一样这个指标很难计算正确而且在本例中好像不起作用数据是0.00)。</p>
<h2 id="sar-n-tcp-etcp-1"><strong>sar -n TCP,ETCP 1</strong></h2>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>$ sar -n TCP,ETCP 1
</span><span>Linux 3.13.0-49-generic (titanclusters-xxxxx) 07/14/2015 _x86_64_ (32 CPU)
</span><span>12:17:19 AM active/s passive/s iseg/s oseg/s
</span><span>12:17:20 AM 1.00 0.00 10233.00 18846.00
</span><span>12:17:19 AM atmptf/s estres/s retrans/s isegerr/s orsts/s
</span><span>12:17:20 AM 0.00 0.00 0.00 0.00 0.00
</span><span>12:17:20 AM active/s passive/s iseg/s oseg/s
</span><span>12:17:21 AM 1.00 0.00 8359.00 6039.00
</span><span>12:17:20 AM atmptf/s estres/s retrans/s isegerr/s orsts/s
</span><span>12:17:21 AM 0.00 0.00 0.00 0.00 0.00
</span></code></pre>
<p>这是一些关键的TCP指标的摘要包括</p>
<ul>
<li>active / s每秒本地启动的TCP连接数例如通过connect</li>
<li>passive/s每秒远程启动的TCP连接数例如通过accept</li>
<li>retrans / s每秒TCP重传的次数。
主动和被动计数通常作为服务器TCP负载的粗略度量新接受的连接数被动和新出站的连接数主动。将主动视为出站将被动视为入站可能对理解这两个指标有些帮助但这并不是严格意义上的例如考虑从localhost到localhost的连接</li>
</ul>
<p>重新传输是网络或服务器问题的迹象它可能是不可靠的网络例如公共Internet也可能是由于服务器过载并丢弃了数据包。上面的示例仅显示每秒一个新的TCP连接。</p>
<h2 id="top"><strong>top</strong></h2>
<p>$ top</p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>top - 00:15:40 up 21:56, 1 user, load average: 31.09, 29.87, 29.92
</span><span>Tasks: 871 total, 1 running, 868 sleeping, 0 stopped, 2 zombie
</span><span>%Cpu(s): 96.8 us, 0.4 sy, 0.0 ni, 2.7 id, 0.1 wa, 0.0 hi, 0.0 si, 0.0 st
</span><span>KiB Mem: 25190241+total, 24921688 used, 22698073+free, 60448 buffers
</span><span>KiB Swap: 0 total, 0 used, 0 free. 554208 cached Mem
</span><span> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
</span><span> 20248 root 20 0 0.227t 0.012t 18748 S 3090 5.2 29812:58 java
</span><span> 4213 root 20 0 2722544 64640 44232 S 23.5 0.0 233:35.37 mesos-slave
</span><span> 66128 titancl+ 20 0 24344 2332 1172 R 1.0 0.0 0:00.07 top
</span><span> 5235 root 20 0 38.227g 547004 49996 S 0.7 0.2 2:02.74 java
</span><span> 4299 root 20 0 20.015g 2.682g 16836 S 0.3 1.1 33:14.42 java
</span><span> 1 root 20 0 33620 2920 1496 S 0.0 0.0 0:03.82 init
</span><span> 2 root 20 0 0 0 0 S 0.0 0.0 0:00.02 kthreadd
</span><span> 3 root 20 0 0 0 0 S 0.0 0.0 0:05.35 ksoftirqd/0
</span><span> 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
</span><span> 6 root 20 0 0 0 0 S 0.0 0.0 0:06.94 kworker/u256:0
</span><span> 8 root 20 0 0 0 0 S 0.0 0.0 2:38.05 rcu_sched
</span></code></pre>
<p>top命令包括我们之前检查的许多指标。运行它可以很方便地查看是否有任何东西与以前的命令有很大不同这表明负载是可变的。</p>
<p>top命令不太好的地方是随着时间的推移很难看到指标变化的模式这在提供滚动输出的vmstat和pidstat之类的工具中可能更清楚一点。如果您没有足够快地暂停输出Ctrl-S暂停Ctrl-Q继续在屏幕输出被top命令清除后间歇性问题的证据也可能被丢失了。</p>
</div>
<div class="pagination">
<div class="pagination__title">
<span class="pagination__title-h">Thanks for reading! Read other posts?</span>
<hr />
</div>
<div class="pagination__buttons">
<span class="button previous">
<a href="https://blog.dich.bid/learn-linux-for-pc-5/">
<span class="button__icon"></span>&nbsp;
<span class="button__text">Linux之旅(5):BIOS-UEFI-MBR-GPT-GRUB</span>
</a>
</span>
<span class="button next">
<a href="https://blog.dich.bid/learn-linux-for-pc-7/">
<span class="button__text">Linux之旅(7):系统与终端字体设置</span>&nbsp;
<span class="button__icon"></span>
</a>
</span>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="footer__inner">
<div class="copyright">
<span>©
2025
Dichgrem</span>
<span class="copyright-theme">
<span class="copyright-theme-sep"> :: CC BY-SA 4.0 :: A friend comes from distant lands</span>
</a>
</span>
</div>
</div>
</footer>
</div>
</body>
</html>

View File

@ -1,202 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Dich&#x27;blog</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta name="robots" content="noodp"/>
<link rel="stylesheet" href="https://blog.dich.bid/style.css">
<link rel="stylesheet" href="https://blog.dich.bid/color/blue.css">
<link rel="stylesheet" href="https://blog.dich.bid/color/background_dark.css">
<link rel="stylesheet" href="https://blog.dich.bid/font-hack-subset.css">
<meta name="description" content="">
<meta property="og:description" content="">
<meta property="og:title" content="Dich'blog">
<meta property="og:type" content="article">
<meta property="og:url" content="https://blog.dich.bid/learn-linux-for-pc-7/">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:description" content="">
<meta name="twitter:title" content="Dich'blog">
<meta property="twitter:domain" content="blog.dich.bid">
<meta property="twitter:url" content="https://blog.dich.bid/learn-linux-for-pc-7/">
<link rel="alternate" type="application/atom+xml" title="Dich&#x27;blog Atom Feed" href="https://blog.dich.bid/atom.xml" />
<link rel="icon" type="image/png" href=&#x2F;dich.webp />
<!-- ✅ Added center alignment styles -->
<style>
.footer {
text-align: center;
padding: 1rem 0;
}
.footer__inner {
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
.copyright {
text-align: center;
}
</style>
</head>
<body class="">
<div class="container">
<header class="header">
<div class="header__inner">
<div class="header__logo">
<a href="https://blog.dich.bid" style="text-decoration: none;">
<div class="logo">
Dich&#x27;blog
</div>
</a>
</div>
</div>
<nav class="menu">
<ul class="menu__inner">
<li class="active"><a href="https://blog.dich.bid">blog</a></li>
<li><a href="https://blog.dich.bid/archive">archive</a></li>
<li><a href="https://blog.dich.bid/tags">tags</a></li>
<li><a href="https://blog.dich.bid/weekly">weekly</a></li>
<li><a href="https://blog.dich.bid/search">search</a></li>
<li><a href="https://blog.dich.bid/about">about me</a></li>
<li><a href="https://blog.dich.bid/links">links</a></li>
<li><a href="https://blog.dich.bid/atom.xml">rss</a></li>
<li><a href="https://github.com/Dichgrem" target="_blank" rel="noopener noreferrer">github</a></li>
</ul>
</nav>
</header>
<div class="content">
<div class="post">
<h1 class="post-title"><a href="https://blog.dich.bid/learn-linux-for-pc-7/">Linux之旅(7):系统与终端字体设置</a></h1>
<div class="post-meta-inline">
<span class="post-date">
2023-08-01
</span>
</div>
<span class="post-tags-inline">
:: tags:&nbsp;
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
<div class="post-content">
<p>前言 一个好看的字体会提高工作效率与审美.Linux 下的字体可以很漂亮,但需要一些设置.</p>
<span id="continue-reading"></span>
<p>随着 FreeType2 由于专利过期默认开启了高质量的 LCD 优化,以及一批高质量的开源字体的公布,Linux 上的中文字体渲染比过去好了太多.</p>
<blockquote>
<p>Windows 的字体渲染从技术上来说是相当先进的,问题是在中文字体的选择上实在是一坨...</p>
</blockquote>
<h2 id="xuan-ze-zi-ti">选择字体</h2>
<p>近几年来出现了一大批自由字体(包括工作量极大的 CJK 字体),使 Linux 下的字体选择一下子丰富了起来.如果愿意花一点时间的话,可以去<a href="https://wiki.archlinux.org/title/Fonts#Font_packages">ArchWiki</a> 上看看,里面涵盖了相当多的自由字体.</p>
<h3 id="zhong-duan-zi-ti">终端字体</h3>
<p><a href="https://github.com/subframe7536/maple-font?tab=readme-ov-file">Maple Mono</a>,这是一款字形整洁、拥有手写风格的斜体、细粒度配置、内置 Nerd-Font、中英文2:1等宽 的字体.我使用的:</p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>MapleMono-Bold
</span></code></pre>
<h3 id="yue-du-qi-zi-ti">阅读器字体</h3>
<p><a href="https://github.com/lxgw/LxgwWenKai">霞鹜文楷</a>,一款开源中文字体,基于 FONTWORKS 出品字体 Klee One 衍生.我使用的:</p>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>LXGW WenKai
</span></code></pre>
<h3 id="liu-lan-qi-zi-ti">浏览器字体</h3>
<pre style="background-color:#151515;color:#e8e8d3;"><code><span>拉丁字体
</span><span>├── Inter -无衬线,类似于 Roboto 但更适合屏幕显示的字体
</span><span>├── Noto Serif -衬线
</span><span>└── Sarasa Term SC -等宽,拉丁文字符严格为半宽的字体,中英文混排时较协调
</span><span>├── 如果不适应这种较瘦的字体风格, 则可以尝试使用:
</span><span>│ ├── Adobe Source Pro
</span><span>│ ├── Cascadia Code
</span><span>│ └── Fira Code
</span><span>中文字体
</span><span>├── Noto Sans CJK SC (思源黑体)
</span><span>└── Noto Serif CJK SC思源宋体
</span></code></pre>
<hr />
<p><strong>Done.</strong></p>
</div>
<div class="pagination">
<div class="pagination__title">
<span class="pagination__title-h">Thanks for reading! Read other posts?</span>
<hr />
</div>
<div class="pagination__buttons">
<span class="button previous">
<a href="https://blog.dich.bid/learn-linux-for-pc-6/">
<span class="button__icon"></span>&nbsp;
<span class="button__text">Linux之旅(6):常用命令与性能分析</span>
</a>
</span>
<span class="button next">
<a href="https://blog.dich.bid/awesome-vm-android/">
<span class="button__text">综合工程:linux搭建安卓虚拟机</span>&nbsp;
<span class="button__icon"></span>
</a>
</span>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="footer__inner">
<div class="copyright">
<span>©
2025
Dichgrem</span>
<span class="copyright-theme">
<span class="copyright-theme-sep"> :: CC BY-SA 4.0 :: A friend comes from distant lands</span>
</a>
</span>
</div>
</div>
</footer>
</div>
</body>
</html>

View File

@ -1,6 +1,12 @@
<!doctype html>
<meta charset="utf-8">
<link rel="canonical" href="https://blog.dich.bid/">
<meta http-equiv="refresh" content="0; url=https://blog.dich.bid/">
<title>Redirect</title>
<script>
const target = "https://blog.dich.bid/";
const hash = window.location.hash || "";
window.location.replace(target + hash);
</script>
<noscript>
<meta http-equiv="refresh" content="0; url=https://blog.dich.bid/">
</noscript>
<p><a href="https://blog.dich.bid/">Click here</a> to be redirected.</p>

View File

@ -1,235 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Dich&#x27;blog</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta name="robots" content="noodp"/>
<link rel="stylesheet" href="https://blog.dich.bid/style.css">
<link rel="stylesheet" href="https://blog.dich.bid/color/blue.css">
<link rel="stylesheet" href="https://blog.dich.bid/color/background_dark.css">
<link rel="stylesheet" href="https://blog.dich.bid/font-hack-subset.css">
<meta name="description" content="用电子罗盘,转赛博核桃,勘电磁风水,寻网络龙脉">
<meta property="og:description" content="用电子罗盘,转赛博核桃,勘电磁风水,寻网络龙脉">
<meta property="og:title" content="Dich'blog">
<meta property="og:type" content="website">
<meta property="og:url" content="https://blog.dich.bid/">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:description" content="用电子罗盘,转赛博核桃,勘电磁风水,寻网络龙脉">
<meta name="twitter:title" content="Dich'blog">
<meta property="twitter:domain" content="blog.dich.bid">
<meta property="twitter:url" content="https://blog.dich.bid/">
<link rel="alternate" type="application/atom+xml" title="Dich&#x27;blog Atom Feed" href="https://blog.dich.bid/atom.xml" />
<link rel="icon" type="image/png" href=&#x2F;dich.webp />
<!-- ✅ Added center alignment styles -->
<style>
.footer {
text-align: center;
padding: 1rem 0;
}
.footer__inner {
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
.copyright {
text-align: center;
}
</style>
</head>
<body class="">
<div class="container">
<header class="header">
<div class="header__inner">
<div class="header__logo">
<a href="https://blog.dich.bid" style="text-decoration: none;">
<div class="logo">
Dich&#x27;blog
</div>
</a>
</div>
</div>
<nav class="menu">
<ul class="menu__inner">
<li class="active"><a href="https://blog.dich.bid">blog</a></li>
<li><a href="https://blog.dich.bid/archive">archive</a></li>
<li><a href="https://blog.dich.bid/tags">tags</a></li>
<li><a href="https://blog.dich.bid/weekly">weekly</a></li>
<li><a href="https://blog.dich.bid/search">search</a></li>
<li><a href="https://blog.dich.bid/about">about me</a></li>
<li><a href="https://blog.dich.bid/links">links</a></li>
<li><a href="https://blog.dich.bid/atom.xml">rss</a></li>
<li><a href="https://github.com/Dichgrem" target="_blank" rel="noopener noreferrer">github</a></li>
</ul>
</nav>
</header>
<div class="content">
<div class="posts">
<div class="post on-list">
<h1 class="post-title"><a href="https://blog.dich.bid/learn-linux-for-pc-3/">Linux之旅(3):内核&#x2F;shell&#x2F;包管理&#x2F;文件系统&#x2F;桌面环境</a></h1>
<div class="post-meta-inline">
<span class="post-date">
2023-07-22
</span>
</div>
<span class="post-tags-inline">
:: tags:&nbsp;
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
<div class="post-content">
<p>前言 在Linux世界中内核/shell/包管理/文件系统构成了Linux系统的核心它们相互配合共同构建了一个强大而稳定的操作环境。本文将深入探讨这些关键组成部分解释它们的作用和原理帮助读者更好地理解Linux系统的运作机制。</p>
</div>
<div>
<!-- &#xFE0E; -- force text style - some devices render this as emoji -->
<a class="read-more button" href="https://blog.dich.bid/learn-linux-for-pc-3/">
<span class="button__text">Read more</span>&nbsp;
<span class="button__icon">&#8617;&#xFE0E;</span>
</a>
</div>
</div>
<div class="post on-list">
<h1 class="post-title"><a href="https://blog.dich.bid/learn-linux-for-pc-2/">Linux之旅(2):FHS与目录结构</a></h1>
<div class="post-meta-inline">
<span class="post-date">
2023-07-21
</span>
</div>
<span class="post-tags-inline">
:: tags:&nbsp;
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
<div class="post-content">
<p>前言 在Linux世界中Filesystem Hierarchy StandardFHS是一座引导我们进入系统核心的桥梁它定义了Linux系统中目录结构的规范与作用为我们提供了一张清晰的地图指引我们轻松管理和理解系统。本文将深入探讨FHS规范与Linux系统目录结构解释各个目录的用途与功能帮助我们更好地理解和利用Linux系统。</p>
</div>
<div>
<!-- &#xFE0E; -- force text style - some devices render this as emoji -->
<a class="read-more button" href="https://blog.dich.bid/learn-linux-for-pc-2/">
<span class="button__text">Read more</span>&nbsp;
<span class="button__icon">&#8617;&#xFE0E;</span>
</a>
</div>
</div>
<div class="post on-list">
<h1 class="post-title"><a href="https://blog.dich.bid/learn-linux-for-pc-1/">Linux之旅(1):构成与发行版</a></h1>
<div class="post-meta-inline">
<span class="post-date">
2023-07-20
</span>
</div>
<span class="post-tags-inline">
:: tags:&nbsp;
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
<div class="post-content">
<p>前言 Linux 作为一款强大、灵活且免费的操作系统吸引了越来越多的用户。然而对于初学者来说Linux 可能显得有些陌生,甚至有些令人望而生畏。本文旨在为那些刚踏入 Linux 世界的新手提供一份指南帮助他们更好地了解、使用这个令人着迷的操作系统。我们将探讨Linux的基本概念解释为何选择Linux深入剖析其主要构成要素以及不同的发行版之间的差异。</p>
</div>
<div>
<!-- &#xFE0E; -- force text style - some devices render this as emoji -->
<a class="read-more button" href="https://blog.dich.bid/learn-linux-for-pc-1/">
<span class="button__text">Read more</span>&nbsp;
<span class="button__icon">&#8617;&#xFE0E;</span>
</a>
</div>
</div>
<div class="pagination">
<div class="pagination__buttons">
<span class="button previous">
<a href="https://blog.dich.bid/page/9/">
<span class="button__icon"></span>&nbsp;
<span class="button__text">Newer posts</span>
</a>
</span>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="footer__inner">
<div class="copyright">
<span>©
2025
Dichgrem</span>
<span class="copyright-theme">
<span class="copyright-theme-sep"> :: CC BY-SA 4.0 :: A friend comes from distant lands</span>
</a>
</span>
</div>
</div>
</footer>
</div>
</body>
</html>

View File

@ -133,138 +133,6 @@
</div>
</div>
<div class="post on-list">
<h1 class="post-title"><a href="https://blog.dich.bid/learn-linux-for-pc-7/">Linux之旅(7):系统与终端字体设置</a></h1>
<div class="post-meta-inline">
<span class="post-date">
2023-08-01
</span>
</div>
<span class="post-tags-inline">
:: tags:&nbsp;
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
<div class="post-content">
<p>前言 一个好看的字体会提高工作效率与审美.Linux 下的字体可以很漂亮,但需要一些设置.</p>
</div>
<div>
<!-- &#xFE0E; -- force text style - some devices render this as emoji -->
<a class="read-more button" href="https://blog.dich.bid/learn-linux-for-pc-7/">
<span class="button__text">Read more</span>&nbsp;
<span class="button__icon">&#8617;&#xFE0E;</span>
</a>
</div>
</div>
<div class="post on-list">
<h1 class="post-title"><a href="https://blog.dich.bid/learn-linux-for-pc-6/">Linux之旅(6):常用命令与性能分析</a></h1>
<div class="post-meta-inline">
<span class="post-date">
2023-07-25
</span>
</div>
<span class="post-tags-inline">
:: tags:&nbsp;
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
<div class="post-content">
<p>前言 在学习Linux操作系统时熟悉常用命令和性能分析工具是至关重要的。让我们一起探索Linux的世界提升技能解锁无限可能</p>
</div>
<div>
<!-- &#xFE0E; -- force text style - some devices render this as emoji -->
<a class="read-more button" href="https://blog.dich.bid/learn-linux-for-pc-6/">
<span class="button__text">Read more</span>&nbsp;
<span class="button__icon">&#8617;&#xFE0E;</span>
</a>
</div>
</div>
<div class="post on-list">
<h1 class="post-title"><a href="https://blog.dich.bid/learn-linux-for-pc-5/">Linux之旅(5):BIOS-UEFI-MBR-GPT-GRUB</a></h1>
<div class="post-meta-inline">
<span class="post-date">
2023-07-24
</span>
</div>
<span class="post-tags-inline">
:: tags:&nbsp;
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
<div class="post-content">
<p>前言 在计算机领域系统引导和磁盘分区是至关重要的。本文将介绍BIOS与UEFIMBR与GPT以及它们之间的异同点。此外我们还会讨论与这些概念密切相关的引导加载程序——GRUB。</p>
</div>
<div>
<!-- &#xFE0E; -- force text style - some devices render this as emoji -->
<a class="read-more button" href="https://blog.dich.bid/learn-linux-for-pc-5/">
<span class="button__text">Read more</span>&nbsp;
<span class="button__icon">&#8617;&#xFE0E;</span>
</a>
</div>
</div>
<div class="post on-list">
<h1 class="post-title"><a href="https://blog.dich.bid/learn-linux-for-pc-4/">Linux之旅(4):TerminalConsole and Shell</a></h1>
<div class="post-meta-inline">
<span class="post-date">
2023-07-23
</span>
</div>
<span class="post-tags-inline">
:: tags:&nbsp;
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
<div class="post-content">
<p>前言 在linux的学习过程中我们常常遇到诸如 TerminalConsolebash,zsh,shell,tty 等概念,这些概念常常被混淆,似乎都和命令行相关。本文从历史角度出发介绍它们的前世今生。</p>
</div>
<div>
<!-- &#xFE0E; -- force text style - some devices render this as emoji -->
<a class="read-more button" href="https://blog.dich.bid/learn-linux-for-pc-4/">
<span class="button__text">Read more</span>&nbsp;
<span class="button__icon">&#8617;&#xFE0E;</span>
</a>
</div>
</div>
<div class="pagination">
<div class="pagination__buttons">
@ -274,13 +142,6 @@
<span class="button__text">Newer posts</span>
</a>
</span>
<span class="button next">
<a href="https://blog.dich.bid/page/10/">
<span class="button__text">Older posts</span>&nbsp;
<span class="button__icon"></span>
</a>
</span>
</div>
</div>
</div>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
{"version":"1.3.0","languages":{"en":{"hash":"en_9444c6582c","wasm":"en","page_count":98}}}
{"version":"1.3.0","languages":{"en":{"hash":"en_93d8d51d9f","wasm":"en","page_count":89}}}

Binary file not shown.

View File

@ -113,34 +113,6 @@
<loc>https://blog.dich.bid/awesome-vm-android/</loc>
<lastmod>2023-08-10</lastmod>
</url>
<url>
<loc>https://blog.dich.bid/learn-linux-for-pc-1/</loc>
<lastmod>2023-07-20</lastmod>
</url>
<url>
<loc>https://blog.dich.bid/learn-linux-for-pc-2/</loc>
<lastmod>2023-07-21</lastmod>
</url>
<url>
<loc>https://blog.dich.bid/learn-linux-for-pc-3/</loc>
<lastmod>2023-07-22</lastmod>
</url>
<url>
<loc>https://blog.dich.bid/learn-linux-for-pc-4/</loc>
<lastmod>2023-07-23</lastmod>
</url>
<url>
<loc>https://blog.dich.bid/learn-linux-for-pc-5/</loc>
<lastmod>2023-07-24</lastmod>
</url>
<url>
<loc>https://blog.dich.bid/learn-linux-for-pc-6/</loc>
<lastmod>2023-07-25</lastmod>
</url>
<url>
<loc>https://blog.dich.bid/learn-linux-for-pc-7/</loc>
<lastmod>2023-08-01</lastmod>
</url>
<url>
<loc>https://blog.dich.bid/links/</loc>
</url>
@ -204,9 +176,6 @@
<url>
<loc>https://blog.dich.bid/page/1/</loc>
</url>
<url>
<loc>https://blog.dich.bid/page/10/</loc>
</url>
<url>
<loc>https://blog.dich.bid/page/2/</loc>
</url>
@ -237,9 +206,6 @@
<url>
<loc>https://blog.dich.bid/tags/</loc>
</url>
<url>
<loc>https://blog.dich.bid/tags/linux/</loc>
</url>
<url>
<loc>https://blog.dich.bid/tags/luan-qi-ba-zao/</loc>
</url>

View File

@ -108,12 +108,6 @@
<ul>
<li class="tag-list">
<a href="https://blog.dich.bid/tags/linux/">
Linux (7 posts)
</a>
</li>
<li class="tag-list">
<a href="https://blog.dich.bid/tags/luan-qi-ba-zao/">
乱七八糟 (20 posts)

View File

@ -1,212 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>
Dich&#x27;blog</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta name="robots" content="noodp"/>
<link rel="stylesheet" href="https://blog.dich.bid/style.css">
<link rel="stylesheet" href="https://blog.dich.bid/color/blue.css">
<link rel="stylesheet" href="https://blog.dich.bid/color/background_dark.css">
<link rel="stylesheet" href="https://blog.dich.bid/font-hack-subset.css">
<meta name="description" content="All posts tagged Linux">
<meta property="og:description" content="All posts tagged Linux">
<meta property="og:title" content="Dich'blog">
<meta property="og:type" content="website">
<meta property="og:url" content="https://blog.dich.bid/tags/linux/">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:description" content="All posts tagged Linux">
<meta name="twitter:title" content="Dich'blog">
<meta property="twitter:domain" content="blog.dich.bid">
<meta property="twitter:url" content="https://blog.dich.bid/tags/linux/">
<link rel="alternate" type="application/atom+xml" title="Dich&#x27;blog Atom Feed" href="https://blog.dich.bid/atom.xml" />
<link rel="icon" type="image/png" href=&#x2F;dich.webp />
<!-- ✅ Added center alignment styles -->
<style>
.footer {
text-align: center;
padding: 1rem 0;
}
.footer__inner {
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
.copyright {
text-align: center;
}
</style>
</head>
<body class="">
<div class="container">
<header class="header">
<div class="header__inner">
<div class="header__logo">
<a href="https://blog.dich.bid" style="text-decoration: none;">
<div class="logo">
Dich&#x27;blog
</div>
</a>
</div>
</div>
<nav class="menu">
<ul class="menu__inner">
<li><a href="https://blog.dich.bid">blog</a></li>
<li><a href="https://blog.dich.bid/archive">archive</a></li>
<li class="active"><a href="https://blog.dich.bid/tags">tags</a></li>
<li><a href="https://blog.dich.bid/weekly">weekly</a></li>
<li><a href="https://blog.dich.bid/search">search</a></li>
<li><a href="https://blog.dich.bid/about">about me</a></li>
<li><a href="https://blog.dich.bid/links">links</a></li>
<li><a href="https://blog.dich.bid/atom.xml">rss</a></li>
<li><a href="https://github.com/Dichgrem" target="_blank" rel="noopener noreferrer">github</a></li>
</ul>
</nav>
</header>
<div class="content">
<div class="post">
<h1 class="post-title">
tag: #Linux
(7 posts)
</h1>
<a href="https://blog.dich.bid/tags">
Show all tags
</a>
<ul><li class="post-list">
<a href="https://blog.dich.bid/learn-linux-for-pc-7/">
<span class="post-date">2023-08-01</span>
:: <span class="post-list-title">Linux之旅(7):系统与终端字体设置</span></a>
<span class="post-tags-inline">
::
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
</li>
<li class="post-list">
<a href="https://blog.dich.bid/learn-linux-for-pc-6/">
<span class="post-date">2023-07-25</span>
:: <span class="post-list-title">Linux之旅(6):常用命令与性能分析</span></a>
<span class="post-tags-inline">
::
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
</li>
<li class="post-list">
<a href="https://blog.dich.bid/learn-linux-for-pc-5/">
<span class="post-date">2023-07-24</span>
:: <span class="post-list-title">Linux之旅(5):BIOS-UEFI-MBR-GPT-GRUB</span></a>
<span class="post-tags-inline">
::
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
</li>
<li class="post-list">
<a href="https://blog.dich.bid/learn-linux-for-pc-4/">
<span class="post-date">2023-07-23</span>
:: <span class="post-list-title">Linux之旅(4):TerminalConsole and Shell</span></a>
<span class="post-tags-inline">
::
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
</li>
<li class="post-list">
<a href="https://blog.dich.bid/learn-linux-for-pc-3/">
<span class="post-date">2023-07-22</span>
:: <span class="post-list-title">Linux之旅(3):内核&#x2F;shell&#x2F;包管理&#x2F;文件系统&#x2F;桌面环境</span></a>
<span class="post-tags-inline">
::
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
</li>
<li class="post-list">
<a href="https://blog.dich.bid/learn-linux-for-pc-2/">
<span class="post-date">2023-07-21</span>
:: <span class="post-list-title">Linux之旅(2):FHS与目录结构</span></a>
<span class="post-tags-inline">
::
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
</li>
<li class="post-list">
<a href="https://blog.dich.bid/learn-linux-for-pc-1/">
<span class="post-date">2023-07-20</span>
:: <span class="post-list-title">Linux之旅(1):构成与发行版</span></a>
<span class="post-tags-inline">
::
<a class="post-tag" href="https://blog.dich.bid/tags/linux/">#Linux</a></span>
</li>
</ul>
</div>
</div>
<footer class="footer">
<div class="footer__inner">
<div class="copyright">
<span>©
2025
Dichgrem</span>
<span class="copyright-theme">
<span class="copyright-theme-sep"> :: CC BY-SA 4.0 :: A friend comes from distant lands</span>
</a>
</span>
</div>
</div>
</footer>
</div>
</body>
</html>