250728-Docker desktop中文设置

相关资源链接

三、安装与替换汉化包步骤

⚠️ 在进行任何文件替换前,请先关闭 Docker Desktop!

📁 替换路径说明
找到 Docker Desktop 安装目录下的 resources 文件夹,并定位到其中的app.asar文件。\

app-Windows-x86.asar 重命名 app.asar

系统 默认路径
Windows C:\Program Files\Docker\Docker\frontend\resources
macOS /Applications/Docker.app/Contents/MacOS/Docker Desktop.app/Contents/Resources
Ubuntu/Debian /opt/docker-desktop/resources

一、下载地址

前往以下 GitHub 仓库获取对应系统的 Docker Desktop 安装包和汉化包:

👉 DockerDesktop-CN Releases

二、选择适合你设备的版本

根据你的操作系统及芯片架构,选择对应的安装包和汉化包:

✅ Windows 系统

Intel/AMD x64 芯片(主流配置):

安装包:DockerDesktop-x.x.x-Windows-x86.exe
汉化包:app-Windows-x86.asar
ARM 芯片(如 Surface Pro X 等稀有设备):

安装包:DockerDesktop-x.x.x-Windows-arm.exe
汉化包:app-Windows-arm.asar

✅ macOS 系统

M 系列芯片(新款 Mac):

安装包:DockerDesktop-x.x.x-Mac-apple.dmg
汉化包:app-Mac-apple.asar
Intel x64 芯片(2020 年前旧款):

安装包:DockerDesktop-x.x.x-Mac-intel.dmg
汉化包:app-Mac-intel.asar

✅ Linux 系统(Ubuntu / Debian)

Intel/AMD x64 芯片(主流配置):
安装包:DockerDesktop-x.x.x-Debian-x86.deb
汉化包:app-Debian-x86.asar

250728-Nmap 使用帮助(中文翻译)

Nmap 7.93 使用帮助(中文翻译)

用法:
nmap [扫描类型] [选项] {目标说明}


目标说明(Target Specification)

  • 可直接写主机名、IP、网段等。
    例:scanme.nmap.orgmicrosoft.com/24192.168.0.1; 10.0.0-255.1-254
  • -iL <文件名>:从文件读取目标列表
  • -iR <数量>:随机选择目标
  • --exclude <主机1,主机2…>:排除指定主机/网段
  • --excludefile <排除文件>:从文件读取排除列表

主机发现(Host Discovery)

  • -sL:列表扫描,仅列出目标,不真正扫描
  • -sn:Ping 扫描,不扫端口
  • -Pn:跳过主机发现,默认所有主机在线
  • -PS/PA/PU/PY[端口列表]:TCP SYN/ACK、UDP 或 SCTP 发现
  • -PE/PP/PM:ICMP Echo、时间戳、子网掩码请求
  • -PO[协议列表]:IP 协议 Ping
  • -n/-R:不做/始终做 DNS 解析
  • --dns-servers :自定义 DNS 服务器
  • --system-dns:使用系统 DNS 解析器
  • --traceroute:对每个目标做路由追踪

扫描技术(Scan Techniques)

  • -sS/sT/sA/sW/sM:TCP SYN / Connect / ACK / Window / Maimon 扫描
  • -sU:UDP 扫描
  • -sN/sF/sX:TCP Null / FIN / Xmas 扫描
  • --scanflags :自定义 TCP 标志位
  • -sI <僵尸主机[:端口]>:Idle 扫描
  • -sY/sZ:SCTP INIT / COOKIE-ECHO 扫描
  • -sO:IP 协议扫描
  • -b :FTP 反弹扫描

端口指定与扫描顺序

  • -p <端口范围>:只扫指定端口
    例:-p22-p1-65535-p U:53,111,T:21-25,80
  • --exclude-ports <端口范围>:排除端口
  • -F:快速模式(少端口)
  • -r:顺序扫描,不随机
  • --top-ports <数量>:扫描最常见的 N 个端口
  • --port-ratio <比例>:扫描比该比例更常见的端口

服务/版本检测

  • -sV:探测服务与版本
  • --version-intensity <0-9>:探测强度
  • --version-light:轻量级(强度 2)
  • --version-all:尝试所有探测(强度 9)
  • --version-trace:显示详细版本探测过程

脚本扫描(NSE)

  • -sC:等价于 --script=default
  • --script=<脚本列表>:指定脚本文件、目录或类别
  • --script-args=:给脚本传参
  • --script-args-file=文件名:从文件读取参数
  • --script-trace:显示脚本收发数据
  • --script-updatedb:更新脚本数据库
  • --script-help=<脚本>:查看脚本帮助

操作系统检测

  • -O:启用 OS 检测
  • --osscan-limit:只对“有希望”的目标做 OS 检测
  • --osscan-guess:更激进地猜测 OS

定时与性能

  • -T<0-5>:定时模板,数字越大越快
  • --min-hostgroup/--max-hostgroup <大小>:并行主机组大小
  • --min-parallelism/--max-parallelism <探测数>:并行探测数
  • --min-rtt-timeout/--max-rtt-timeout/--initial-rtt-timeout <时间>:RTT 超时
  • --max-retries <次数>:最大重传次数
  • --host-timeout <时间>:主机超时放弃
  • --scan-delay/--max-scan-delay <时间>:探测间隔
  • --min-rate <包/秒>:最低发包速率
  • --max-rate <包/秒>:最高发包速率

