Viewing Content

Summary

This note is a quick reference for reading files, logs, and command output in the terminal. These commands are used constantly when checking configuration, inspecting text, and following logs during troubleshooting.

Commands

CommandPurpose
cat file.txtprint the whole file to the terminal
less file.txtopen a scrollable viewer for longer output
head file.txtshow the first lines of a file
tail -f logfile.logfollow a log file live as new lines appear
echo "text"print text or variable output to the terminal

Example usage

less /etc/os-release
head -n 5 file.txt
tail -f app.log
echo "$HOME"

Notes

  • less is usually safer than cat for large files
  • tail -f is one of the most useful commands for watching logs in real time
  • echo is often used to test shell values, output, or simple text formatting