Back to commands

Linux Survival Basics

Read-only

Check Owner and Mode in One Line

A path exists but access fails, and you need owner, group, and mode quickly.

Command

stat -c '%A %U:%G %n' /var/www/example/index.html

Before you run this

System impact: Read-only. Low when scoped to the shown target.

When not to use it: Do not stop at the file if parent directories may block access.

Expected output

A compact permission and ownership line.

System impact

Read-only. Nothing changes. The command prints permissions, owner, group, and filename.

May require elevated permissions on protected paths or service-owned files.

Recovery / rollback: no state is changed.

When to use it

Use this before changing file permissions or ownership.

When not to use it

Do not stop at the file if parent directories may block access.

next steps

Related commands

Linux Survival Basics Read-only

Check Web File Owner and Mode

The file can exist and still be unreadable to Nginx.

stat -c '%A %U:%G %n' /srv/www/site/index.html
Study mapping

Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.

  • LPIC-1 style command-line practice
  • LFCS style performance-task practice
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.