防火墙/IDS 规避与欺骗

  • -f; --mtu <值>:分片包
  • -D <诱饵1,诱饵2[,ME],…>:使用诱饵掩盖扫描
  • -S :伪造源地址
  • -e <接口>:指定网卡
  • -g/--source-port <端口>:指定源端口
  • --proxies :通过 HTTP/SOCKS4 代理
  • --data <十六进制>:附加自定义负载
  • --data-string <字符串>:附加 ASCII 字符串
  • --data-length <长度>:附加随机数据
  • --ip-options <选项>:设置 IP 选项
  • --ttl <值>:设置 TTL
  • --spoof-mac <地址>:伪造 MAC
  • --badsum:发送错误校验和

输出(Output)

  • -oN/-oX/-oS/-oG <文件>:正常/XML/脚本小子/可 grep 格式
  • -oA <基本名>:同时输出三种主要格式
  • -v:增加详细度(可多次使用 -vv
  • -d:增加调试级别(可多次使用 -dd
  • --reason:显示端口状态原因
  • --open:仅显示 open 或可能 open 的端口
  • --packet-trace:显示所有收发报文
  • --iflist:打印主机接口与路由
  • --append-output:追加到输出文件
  • --resume <文件>:恢复中断的扫描
  • --stylesheet <路径/URL>:指定 XML 转 HTML 的 XSL
  • --webxml:使用 Nmap.org 的在线 XSL
  • --no-stylesheet:不关联 XSL 样式表

杂项(Misc)

  • -6:启用 IPv6 扫描
  • -A:启用 OS 检测、版本检测、脚本扫描和路由追踪
  • --datadir <目录>:自定义数据文件位置
  • --send-eth/--send-ip:使用原始以太网帧 / IP 层发包
  • --privileged:假设拥有完整权限
  • --unprivileged:假设无原始套接字权限
  • -V:打印版本
  • -h:打印本帮助

示例(Examples)

1
2
3
nmap -v -A scanme.nmap.org
nmap -v -sn 192.168.0.0/16 10.0.0.0/8
nmap -v -iR 10000 -Pn -p 80

运行示例(Examples)

1

如需更多选项与示例,请阅读手册页:
https://nmap.org/book/man.html

250724-Ubuntu 24.04、23.04、22.04、20.04、18.04国内源--阿里云、中科大、163、清华更新源(sources.list)

https://blog.csdn.net/yinminsumeng/article/details/128625827

配置文件说明
Ubuntu配置文件位置:/etc/apt/sources.list
需要用root权限:

1
$ sudo vi /etc/apt/sources.list

用vi、gedit、vs code等任何熟悉的编辑工具打开文件进行修改
2种修改方式
1)把原文件中:archive.ubuntu.com,替换为:archive.aliyun.com(或其他更新源网址)
2)直接复制下方的内容,覆盖原文件中的内容即可。
修改完成后,更新本地安装包数据库
执行完这个操作后,可以用apt命令进行升级已有软件或者安装新的软件包。

1
$ sudo apt update

请选择和系统对应的版本
查看系统版本命令:

1
2
3
4
5
lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy

国内的更新源有多个,几个大互联网公司的源都比较稳定,没什么差别。
这里整理的比较主流的、常用的几个LTS版本的更新源。
sources.list内容

  1. Ubuntu 24.04 (noble)更新源
1
2
3
4
5
6
7
8
9
10
11
# aliyun
deb http://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ noble-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ noble-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse
1
2
3
4
5
6
7
8
9
10
11
# tsinghua
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse
1
2
3
4
5
6
7
8
9
10
11
# 中科大
deb https://mirrors.ustc.edu.cn/ubuntu/ noble main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ noble main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ noble-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ noble-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ noble-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ noble-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ noble-proposed main restricted universe multiverse
1
2
3
4
5
6
7
8
9
10
11
# 163
deb http://mirrors.163.com/ubuntu/ noble main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ noble-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ noble-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ noble-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ noble-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ noble main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ noble-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ noble-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ noble-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ noble-backports main restricted universe multiverse

2. Ubuntu 23.04 (lunar)更新源

1
2
3
4
5
6
7
8
9
10
11
# aliyun
deb http://mirrors.aliyun.com/ubuntu/ lunar main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ lunar main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ lunar-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ lunar-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ lunar-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ lunar-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ lunar-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ lunar-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ lunar-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ lunar-backports main restricted universe multiverse
1
2
3
4
5
6
7
8
9
10
11
# tsinghua
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ lunar-proposed main restricted universe multiverse
1
2
3
4
5
6
7
8
9
10
11
12
 
# 中科大
deb https://mirrors.ustc.edu.cn/ubuntu/ lunar main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ lunar main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ lunar-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ lunar-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ lunar-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ lunar-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ lunar-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ lunar-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ lunar-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ lunar-proposed main restricted universe multiverse
1
2
3
4
5
6
7
8
9
10
11
12

# 163
deb http://mirrors.163.com/ubuntu/ lunar main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ lunar-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ lunar-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ lunar-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ lunar-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ lunar main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ lunar-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ lunar-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ lunar-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ lunar-backports main restricted universe multiverse

3. Ubuntu 22.04 (jammy)更新源

1
2
3
4
5
6
7
8
9
10
11
# aliyun
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
1
2
3
4
5
6
7
8
9
10
11
12

# tsinghua
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
1
2
3
4
5
6
7
8
9
10
11
12

# 中科大
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
1
2
3
4
5
6
7
8
9
10
11
12
 
# 163
deb http://mirrors.163.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ jammy-backports main restricted universe multiverse

4. ubuntu 20.04(focal) 更新源

1
2
3
4
5
6
7
8
9
10
11
# aliyun
deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
1
2
3
4
5
6
7
8
9
10
11
12

