惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 司徒正美
M
MIT News - Artificial intelligence
博客园_首页
IT之家
IT之家
L
LangChain Blog
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
人人都是产品经理
人人都是产品经理
博客园 - Franky
云风的 BLOG
云风的 BLOG
罗磊的独立博客
量子位
G
Google Developers Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 【当耐特】
博客园 - 叶小钗
S
SegmentFault 最新的问题
Stack Overflow Blog
Stack Overflow Blog
B
Blog
T
Tailwind CSS Blog
A
About on SuperTechFans
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com

蔡不菜和他的uU们

vLLM实践之个人AI基建——云端vLLM+SSH Tunnel+本地Cherry Studio 使用acme.sh进行阿里云域名SSL证书申请与部署自动化 OCR实践—PaddleOCR-VL-1.5 OCR实践—PaddlOCR-VL OCR新范式 2025年终总结-选择,未知的路 CUDA TensorRT Python智能提示补全解决方案 阿里云实例迁移、IP换绑 VS大型CPP项目调试,Debug模式,Release模式,附加到进程模式 NVIDIA相关库简介 2024已结算,万象新始,远虑近忧 OCR实践-Table-Transformer
code snippets
()x · 2026-08-08 · via 蔡不菜和他的uU们

pip / uv

# 清华
-i https://pypi.tuna.tsinghua.edu.cn/simple

# 南大
-i https://mirrors.nju.edu.cn/pypi/web/simple
--index-url https://mirrors.nju.edu.cn/pytorch/whl/cu129

# 交大
-f https://mirror.sjtu.edu.cn/pytorch-wheels/cu124

# 科大
-i https://pypi.mirrors.ustc.edu.cn/simple/

# 阿里
-i https://mirrors.aliyun.com/pypi/simple/
-f https://mirrors.aliyun.com/pytorch-wheels/cu124

# 下载uv 加速
curl -LsSf https://uv.agentsmirror.com/install-cn.sh | sh
export UV_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple

export HF_ENDPOINT=https://hf-mirror.com

linux

# 查找 / 下 前30大的文件夹
sudo du -xh / | sort -rh | head -30

数东西

命令 功能
ls | wc -w 查看有多少个文件及文件夹
ls | wc -c 查看目录下多少个字节数
ls -l |grep "^-"|wc -l 统计某文件夹下文件的个数
ls -l |grep "^d"|wc -l 统计某文件夹下目录的个数
ls -lR|grep "^-"|wc -l 统计文件夹下文件的个数,包括子文件夹里的

network

# 设置 HTTP 和 HTTPS 代理
export http_proxy="http://127.0.0.1:7890"
export https_proxy="http://127.0.0.1:7890"

# 如果代理支持 SOCKS5,也可以使用:
# export ALL_PROXY="socks5://127.0.0.1:7890"

win

# cmd
set http_proxy=http://127.0.0.1:7890
set https_proxy=http://127.0.0.1:7890

set http_proxy=
set https_proxy=

# powershell
$env:http_proxy="http://127.0.0.1:7890"
$env:https_proxy="http://127.0.0.1:7890"

Remove-Item Env:\http_proxy
Remove-Item Env:\https_proxy
# apt 源
ip
ip route get xx.xx.xx.xx

ifconfig

nslookup
# sudo apt install dnsutils -y

netplan
# sudo apt install netplan.io

win (powershell)

PowerShell (PS) 的命令称为 Cmdlet,遵循 动词-名词 (Verb-Noun) 的命名规范(如 Get-Process)。

文件/目录操作

功能 PowerShell 命令 别名 Linux 对应
列出文件 Get-ChildItem ls, dir, gci ls
切换目录 Set-Location cd, sl cd
显示路径 Get-Location pwd, gl pwd
新建文件夹 New-Item -ItemType Directory mkdir mkdir
新建文件 New-Item -ItemType File ni touch
复制 Copy-Item cp, copy cp
移动/重命名 Move-Item mv, move mv
删除 Remove-Item rm, del, ri rm
查看内容 Get-Content cat, gc cat
查找文件 Get-ChildItem -Recurse -Filter *.txt - find . -name "*.txt"

技巧ls 在 PS 中返回的是对象而非纯文本,你可以直接 .Name.Length 获取属性。

进程/服务管理

对应 Linux ps, kill, systemctl

功能 PowerShell 命令 别名 Linux 对应
查看进程 Get-Process gps, ps ps aux
停止进程 Stop-Process -Name "chrome" spps kill
查看服务 Get-Service gsv systemctl list-units
启动服务 Start-Service -Name "wuauserv" sasv systemctl start
停止服务 Stop-Service -Name "wuauserv" spsv systemctl stop
重启服务 Restart-Service -Name "spooler" rsv systemctl restart

网络与系统

对应 Linux ifconfig, ping, top

功能 PowerShell 命令 备注
IP 配置 Get-NetIPConfiguration ipconfig 更详细,对象化输出
测试连通性 Test-Connection google.com 类似 ping,但默认只发 4 个包
端口监听 Get-NetTCPConnection -LocalPort 80 查看谁占用了 80 端口
系统信息 Get-ComputerInfo 获取 OS 版本、内存等详细信息
环境变量 $env:PATH 查看 PATH;$env:JAVA_HOME = "C:\Java" 设置临时变量

管道与过滤

对应 Linux grep, awk, head

PowerShell 的强大之处在于对象管道,而不是文本流。

  • 过滤 (Where-Object) -> 对应 grep / filter

    # 找出所有占用内存大于 100MB 的进程
    Get-Process | Where-Object { $_.WorkingSet64 -gt 100MB }
    
    # 简写形式 (? 是 Where-Object 的别名)
    Get-Process | ? WorkingSet64 -gt 100MB
  • 选择属性 (Select-Object) -> 对应 awk / cut

    # 只显示进程名和 ID
    Get-Process | Select-Object Name, Id
  • 排序 (Sort-Object) -> 对应 sort

    # 按 CPU 使用率降序排列
    Get-Process | Sort-Object CPU -Descending
  • 前 N 行 (Select-Object -First) -> 对应 head

    Get-Process | Select-Object -First 5
  • 全文搜索 (Select-String) -> 对应 grep

    # 在日志文件中搜索 "Error"
    Select-String -Path "app.log" -Pattern "Error"

帮助与探索

  • 获取帮助
    Get-Help Get-Process -Examples  # 查看示例
    Get-Help Get-Process -Full      # 查看完整文档
  • 查找命令
    Get-Command *service*  # 查找所有包含 service 的命令
  • 查看对象属性
    Get-Process | Get-Member  # 查看当前对象有哪些属性和方法可以调用