grep
| 选项 | 功能 |
|---|---|
| -r | 递归搜索子目录 |
| -i | 忽略大小写 |
| -n | 显示行号 |
| -l | 只显示文件名 |
| -v | 反转匹配(显示不包含的行) |
| -w | 全词匹配 |
| -E | 使用扩展正则表达式 |
| --include | 指定文件类型 --include=*.{js,py} |
| --exclude | 排除文件类型 --exclude=*.log |
| --exclude-dir | 排除目录 --exclude-dir={.git,node_modules}### Markdown表格基本语法 |
查找当前目录下所有 Python 文件中的 "import" 语句
bash
grep -rn --include=*.py "import" .
查找包含ip的文件
bash
grep -rE "([0-9]{1,3}\.){3}[0-9]{1,3}" /etc/
systemctl
开启服务
bash
sudo systemctl start v2raya.service
停止服务
bash
sudo systemctl stop v2raya.service
设置开机自启动(本身有自启动服务的话)
bash
sudo systemctl enable v2raya.service
撤销开机自启动
bash
sudo systemctl disable v2raya
sudo systemctl stop v2raya