# 中科大
deb https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
1
2
3
4
5
6
7
8
9
10
11
# tsinghua
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
1
2
3
4
5
6
7
8
9
10
11
# 163, netease
deb http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Ubuntu 20.04自带sources.list
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu/ focal main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ focal universe
# deb-src http://archive.ubuntu.com/ubuntu/ focal universe
deb http://archive.ubuntu.com/ubuntu/ focal-updates universe
# deb-src http://archive.ubuntu.com/ubuntu/ focal-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu/ focal multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ focal multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ focal-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu focal partner
# deb-src http://archive.canonical.com/ubuntu focal partner

deb http://security.ubuntu.com/ubuntu/ focal-security main restricted
# deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted
deb http://security.ubuntu.com/ubuntu/ focal-security universe
# deb-src http://security.ubuntu.com/ubuntu/ focal-security universe
deb http://security.ubuntu.com/ubuntu/ focal-security multiverse
# deb-src http://security.ubuntu.com/ubuntu/ focal-security multiverse

5. ubuntu 18.04(bionic) 更新源

1
2
3
4
5
6
7
8
9
10
11
# aliyun
deb https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
1
2
3
4
5
6
7
8
9
10
11
# 中科大
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
1
2
3
4
5
6
7
8
9
10
11
# 163
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
1
2
3
4
5
6
7
8
9
10
11
# tsinghua university
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

250724-Ubuntu20.04桌面版系统-配置看板-界面功能参数配置

ToDoList

  • 电源-屏幕锁屏取消-设置为永不/一直亮屏
  • 软件更新策略调整(从不提醒)
  • 侧边栏自动隐藏(外观/侧边栏设置)
  • sudoers 用户增加mes mes ALL=(ALL:ALL) NOPASSWD: ALL
  • 网卡名称调整为enp0s25
  • 运行box.sh脚本,系统参数配置

Ubuntu20.04ip脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

#sudo bash -c 'cat <<EOF > /etc/udev/rules.d/10-rename-network.rules
#SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="", NAME="enp0s25"
#EOF'

# 获取参数作为 IP
# 固定IP地址(01-network-manager-all.yaml)
sudo bash -c 'cat <<EOF > /etc/netplan/01-network-manager-all.yaml
network:
version: 2
renderer: NetworkManager
ethernets:
enp0s25:
dhcp4: no
dhcp6: no
addresses: [192.168.10.$1/24]
gateway4: 192.168.10.1
nameservers:
addresses: [8.8.8.8, 114.114.114.114]
EOF' _ $1

Ubuntu20.04ip2脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh

sudo mkdir -p /etc/udev/rules.d/
sudo touch /etc/udev/rules.d/10-rename-network.rules

sudo bash -c 'cat <<EOF > /etc/udev/rules.d/10-rename-network.rules
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="", NAME="enp0s25"
EOF'

# 获取参数作为 IP
# 固定IP地址(01-network-manager-all.yaml)
sudo bash -c 'cat <<EOF > /etc/netplan/01-network-manager-all.yaml
network:
version: 2
renderer: NetworkManager
ethernets:
enp0s25:
dhcp4: no
dhcp6: no
addresses: [192.168.10.$1/24]
gateway4: 192.168.10.1
nameservers:
addresses: [8.8.8.8, 114.114.114.114]
EOF' _ $1

Ubuntu20.04box.sh脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
#!/bin/sh

# 更新为阿里云
sudo bash -c 'cat <<EOF > /etc/apt/sources.list

# aliyun
deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
EOF'

# 禁用内核更新
sudo apt-mark hold linux-generic linux-image-generic linux-headers-generic
# 锁定内核
sudo apt-mark hold linux-generic linux-image-generic linux-headers-generic
sudo apt-mark hold linux-image-generic linux-headers-generic

sudo apt update

# 禁用内核更新
sudo apt-mark hold linux-generic linux-image-generic linux-headers-generic
# 锁定内核
sudo apt-mark hold linux-generic linux-image-generic linux-headers-generic
sudo apt-mark hold linux-image-generic linux-headers-generic

sudo timedatectl set-timezone Asia/Shanghai
sudo cat /etc/timezone

# sudo mkdir -p /root/snap/chromium/common/chromium/BrowserMetrics

sudo apt install language-pack-zh-hans -y
sudo locale-gen zh_CN.UTF-8
sudo update-locale LANG=zh_CN.UTF-8

export LANG=zh_CN.UTF-8

sudo apt-get install vim -y && sudo apt-get remove nano -y
sudo apt install fonts-wqy-zenhei fonts-wqy-microhei fonts-noto-cjk -y
sudo apt install -y fontconfig
sudo apt install -y fonts-dejavu-core fonts-liberation

sudo apt install fonts-wqy-zenhei fonts-wqy-microhei fonts-noto-cjk -y
sudo apt install -y git
sudo apt install net-tools -y
sudo apt install openssh-server -y
sudo apt install -y fontconfig
sudo apt install -y fonts-dejavu-core fonts-liberation

# 禁用自动更新
sudo sed -i 's/APT::Periodic::Update-Package-Lists "1";/APT::Periodic::Update-Package-Lists "0";/g' /etc/apt/apt.conf.d/10periodic
sudo sed -i 's/APT::Periodic::Unattended-Upgrade "1";/APT::Periodic::Unattended-Upgrade "0";/g' /etc/apt/apt.conf.d/10periodic

# 禁用无人值守升级
sudo sed -i 's/APT::Periodic::Update-Package-Lists "1";/APT::Periodic::Update-Package-Lists "0";/g' /etc/apt/apt.conf.d/20auto-upgrades
sudo sed -i 's/APT::Periodic::Unattended-Upgrade "1";/APT::Periodic::Unattended-Upgrade "0";/g' /etc/apt/apt.conf.d/20auto-upgrades

