分类 · 30 个片段

Linux Shell

本分类收录可复制代码片段,点击卡片查看说明与完整代码。

Linux Shell · bash 查看目录与文件

pwd / ls 常用参数。

Linux Shell · bash 切换目录与返回

cd / pushd / popd。

Linux Shell · bash 创建目录与空文件

mkdir -p / touch。

Linux Shell · bash 复制移动与删除

cp / mv / rm。

Linux Shell · bash 权限与属主

chmod / chown。

Linux Shell · bash find 按名查找

查找文件。

Linux Shell · bash grep 递归搜索

在代码中搜关键字。

Linux Shell · bash sed 批量替换

行内替换文本。

Linux Shell · bash awk 取列统计

处理空白分隔输出。

Linux Shell · bash 磁盘与目录占用

df / du。

Linux Shell · bash 查看与跟踪日志

tail / less。

Linux Shell · bash journalctl 看服务日志

systemd 日志。

Linux Shell · bash systemctl 启停服务

管理 systemd 服务。

Linux Shell · bash 查看进程与负载

ps / top / htop。

Linux Shell · bash 查看内存与缓存

free -h。

Linux Shell · bash 结束进程

kill / killall。

Linux Shell · bash curl 查看响应头

检查状态码与头。

Linux Shell · bash wget 下载文件

断点续传。

Linux Shell · bash 打包与解压

tar / gzip。

Linux Shell · bash rsync 同步备份

增量同步目录。

Linux Shell · bash scp 传输文件

SSH 拷贝。

Linux Shell · bash SSH 密钥登录

ssh-keygen / ssh-copy-id。

Linux Shell · bash crontab 定时任务

编辑与列任务。

Linux Shell · bash 环境变量与 PATH

export / echo。

Linux Shell · bash 常用 alias 示例

缩短命令。

Linux Shell · bash UFW 放行端口

防火墙基础。

Linux Shell · bash 查看监听端口

ss / netstat。

Linux Shell · bash 管道与 tee

保存同时输出。

Linux Shell · bash xargs 批量处理

把列表交给命令。

Linux Shell · bash history 与重复命令

历史命令技巧。