echo

无需编辑器即可读取文本文件:过滤行、保留行号,并限制输出的开头或结尾。

文件版本 1.2.2稳定别名: read
lil-terminal

概览

echo 用于无需打开编辑器时快速查看文本。它支持普通文本或正则表达式搜索、独立列显示原始行号,并可只保留结果的前几行或后几行。

无需打开编辑器即可读取文本

echo 适合快速读取日志和配置;文本过滤、行号以及头部/尾部限制通常能避免打开完整编辑器。

语法

lil-terminal
echo <file> [text] [options]

参考

echo <file>

显示文本文件内容

echo <file> "text"

显示包含 "text" 的行

-i "text"

忽略大小写搜索 "text"

-r "pattern"

使用 PHP 正则表达式搜索

-n

显示文件内容并带行号

-h <lines>

显示前 <lines> 行

-t <lines>

显示后 <lines> 行

read <file>

echo <file> 的别名

逐行处理

-n 把源文件行号放在独立列中;-h-t 对过滤后的结果取前若干行或后若干行。

别名

read 是由 echo 提供并记录在文档中的辅助命令。它接受相同参数,删除 echo 后也会一并消失。

限制

二进制文件会被拒绝。输出受行数和总大小限制,发生截断时会明确标记。

交互式 sandbox 预览

可直接在页面中运行预先准备的示例。结果已预先生成并在浏览器中显示;服务器不会执行任何终端命令。

显示文本文件内容

安装与管理

安装当前兼容版本。完整功能请选择 Base,精简包请选择 Minimum;已安装模块的更新请使用 upgrade。

Base 与 Minimum 是同一当前模块版本的两个包。

Base 包

安装包含本地参考和全部已发布模式的完整包。

install echo
Minimum 包

安装精简包。该包不包含本地参考;help <cmd> -i 会打开当前服务器参考。

install echo -m
精确公开版本

安装这个确切的已发布版本。

install echo -v 1.2.2
检查或升级

让 upgrade 检查兼容性,仅在需要时替换已安装块。

upgrade echo
删除模块

删除扩展块,不影响核心和其他模块。

install echo -u

示例

示例可复制,但网站不会执行。请先检查路径、权限和破坏性选项。

显示文本文件内容
cd \sandbox | echo data/sample.txt -h 3 | echo data/sample.txt "terminal" -i -n
4   It is never included in generated lil-terminal downloads and direct HTTP access is blocked.
Echo <file> 的别名
read sandbox/data/sample.txt
lil-terminal sandbox text file

This file is safe to read, copy, rename, replace, hash and archive.

read 是 echo 的辅助命令,并与 echo 共用同一版本流。

显示文件内容并带行号
echo sandbox/data/sample.txt -n
lil-terminal sandbox text file

This file is safe to read, copy, rename, replace, hash and archive.
忽略大小写搜索 "text"
echo sandbox/data/sample.txt "terminal" -i -n
4   It is never included in generated lil-terminal downloads and direct HTTP access is blocked.
使用 PHP 正则表达式搜索
echo sandbox/logs/app.log -r "/error|warning/i" -n
3   This directory is part of the server tree: website_e36e9fed/sandbox/
4   It is never included in generated lil-terminal downloads and direct HTTP access is blocked.
显示前 <lines> 行
echo sandbox/data/sample.txt -h 3
lil-terminal documentation sandbox

This directory is part of the server tree: website_e36e9fed/sandbox/
显示后 <lines> 行
echo sandbox/data/sample.txt -t 3
During module review, examples may be refined together with the command. Keep paths
stable whenever possible because public documentation links refer to them.
显示文本文件内容
echo \sandbox\data\missing.txt
未找到文件

本示例使用的文件: sandbox/data/sample.txt

该示例使用受保护的 /sandbox/ 文档工作区中的文件或目录。

lil-terminal sandbox text file

This file is safe to read, copy, rename, replace, hash and archive.

相关文档

当前公开版本

v1.2.22026-08-09

更清晰的 echo 参考

搜索、行号以及头尾截取统一整理为普通选项。