# 禁用 apt-daily 服务和计时器
sudo systemctl stop apt-daily.service
sudo systemctl disable apt-daily.service
sudo systemctl mask apt-daily.service
sudo systemctl daemon-reload
sudo systemctl stop apt-daily.timer
sudo systemctl disable apt-daily.timer
sudo systemctl mask apt-daily.timer
sudo systemctl daemon-reload

# 禁用 unattended-upgrades 服务
sudo systemctl disable unattended-upgrades

# 禁用 Snap 自动更新
sudo snap refresh --hold

# 禁用自动更新
sudo systemctl stop apt-daily.service
sudo systemctl disable apt-daily.service
sudo systemctl kill --kill-who=main apt-daily.service
sudo systemctl disable apt-daily.timer
sudo systemctl mask apt-daily.timer
sudo systemctl stop unattended-upgrades.service
sudo systemctl disable unattended-upgrades.service

sudo systemctl daemon-reload

# Ubuntu自动登录和开机锁屏取消
## 禁用自动锁屏:
# gsettings set org.gnome.desktop.screensaver lock-enabled false
# gsettings set org.gnome.desktop.lockdown disable-lock-screen true

# 禁用内核更新
sudo apt-mark hold linux-generic linux-image-generic linux-headers-generic
# 恢复内核更新
sudo apt-mark unhold linux-generic linux-image-generic linux-headers-generic

sudo sed -i 's/1/0/' /etc/apt/apt.conf.d/10periodic
sudo sed -i 's/2/0/' /etc/apt/apt.conf.d/10periodic

sudo sed -i 's/1/0/' /etc/apt/apt.conf.d/20auto-upgrades
sudo sed -i 's/2/0/' /etc/apt/apt.conf.d/20auto-upgrades

sudo apt remove update-notifier -y

# 禁用屏幕休眠
# gsettings set org.gnome.desktop.session idle-delay 0

sudo mkdir -p /home/mes/.config/autostart
sudo mkdir -p /home/mes/.ssh

sudo touch /home/mes/.config/autostart/chromium.desktop
sudo touch /home/mes/.ssh/authorized_keys

# 写入文件内容
sudo cat <<EOF > /home/mes/.config/autostart/chromium.desktop
[Desktop Entry]
Type=Application
Exec=/usr/bin/google-chrome-stable --disable-background-networking --start-maximized --disable-infobars --kiosk "http://120.86.188.226:8081/hmi/a3886ab468c84417a24df00fcf56a253/zlg63v?pageId=LJ-A"
EOF

sudo chown -R mes:mes /home/mes/.config/autostart/chromium.desktop
sudo chmod a+x /home/mes/.config/autostart/chromium.desktop

sudo mkdir -p /etc/gdm3/

sudo cp -f /etc/gdm3/custom.conf /etc/gdm3/custom.conf.backup-$DATE
sudo touch /etc/gdm3/custom.conf

# 写入文件内容
sudo cat <<EOF > /etc/gdm3/custom.conf
[daemon]
AutomaticLoginEnable=True
AutomaticLogin=mes
EOF

# Linux优化-Ulimit
# 写入文件内容

sudo bash -c 'cat <<EOF > /etc/security/limits.conf
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
EOF'

# >> 表示 追加 到文件末尾,不会破坏原有内容
sudo bash -c 'cat <<EOF > /etc/systemd/system.conf
[Manager]
DefaultLimitNOFILE=1048576
EOF'

# >> 表示 追加 到文件末尾,不会破坏原有内容
sudo bash -c 'cat <<EOF > /etc/sysctl.conf
net.ipv4.ip_forward = 1
fs.file-max = 1048576
fs.inotify.max_user_instances=512
fs.inotify.max_user_watches=262144
EOF'

# >> 表示 追加 到文件末尾,不会破坏原有内容
#sudo bash -c 'cat <<EOF >> /etc/sudoers
#mes ALL=(ALL:ALL) NOPASSWD: ALL
#EOF'

# 安装chrome谷歌浏览器
# 安装chrome谷歌浏览器
sudo wget -O google-chrome-stable_current_amd64.deb --no-check-certificate http://xx.xx.xx.xx:9000/Ubuntu20.04/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
sudo apt update
sudo apt-get install google-chrome-stable -y

