-
-
Notifications
You must be signed in to change notification settings - Fork 2
Linux echo Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to echo on Linux, covering Arch Linux, CachyOS, and other distributions including text output, variable display, and shell scripting.
echo displays text.
Uses:
- Print text: Display messages
- Show variables: Display variable values
- Scripts: Output in scripts
- Debugging: Print debug messages
Why it matters:
- Scripting: Essential for scripts
- Debugging: Print values
- Output: Display information
Display text:
# Print text
echo "Hello, World!"
# Or without quotes
echo Hello, World!Show variables:
# Print variable
echo $HOME
# Or
echo "$HOME"Same line:
# No newline
echo -n "Text"
# Continues on same lineSpecial characters:
# Enable escape sequences
echo -e "Line 1\nLine 2"
# \n: Newline
# \t: Tab
# \\: BackslashScript output:
#!/bin/bash
echo "Starting script..."
echo "User: $USER"
echo "Home: $HOME"Debug messages:
# Debug output
echo "Debug: Variable value is $variable"
# Or with timestamp
echo "[$(date)] Debug message"Check installation:
# Check echo
which echo
# Usually built-in
# Or in coreutilsThis guide covered echo usage, text output, and scripting for Arch Linux, CachyOS, and other distributions.
- Bash Scripting Guide - Scripting
- printf Guide - Formatted output
-
echo Documentation:
man echo
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.