← Lessons/Navigate the Filesystem
← Navigate the Filesystem

Read a file

Learn

Look inside a file

Listing tells you a file exists; to see what's in it, cat FILE prints its contents straight to the screen, so you can read it without opening an editor.

cat notes.txt

It's the quickest way to check a config file, read a README, or confirm that a script wrote what you expected. (For long files you'd reach for a pager like less, but for anything that fits on a screen, cat is the reflex.)

Print the contents of readme.txt with cat.

Interview prep

Filesystem basics come up in every infra screen.

How do you list files including hidden ones, with details?

ls -la — -l is the long format (permissions, owner, size, mtime) and -a includes dotfiles like .env and .gitignore.

sandbox@opspath: ~
OpsPath sandbox · Debian GNU/Linux 12 · GNU bash 5.2
Each command runs in a fresh, isolated sandbox with this lesson's files in ~.
Nothing carries over between commands, so chain with && or | when you need to.
Type a command and press Enter. ↑/↓ history · Ctrl+L clear · Ctrl+C cancel line
# ── Step 3 · Read a file ──
# Sign in to run commands — it's free.