---
title: "Linux 命令速查 - 按场景分类的命令表 - AllTools - 全能工具箱"
description: "AllTools Linux 命令速查把文件、权限、网络、进程等场景命令归类，附常用参数示例。临上服务器手生时照着敲，比凭记忆拼命令更稳当。服务器操作更顺。运维更顺手。"
canonical_url: "https://tool.warmday.wang/info/linux-cheatsheet"
meta:
  author: AllTools
  keywords: "在线工具箱, AllTools, 实用工具, 生活常用, 数学计算, 文本处理, 图片处理, 开发者工具, PDF 工具, 单位换算, 免费工具, 免登录工具"
  "og:description": "AllTools Linux 命令速查把文件、权限、网络、进程等场景命令归类，附常用参数示例。临上服务器手生时照着敲，比凭记忆拼命令更稳当。服务器操作更顺。运维更顺手。"
  "og:image": "https://tool.warmday.wang/img/og-cover.png"
  "og:image:alt": "AllTools - 全能工具箱 Logo"
  "og:image:height": "630"
  "og:image:width": "1200"
  "og:title": "Linux 命令速查 - 按场景分类的命令表"
  "twitter:image": "https://tool.warmday.wang/img/og-cover.png"
---

> Index of every page on this site: [llms.txt](https://tool.warmday.wang/llms.txt)

# **Linux 命令速查**

Linux 常用命令速查表，按场景分类浏览。

### **文件操作 **14

`ls -la`列出所有文件（含隐藏）

`cd <dir>`切换目录

`pwd`显示当前路径

`cp -r <src> <dest>`递归复制目录

`mv <src> <dest>`移动/重命名文件

`rm -rf <dir>`强制递归删除目录

`mkdir -p <path>`递归创建目录

`touch <file>`创建空文件

`ln -s <target> <link>`创建软链接

`find <dir> -name "<pattern>"`按名称查找文件

`locate <pattern>`快速定位文件路径

`tree -L 2`树形显示目录结构

`du -sh <dir>`查看目录大小

`df -h`查看磁盘使用

### **文本处理 **12

`cat <file>`查看文件内容

`head -n 20 <file>`查看前 20 行

`tail -f <file>`实时追踪文件末尾

`grep -rn "<pattern>" <dir>`递归搜索文本

`sed -i "s/old/new/g" <file>`原地替换文本

`awk '{print $1}' <file>`提取第一列

`sort -u <file>`排序并去重

`uniq -c <file>`统计重复行

`wc -l <file>`统计行数

`diff <f1> <f2>`比较文件差异

`cut -d"," -f1 <file>`按分隔符提取列

`tr "a-z" "A-Z" < <file>`大小写转换

### **进程管理 **9

`ps aux`查看所有进程

`top`实时进程监控

`htop`增强版进程监控

`kill -9 <pid>`强制终止进程

`killall <name>`按名称终止进程

`bg / fg`后台/前台切换

`nohup <cmd> &`后台运行不挂断

`lsof -i :<port>`查看端口占用进程

`nice -n 10 <cmd>`调整进程优先级

### **网络工具 **11

`ping <host>`测试网络连通

`curl -O <url>`下载文件

`wget <url>`下载文件

`ssh user@host`SSH 远程登录

`scp <file> user@host:<path>`远程复制文件

`netstat -tlnp`查看监听端口

`ss -tlnp`查看监听端口(新版)

`nslookup <domain>`DNS 查询

`dig <domain>`DNS 详细查询

`ifconfig / ip a`查看网络接口

`traceroute <host>`路由追踪

### **权限管理 **6

`chmod 755 <file>`修改文件权限

`chmod +x <file>`添加执行权限

`chown user:group <file>`修改文件所有者

`umask 022`设置默认权限掩码

`sudo <cmd>`以管理员执行

`su - <user>`切换用户

### **包管理 **6

`apt install <pkg>`安装包(Debian/Ubuntu)

`apt update && apt upgrade`更新所有包

`yum install <pkg>`安装包(CentOS/RHEL)

`dnf install <pkg>`安装包(Fedora)

`pacman -S <pkg>`安装包(Arch)

`brew install <pkg>`安装包(macOS)

### **压缩解压 **8

`tar -czf <a>.tar.gz <dir>`压缩为 tar.gz

`tar -xzf <a>.tar.gz`解压 tar.gz

`tar -cjf <a>.tar.bz2 <dir>`压缩为 tar.bz2

`tar -xjf <a>.tar.bz2`解压 tar.bz2

`zip -r <a>.zip <dir>`压缩为 zip

`unzip <a>.zip`解压 zip

`gzip <file>`压缩为 gz

`gunzip <file>.gz`解压 gz

### **系统信息 **8

`uname -a`查看系统信息

`uptime`查看运行时间

`free -h`查看内存使用

`cat /proc/cpuinfo`查看 CPU 信息

`lsblk`查看块设备

`mount / umount`挂载/卸载

`systemctl status <service>`查看服务状态

`journalctl -u <service>`查看服务日志

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://tool.warmday.wang/#organization","name":"AllTools","alternateName":"AllTools - 全能工具箱","url":"https://tool.warmday.wang/","logo":{"@type":"ImageObject","url":"https://tool.warmday.wang/img/logo.png","width":512,"height":512}},{"@type":"WebSite","@id":"https://tool.warmday.wang/#website","url":"https://tool.warmday.wang/","name":"AllTools - 全能工具箱","inLanguage":"zh","publisher":{"@id":"https://tool.warmday.wang/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://tool.warmday.wang/?q={search_term_string}"},"query-input":"required name=search_term_string"}},{"@type":"WebPage","@id":"https://tool.warmday.wang/info/linux-cheatsheet#webpage","url":"https://tool.warmday.wang/info/linux-cheatsheet","isPartOf":{"@id":"https://tool.warmday.wang/#website"},"inLanguage":"zh","name":"Linux 命令速查 - 按场景分类的命令表","description":"AllTools Linux 命令速查把文件、权限、网络、进程等场景命令归类，附常用参数示例。临上服务器手生时照着敲，比凭记忆拼命令更稳当。服务器操作更顺。运维更顺手。"},{"@type":"BreadcrumbList","@id":"https://tool.warmday.wang/info/linux-cheatsheet#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"首页","item":"https://tool.warmday.wang/"},{"@type":"ListItem","position":2,"name":"参考手册","item":"https://tool.warmday.wang/info"},{"@type":"ListItem","position":3,"name":"Linux 命令速查","item":"https://tool.warmday.wang/info/linux-cheatsheet"}]}]}
```

## Sitemap

See the full [sitemap](https://tool.warmday.wang/sitemap.md) for all pages.
