Online Linux Terminal Logo
OnlineLinuxTerminal
文本处理CLI Manual

$echo

Print text strings or write data to files using shell redirection.

命令语法POSIX Standard
echo [OPTIONS] [STRING...]
Linux 社区2.4k 在线

与真实 Linux 用户交流,学习常用命令并免费获取精美速查表 PDF。

在交互式终端沙盒中实时运行

无需安装的客户端实时仿真环境。

在全屏终端工作区中打开 ↗
bash — terminal

概述与工作原理

`echo` displays strings of text to standard output. When paired with `>` (overwrite) or `>>` (append) redirection operators, `echo` is the most common way to create config files, append environment variables, or print script debug statuses.

常用参数与选项说明

Flag / OptionDescription
-eEnable interpretation of backslash escapes (e.g., \n for newline, \t for tab).
-nDo not output the trailing newline character.

实际生产案例与代码范例

#1Write text to a new file
echo "API_PORT=8080" > /home/user/.env && cat /home/user/.env

Creates or overwrites .env with API_PORT=8080.