↑↓ 选择 · Enter 打开 · Esc 关闭

Linux 命令速查

53 条命令 · 点击右侧按钮复制命令

故障排查 53

ping -c 4 8.8.8.8 Linux ping 命令 ⭐ 基础
2
traceroute 8.8.8.8 Linux traceroute ⭐ 基础
1
tcpdump -i eth0 port 80 抓包 ⭐⭐ 常用
1
netstat -tlnp 查看监听端口 ⭐⭐ 常用
1
ss -tlnp 现代版的 netstat ⭐⭐ 常用
1
ip addr show 查看网络接口 ⭐⭐ 常用
1
ip route show 查看路由表 ⭐⭐ 常用
2
uname -a 查看系统内核信息 ⭐⭐ 常用
1
hostname 查看主机名 ⭐ 基础
1
uptime 查看运行时间和负载 ⭐⭐ 常用
1
date 查看/设置日期时间 ⭐ 基础
2
whoami 查看当前用户 ⭐ 基础
2
who 查看登录用户 ⭐⭐ 常用
1
top 实时查看进程和资源 ⭐⭐ 常用
1
free -h 查看内存使用 ⭐⭐ 常用
2
df -h 查看磁盘使用 ⭐⭐ 常用
2
du -sh /home 查看目录大小 ⭐⭐ 常用
2
ls -lah 详细列出文件(含隐藏) ⭐ 基础
1
cd /path/to 切换目录 ⭐ 基础
1
pwd 显示当前目录 ⭐ 基础
2
cp src dst 复制文件/目录 ⭐ 基础
1
mv src dst 移动/重命名 ⭐ 基础
1
rm -rf dir 删除文件/目录 ⭐ 基础
1
find / -name "*.log" 查找文件 ⭐⭐ 常用
2
cat file.txt 查看文件内容 ⭐ 基础
1
less file.txt 分页查看 ⭐⭐ 常用
1
head -n 10 file 看前 10 行 ⭐⭐ 常用
1
tail -f /var/log/syslog 实时跟踪日志 ⭐⭐ 常用
1
grep "text" file 文本搜索 ⭐ 基础
2
sed -i "s/old/new/g" file 替换文本 ⭐⭐ 常用
2
awk "{print $1}" file 列处理 ⭐⭐ 常用
1
sort file | uniq -c 排序去重计数 ⭐⭐ 常用
2
ps aux | grep nginx 查看进程 ⭐ 基础
1
kill -9 PID 强制结束进程 ⭐⭐ 常用
1
systemctl status nginx 查看服务状态 ⭐⭐ 常用
1
systemctl restart nginx 重启服务 ⭐⭐ 常用
1
systemctl stop nginx 停止服务 ⭐⭐ 常用
2
systemctl enable nginx 开机自启 ⭐ 基础
2
journalctl -u nginx -f 查看服务日志 ⭐⭐ 常用
2
curl https://example.com HTTP 请求 ⭐⭐ 常用
1
wget URL 下载文件 ⭐⭐ 常用
1
ssh user@host 远程登录 ⭐⭐ 常用
2
scp file user@host:dst 远程复制 ⭐ 基础
1
rsync -avz src dst 增量同步 ⭐⭐ 常用
1
chmod 755 file 修改权限 ⭐⭐ 常用
1
chown user:group file 修改属主 ⭐⭐ 常用
1
chmod +x script.sh 添加执行权限 ⭐⭐ 常用
1
mount /dev/sdb1 /mnt 挂载磁盘 ⭐⭐ 常用
2
umount /mnt 卸载 ⭐⭐ 常用
2
apt update && apt upgrade -y Debian/Ubuntu 更新 ⭐ 基础
1
apt install nginx Debian/Ubuntu 安装包 ⭐⭐ 常用
2
yum update -y CentOS 更新 ⭐ 基础
1
yum install nginx CentOS 安装包 ⭐⭐ 常用
1