logo
🐧 Linux 命令

Linux

Linux Cheat Sheet - 快速参考指南,收录常用语法、命令与实践。

📂 分类 · Linux 命令🧭 Markdown 速查🏷️ 2 个标签
#linux#commands
向下滚动查看内容
返回全部 Cheat Sheets

Linux 常用命令速查

快速参考常用 Linux 命令与文件定位、权限、进程、网络操作示例。

基础文件操作

  • ls -lah:列出文件(含隐藏、权限、大小)
  • cd /path/to/dir:切换目录
  • pwd:打印当前目录
  • cp -r src dst:复制文件/目录
  • mv old new:移动或重命名
  • rm -rf target:删除(谨慎使用)
  • find . -name "*.log":查找匹配文件

查看与编辑

  • cat file / less file:查看文件
  • head -n 20 file / tail -f file:查看头尾/实时追加
  • grep -n "pattern" file:按行匹配
  • sed -n '1,10p' file:打印特定行
  • nano file / vim file:编辑文件

权限与用户

  • chmod +x script.sh:添加可执行权限
  • chmod 644 file:rw-r--r--
  • chown user:group file:变更所有者
  • sudo usermod -aG docker $USER:把用户加入组
  • id:查看当前用户/组

系统与进程

  • top / htop:系统监控
  • ps aux | grep name:查找进程
  • kill -9 <pid>:终止进程
  • df -h:磁盘占用
  • du -sh *:当前目录体积
  • free -h:内存使用
  • uptime:负载与运行时长

网络与端口

  • ip addr / ip route:网卡与路由
  • ping -c 4 host:连通性测试
  • curl -I https://example.com:HTTP 头
  • netstat -tulnp | grep :80:查看端口监听
  • ss -tulwn:快速端口列表
  • dig domain.com / nslookup domain.com:DNS 解析

压缩与归档

  • tar -czf archive.tar.gz dir:压缩目录
  • tar -xzf archive.tar.gz:解压
  • zip -r archive.zip dir / unzip archive.zip:Zip 打包

包管理(常见发行版)

  • Debian/Ubuntu: apt update && apt install pkg
  • CentOS/RHEL: yum install pkgdnf install pkg
  • Alpine: apk add pkg
  • Arch: pacman -S pkg

SSH 与远程

  • ssh user@host:远程登录
  • ssh -i key.pem user@host:指定私钥
  • scp file user@host:/path:上传文件
  • rsync -avh src/ user@host:/path/:同步目录

环境与变量

  • echo $PATH:查看 PATH
  • export KEY=value:设置环境变量
  • source ~/.bashrc:刷新配置

快捷组合

  • mkdir -p logs && cd $_:创建并进入新目录
  • grep -R "TODO" .:递归搜索 TODO
  • history | tail -20:查看最近命令
  • !!:重复上一条命令

提示:高风险命令(如 rm -rf /)务必谨慎,建议先 echols 确认目标。

相关 Cheat Sheets

1v1免费职业咨询
logo

Follow Us

linkedinfacebooktwitterinstagramweiboyoutubebilibilitiktokxigua

We Accept

/image/layout/pay-paypal.png/image/layout/pay-visa.png/image/layout/pay-master-card.png/image/layout/pay-airwallex.png/image/layout/pay-alipay.png

地址

Level 10b, 144 Edward Street, Brisbane CBD(Headquarter)
Level 2, 171 La Trobe St, Melbourne VIC 3000
四川省成都市武侯区桂溪街道天府大道中段500号D5东方希望天祥广场B座45A13号
Business Hub, 155 Waymouth St, Adelaide SA 5000

Disclaimer

footer-disclaimerfooter-disclaimer

JR Academy acknowledges Traditional Owners of Country throughout Australia and recognises the continuing connection to lands, waters and communities. We pay our respect to Aboriginal and Torres Strait Islander cultures; and to Elders past and present. Aboriginal and Torres Strait Islander peoples should be aware that this website may contain images or names of people who have since passed away.

匠人学院网站上的所有内容,包括课程材料、徽标和匠人学院网站上提供的信息,均受澳大利亚政府知识产权法的保护。严禁未经授权使用、销售、分发、复制或修改。违规行为可能会导致法律诉讼。通过访问我们的网站,您同意尊重我们的知识产权。 JR Academy Pty Ltd 保留所有权利,包括专利、商标和版权。任何侵权行为都将受到法律追究。查看用户协议

© 2017-2025 JR Academy Pty Ltd. All rights reserved.

ABN 26621887572