来源核对 2026-09-10
离线 HTML · 不执行命令

命令速查表

PowerShell:管理 Windows 与 WSL

PowerShell
wsl --version
wsl --status
wsl --list --verbose
wsl --update
wsl --shutdown
wsl -d Ubuntu

Ubuntu Bash:文件与文本

Ubuntu Bash
pwd
ls -la
cd ~/linux-learning-lab
mkdir -p demo
cp source.txt copy.txt
mv old.txt new.txt
rm -- file.txt
cat file.txt
less file.txt
grep -n "word" file.txt
find . -type f -name "*.md"

Ubuntu Bash:系统

Ubuntu Bash
whoami
id
uname -a
cat /etc/os-release
df -h
free -h
ps aux
ss -lnt
ip addr
getent hosts example.com

Git

Ubuntu Bash
git status
git diff
git add README.md
git commit -m "docs: update notes"
git log --oneline --decorate -5
git restore --staged FILE
git restore FILE

Docker 与 Compose

Ubuntu Bash
docker version
docker info
docker image ls
docker container ls --all
docker logs CONTAINER
docker exec -it CONTAINER sh
docker compose config
docker compose build
docker compose up -d
docker compose ps
docker compose logs
docker compose down

看到错误时先收集

PowerShell
wsl --status
wsl --list --verbose
Ubuntu Bash
pwd
whoami
git status
docker version
docker compose ps
docker compose logs --tail 100
ss -lnt