# 谷歌浏览器取消登录密钥环**然后重启系统,首次打开 Chrome 时会提示创建新密钥环,直接留空密码并继续即可
rm -rf /home/mes/.local/share/keyrings/*
sudo rm -rf /home/mes/.local/share/keyrings/*

# 调整电视连接显示配置
sudo sed -i 's/#HandleLidSwitch=suspend/HandleLidSwitch=ignore/g' /etc/systemd/logind.conf

sudo apt autoremove -y

# 固定IP地址(01-network-manager-all.yaml)
#sudo bash -c 'cat <<EOF > /etc/netplan/01-network-manager-all.yaml
#network:
# version: 2
# renderer: NetworkManager
# ethernets:
# enp0s25:
# dhcp4: no
# dhcp6: no
# addresses: [192.168.10.$1/24]
# gateway4: 192.168.10.1
# nameservers:
# addresses: [8.8.8.8, 114.114.114.114]
#EOF'


# 配置密钥允许
sudo bash -c 'cat <<EOF >> /home/mes/.ssh/authorized_keys

EOF'


# ubuntu 启动时,默认30秒的时间能调整为5S
#sudo nano /etc/default/grub
#找到这一行:
#GRUB_TIMEOUT=30
sudo bash -c 'cat <<EOF > /etc/default/grub
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=5
GRUB_RECORDFAIL_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
EOF'

sudo update-grub

# enp0s25网卡名字调整统一
sudo mkdir -p /etc/udev/rules.d/
# sudo touch /etc/udev/rules.d/10-rename-network.rules

#sudo bash -c 'cat <<EOF > /etc/udev/rules.d/10-rename-network.rules
#SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="", NAME="enp0s25"
#EOF'

#
sudo apt autoremove -y
# sudo reboot
# sudo systemctl restart systemd-logind

250724-Ubuntu-Linux-netplan-ifconfig网卡名字调整

我能将这个网卡名字调整到enp0s25吗

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
inet 192.168.0.197 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::19d7:fdf9:9247:539 prefixlen 64 scopeid 0x20<link>
ether 00:e0:4d:03:5e:6f txqueuelen 1000 (以太网)
RX packets 41902 bytes 56368729 (56.3 MB)
RX errors 0 dropped 54 overruns 0 frame 0
TX packets 16055 bytes 1453031 (1.4 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (本地环回)
RX packets 636 bytes 49767 (49.7 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 636 bytes 49767 (49.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wlp1s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether cc:3d:82:d2:4e:ca txqueuelen 1000 (以太网)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

在 Ubuntu 20.04 里,网络接口名称默认是由 systemd-networkd / udev 的“Predictable Network Interface Names”机制决定的,也就是
enp0s25 这种格式。但你现在看到的是 eno1,说明系统可能禁用了该机制,或者主板/BIOS 提供了特定的 eno1 名称。


你可以改成 enp0s25,但需要注意以下几点:

1. 确认当前命名机制

运行以下命令确认当前命名策略:

1
sudo dmesg | grep -i 'renamed from\|eth\|enp\|eno'

或者:

1
udevadm test-builtin net_id /sys/class/net/eno1

2. 方法一:使用 GRUB 开启 Predictable Names(推荐)

编辑 GRUB 配置:

1
sudo nano /etc/default/grub

找到这一行:

1
GRUB_CMDLINE_LINUX=""

改成:

1
GRUB_CMDLINE_LINUX="net.ifnames=1 biosdevname=0"

说明:

  • net.ifnames=1 开启 systemd 的命名机制
  • biosdevname=0 关闭 Dell 的 biosdevname 工具(如果存在)

保存后更新 GRUB:

1
sudo update-grub

然后重启:

1
sudo reboot

重启后,接口名可能会变成 enp0s25(取决于硬件总线拓扑)。


3. 方法二:手动创建 udev 规则(强制改名)

如果你知道硬件路径(比如 enp0s25 是 PCI 设备 0000:00:19.0),可以强制改名:

1
2
3
4
sudo nano /etc/udev/rules.d/10-rename-network.rules

sudo mkdir -p /etc/udev/rules.d/
sudo touch /etc/udev/rules.d/10-rename-network.rules

添加如下内容:

1
2
3
4
5
6
7
8
sudo vim /etc/udev/rules.d/10-rename-network.rules

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:e0:4d:03:5e:6f", NAME="enp0s25"


SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="00:e0:4d:03:5e:6f", NAME="enp0s25"


替换 00:e0:4d:03:5e:6f 为你网卡的实际 MAC 地址

然后重启:

1
sudo reboot

4. 验证是否成功

重启后运行:

1
ip link

或:

1
ifconfig -a

确认是否已变为 enp0s25


⚠️ 注意事项

  • 改名后,Netplan、NetworkManager 或其他网络配置文件中引用的接口名也要同步修改。
  • 如果你使用的是 Netplan,路径通常是 /etc/netplan/*.yaml,记得改成 enp0s25

Idea-文件夹隐藏-Idea File Ignore

在 JetBrains 系列 IDE(IntelliJ IDEA、PyCharm、WebStorm 等)中,.idea 目录就是项目的配置文件夹,默认情况下它已经是一个*
*隐藏文件夹(以点开头),但如果你在文件管理器或者 IDEA 的“Project”视图中仍然能看到它,可以通过以下方式进一步隐藏**:


✅ 方法一:在 IDEA 的 Project 视图中隐藏 .idea 目录

  1. 打开 IDEA。
  2. 点击顶部菜单:File > Settings(macOS 是 IntelliJ IDEA > Preferences)。
  3. 进入:Editor > File Types
  4. 在右侧的 “Ignored Files and Folders” 列表中,点击 + 按钮。
  5. 输入:.idea,然后点击 OK
  6. 应用并重启 IDEA。

这样 .idea 目录就不会再出现在左侧 Project 树中,但仍然存在,不影响项目运行。


✅ 方法二:在文件管理器中隐藏(Linux / macOS)

  • Linux(如 Ubuntu)

    1
    mv .idea .idea_hidden  # 改名隐藏(不推荐,会影响 IDEA 识别)

✅ 推荐:用 .hidden 文件方式隐藏(不影响 IDEA): 在项目根目录下创建 .hidden 文件,内容写:

1
.idea

这样大多数文件管理器(如 Nautilus)会自动隐藏 .idea

  • macOS Finder: 打开终端,进入项目目录:

    1
    chflags hidden .idea

✅ 方法三:在 .gitignore 中忽略(防止提交到 Git)

确保 .gitignore 文件中有:

1
.idea/

✅ 总结

目的 方法
不在 IDEA 中显示 File Types > Ignored Files
不在文件管理器中显示 .hiddenchflags hidden
不提交到 Git .gitignore 添加 .idea/

你可以根据需要选择其中一种或多种方式。

idea如何把node_modules目录隐藏

当前模型仅对图片中的文字进行识别,切换 K1.5 获取更好的视觉理解能力

JetBrains IDE(如 IntelliJ IDEA、WebStorm、PyCharm) 中隐藏 node_modules 目录,有两种常用方法:


✅ 方法一:在 Project 视图中隐藏(推荐)

  1. 打开 IDEA。
  2. 点击顶部菜单:File > Settings(macOS:IntelliJ IDEA > Preferences)。
  3. 进入:Editor > File Types
  4. 在右侧的 “Ignored Files and Folders” 列表中,点击 + 按钮。
  5. 输入:node_modules,点击 OK
  6. 应用并重启 IDEA。

✅ 这样 node_modules 不会在左侧 Project 树中显示,但仍存在于磁盘,不影响运行和调试。


✅ 方法二:在 .gitignore 中忽略(防止 Git 提交)

确保项目根目录下的 .gitignore 文件包含:

1
node_modules/

⚠️ 注意事项

  • 不要手动删除或重命名 node_modules,否则依赖会失效。
  • 隐藏后,IDE 仍会正确解析依赖(如 import 语句),不影响开发。

✅ 总结

目的 方法
不在 IDEA 中显示 File Types → Ignored Files → 添加 node_modules
不提交到 Git .gitignore 添加 node_modules/

两种方法可叠加使用,互不影响。

ile Types → Ignored Files → 添加 node_modules 这个无效

如果 “File Types → Ignored Files” 添加 node_modules 后无效,说明你可能遇到的是 IDEA 的 Project 视图缓存问题 或 *
*node_modules 被显式标记为 Source/Resource**。可按以下步骤强制生效:


强制隐藏 node_modules 的 3 种方法


🔧 方法 1:手动标记为 Excluded(100% 有效)

  1. Project 视图 中,右键 node_modules 文件夹。
  2. 选择 Mark Directory as → Excluded
    • 图标会变红,且立即从 Project 树隐藏。
    • 可随时 Mark Directory as → Cancel Exclusion 恢复。

效果等同于隐藏,且不影响依赖解析。


🔧 方法 2:清除缓存并重启

如果 “Ignored Files” 已添加但无效,可能是缓存未刷新:

  1. 点击菜单:File → Invalidate Caches / Restart
  2. 选择 Invalidate and Restart
  3. 重启后检查是否隐藏。

🔧 方法 3:检查 Project Structure(排除误设为 Source)

  1. Ctrl+Alt+Shift+S 打开 Project Structure
  2. 进入 Modules → Sources
  3. 确保 node_modules 未被标记为 Source 或 Resource(蓝色/黄色文件夹)。
  4. 如果有,点击 Excluded 图标,或右键 Remove

总结

场景 解决方案
Excluded 无效 右键 node_modulesMark as Excluded
缓存问题 File → Invalidate Caches / Restart
误设为 Source Project Structure → Modules → 取消 Source 标记

推荐优先使用方法 1(Mark as Excluded),立即生效且无副作用。

没有这个Mark as Excluded选项

IntelliJ IDEA Mark as Excluded 选项不存在

如果你在当前版本的 IntelliJ IDEA 中 右键 node_modules 文件夹时找不到 “Mark Directory as → Excluded” 选项
,可能是由于以下原因:


原因 1:你使用的是“Project Files”视图或其他非标准视图

IDEA 的 Project 视图 有多个模式,如:

  • Project
  • Project Files
  • Packages
  • Problems

只有在 “Project”“Packages” 视图下,才会显示完整的 Mark Directory as 菜单。

✅ 解决方法:

点击 左侧 Project 窗口顶部的小齿轮图标 → 选择 “Project” 视图模式 → 再右键 node_modules,即可看到 “Mark
Directory as → Excluded”
选项 。


原因 2:node_modules 被识别为 Library Root

如果 node_modules 被 IDEA 自动识别为 Library Root(图标带一个小书本),它就不会出现在 Mark Directory as 的菜单中。

✅ 解决方法:

  1. 打开 File → Project Structure(或快捷键 Ctrl+Alt+Shift+S)
  2. 左侧选择 Modules
  3. 右侧找到 node_modules取消勾选 “Library Root” 或将其从 Sources 中移除
  4. 点击 OK
  5. 回到项目视图,右键 node_modules → Mark Directory as → Excluded 就会出现 。

原因 3:使用的是非 Java 项目(如纯前端项目)

在纯前端项目(如 Vue、React)中,IDEA 可能不会自动提供完整的目录标记选项。

✅ 解决方法:

  • 手动进入 Project Structure → Modules → 添加一个空模块 → 然后手动 Excluded node_modules 目录 。

✅ 总结:快速操作步骤

步骤 操作
1 确保使用 Project 视图(非 Project Files)
2 如果仍无选项,进入 Project Structure → Modules
3 node_modules 从 Sources/Library 中移除
4 右键 → Mark Directory as → Excluded

如仍有问题,可截图当前 Project 视图结构,我可以帮你进一步判断。

原因 2:node_modules 被识别为 Library Root 如果 node_modules 被 IDEA 自动识别为 Library Root(图标带一个小书本),它就不会出现在Mark Directory as 的菜单中。

✅ 解决方法: 打开 File → Project Structure(或快捷键 Ctrl+Alt+Shift+S) 左侧选择 Modules 右侧找到
node_modules,取消勾选 “Library Root” 或将其从 Sources 中移除 点击 OK 回到项目视图,右键 node_modules → Mark Directory
as → Excluded 就会出现 这个找不到

最新版 IDEA / WebStorm / PyCharm 等 JetBrains IDE 中,
node_modules 一旦被识别成 JavaScript Library(图标带小书本),确实不会出现在 “Mark Directory as” 菜单里,也不会在
Modules → Sources 里显示,因为它根本不是 Source / Resource / Excluded 那一套机制管理的,而是 Library Root


✅ 正确做法:从 JavaScript Library 里移除 node_modules

  1. 打开设置
    File → Settings(macOS:IntelliJ IDEA → Preferences
  2. 进入 JavaScript Libraries 设置
    Languages & Frameworks → JavaScript → Libraries
  3. 在右侧列表里找到 node_modules 这一条
    你会看到它被标记为 “Global”“Project” 类型,图标也是书本。
  4. 选中它 → 点击右侧的 ➖ Remove(或 Disable)
  5. Apply → OK

🔄 完成后的效果

  • node_modules 图标会从 “小书本” 变成 普通文件夹
  • 此时再右键它,就能看到完整的 “Mark Directory as → Excluded” 选项了
  • 标记为 Excluded 后,IDE 会立即把它从 Project 视图隐藏,但磁盘文件仍在,运行、调试、npm 命令不受影响。

✅ 一句话总结

在 IDEA 中,node_modules 被当成 JavaScript Library
时,必须从 Settings → Languages & Frameworks → JavaScript → Libraries 里移除,才能用 “Mark as Excluded” 隐藏。

250723-Linux-内核更新-禁用内核更新-配置指定内核启动

锁定内核

1
2
sudo apt-mark hold linux-generic linux-image-generic linux-headers-generic
sudo apt-mark hold linux-image-generic linux-headers-generic

内核脚本库

1.显示系统全部内核

1
sudo dpkg --get-selections | grep linux

2.完全删除系统内核

1
2
sudo apt-get remove --purge linux-modules-5.4.0-42-generic
sudo apt-get remove --purge linux-modules-5.15.0-71-generic -y
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
sudo apt-get remove --purge  -y linux-headers-5.15.0-139-generic
sudo apt-get remove --purge -y linux-hwe-5.15-headers-5.15.0-139
sudo apt-get remove --purge -y linux-image-5.15.0-139-generic
sudo apt-get remove --purge -y linux-modules-5.15.0-139-generic
sudo apt-get remove --purge -y linux-modules-extra-5.15.0-139-generic

sudo dpkg --get-selections | grep linux
sudo apt-get remove --purge -y linux-modules-extra-5.15.0-139-generic linux-modules-5.15.0-139-generic linux-image-5.15.0-139-generic linux-headers-5.15.0-139-generic linux-hwe-5.15-headers-5.15.0-139
sudo update-grub

sudo apt-get remove --purge -y linux-modules-5.15.0-60-generic -y
sudo apt-get remove --purge -y linux-modules-5.15.0-46-generic -y

sudo apt-get remove --purge -y linux-image-5.15.0-60-generic -y
sudo apt-get remove --purge -y linux-image-5.15.0-46-generic -y

sudo apt-get remove --purge -y linux-image-unsigned-5.15.0-46-generic -y
sudo apt-get remove --purge -y linux-modules-5.15.0-46-generic -y

3.再次用以下命令查看是否删除干净

1
dpkg --get-selections | grep linux

Ubuntu设置开机默认内核及删除多余内核
Ubuntu一更新就会启动新的内核,进入系统后总会发现驱动不好用了。所以可以对内核进行下设置,使得主机进入我们想要的内核版本,也可以删除掉多余的内核。

Ubuntu设置开机默认内核
#不删除内核情况下,更改要进入的内核

1
sudo gedit /etc/default/grub

(1)找到GRUB_DEFAULT = “0”
grub菜单如下:

1
2
3
4
5
6
7
8
- Ubuntu
- Advanced options for Ubuntu
* Ubuntu, with Linux 5.13.0-30-generic
* Ubuntu, with Linux 5.13.0-30-generic (recovery mode)
* Ubuntu, with Linux 5.11.0-27-generic
* Ubuntu, with Linux 5.11.0-27-generic (recovery mode)
- Windows 10
- System setup

(注意:每层菜单的索引都是从0开始)
GRUB菜单中的 Ubuntu为0,
Advanced options for Ubuntu为1,Windows 10为2,System setup为3。
Advanced options for Ubuntu菜单中的Ubuntu, with Linux 5.13.0-30-generic选项为0,
Ubuntu, with Linux 5.13.0-30-generic (recovery mode)为1,依次类推……

(2)想要进入5.11.0-27内核,则更改GRUB_DEFAULT = “1> 2”
‘>’ 符号来指定有一个子菜单(注意符号 > 和数字 2之间有空格)。

(3)更新GRUB配置文件

1
sudo update-grub

Ubuntu删除多余内核
#查看已安装的内核

1
dpkg --get-selections | grep linux-image

#找出系统已经安装的内核版本

1
dpkg --get-selections|grep linux

#卸载不需要的内核

1
2
sudo apt-get remove 内核名称
sudo apt autoremove

#修改 /boot/grub/grub.cfg文件,删除启动项

1
sudo gedit /boot/grub/grub.cfg

Ubuntu关闭自动更新
#关闭自动更新

1
sudo apt-mark hold linux-image-5.11.0-27-generic

验证内核

1
uname -r

选择内核启动

  1. 如果您的系统中有多个内核版本,您可以在启动时选择要启动的内核版本。查看当前系统中内核的启动顺序:

    bash

    1
    grep 'menuentry' /boot/grub/grub.cfg

    找到您想要设置为默认启动的内核条目,然后修改 /etc/default/grub 文件中的 GRUB_DEFAULT
    配置项,将其设置为对应的内核启动项。例如,如果您想要设置 Ubuntu, with Linux 5.8.0-43-generic 为默认启动项,您可以这样设置:

    bash

    1
    sudo sed -i 's/GRUB_DEFAULT=0/GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 5.8.0-43-generic"/g' /etc/default/grub

    然后再次更新 GRUB 并重启:

    bash

    1
    2
    sudo update-grub
    sudo reboot

请按照这些步骤操作,您应该能够成功将 Ubuntu 20.04 的内核版本调整到 5.8.0-43-generic。如果在操作过程中遇到任何问题,可以参考相关博客文章获取更详细的指导。

250723-ubuntu-Linux-wget下载运行bash脚本-wgetBox-wget盒子

安装运行脚本

  • 下载DEB谷歌浏览器文件
  • 配置SSH PUB KEY
  • 配置禁用更新/UTF-8/字体/ShangHai
  • 配置sudoers 管理员账号
  • sudo apt update && sudo apt upgrade -y

wget 直接直接远程脚本

  • wget 本身不会自动给文件加可执行权限,Linux 默认新文件权限是 644-rw-r--r--)。

  • 如果你希望直接下载并运行,可以这么写:

    1
    wget -qO- https://example.com/myscript.sh | sudo bash

但这会直接执行远程脚本,安全性取决于你对来源的信任程度。

在 Ubuntu 里,用 wget 下载脚本后立即获得“可执行权限”,只需在下载命令后再执行一次 chmod +x 即可。下面给出几种常见写法:


✅ 推荐:分两步

1
2
3
4
5
# 1. 下载脚本
wget https://example.com/myscript.sh

# 2. 赋可执行权限
chmod +x myscript.sh

✅ 一行完成(用 && 串联)

1
wget https://example.com/myscript.sh && chmod +x myscript.sh

✅ 一行完成(用 ; 保证即使 wget 失败也执行 chmod)

1
wget https://example.com/myscript.sh; chmod +x myscript.sh

⚠️ 注意

  • wget 本身不会自动给文件加可执行权限,Linux 默认新文件权限是 644-rw-r--r--)。

  • 如果你希望直接下载并运行,可以这么写:

    1
    wget -qO- https://example.com/myscript.sh | sudo bash

但这会直接执行远程脚本,安全性取决于你对来源的信任程度。

250723-ubuntu-Linux wget下载运行bash脚本

安装运行脚本

  • 下载DEB谷歌浏览器文件
  • 配置SSH PUB KEY
  • 配置禁用更新/UTF-8/字体/ShangHai
  • 配置sudoers 管理员账号
  • sudo apt update && sudo apt upgrade -y

wget 直接直接远程脚本

  • wget 本身不会自动给文件加可执行权限,Linux 默认新文件权限是 644-rw-r--r--)。

  • 如果你希望直接下载并运行,可以这么写:

    1
    wget -qO- https://example.com/myscript.sh | sudo bash

但这会直接执行远程脚本,安全性取决于你对来源的信任程度。

在 Ubuntu 里,用 wget 下载脚本后立即获得“可执行权限”,只需在下载命令后再执行一次 chmod +x 即可。下面给出几种常见写法:


✅ 推荐:分两步

1
2
3
4
5
# 1. 下载脚本
wget https://example.com/myscript.sh

# 2. 赋可执行权限
chmod +x myscript.sh

✅ 一行完成(用 && 串联)

1
wget https://example.com/myscript.sh && chmod +x myscript.sh

✅ 一行完成(用 ; 保证即使 wget 失败也执行 chmod)

1
wget https://example.com/myscript.sh; chmod +x myscript.sh

⚠️ 注意

  • wget 本身不会自动给文件加可执行权限,Linux 默认新文件权限是 644-rw-r--r--)。

  • 如果你希望直接下载并运行,可以这么写:

    1
    wget -qO- https://example.com/myscript.sh | sudo bash

但这会直接执行远程脚本,安全性取决于你对来源的信任程度。

250722-Git-LF will be replaced by CRLF the next time Git touches it问题解决

问题描述

LF will be replaced by CRLF the next time Git touches it

这个警告是 Git 在 Windows 系统上常见的行尾符(line ending)转换提示。它的意思是:

当前工作区中的文件 nokia 使用的是 Unix 风格的行尾符(LF),但 Git 检测到你在 Windows 系统上工作,默认会在下次提交或检出时将其转换为
Windows 风格的行尾符(CRLF)。


✅ 如何解决这个问题(两种方式):

方式一:保持 LF(推荐)

如果你希望保持 Unix 风格(LF),避免 Git 自动转换为 CRLF,可以这样做:

  1. 取消自动转换(项目级): 在项目根目录下运行:

    1
    git config core.autocrlf false
  2. 创建或修改 .gitattributes 文件(推荐): 在项目根目录下创建或编辑 .gitattributes 文件,添加以下内容:

    1
    * text=auto eol=lf

这会强制所有文本文件使用 LF 作为行尾符,无论你在哪个系统上。

  1. 重新标准化文件(可选): 如果你已经有一些文件被转换为 CRLF,可以运行:

    1
    git add --renormalize .

方式二:接受 CRLF(不推荐)

如果你不关心行尾符,允许 Git 自动转换为 CRLF,可以忽略警告或运行:

1
git config core.autocrlf true

🔍 总结建议

目标 操作建议
保持 LF(推荐) .gitattributes 中设置 * text=auto eol=lf
接受 CRLF git config core.autocrlf true

📌 补充说明

  • LF:Unix/Linux/macOS 默认行尾符(\n
  • CRLF:Windows 默认行尾符(\r\n
  • Git 的 core.autocrlf 设置只在本地生效,不会影响远程仓库。

如果你是团队协作项目,强烈建议使用 .gitattributes 统一行尾符,避免跨平台冲突。