CLI:Basics File Management Part 3 – Permissions, Ownership, and File Previews
This post wraps up the File Management portion of our CLI:Basics series.
We’re moving a little deeper now — into permissions, ownership, and file previews — so you can start managing your Linux system with full confidence.
Let’s dive right in:
🔐 Understanding File Permissions (chmod
)
- View file permissions:
ls -l
- Permission structure explained:
- First character: type (
-
= file,d
= directory) - Next nine characters: three groups of read/write/execute for user, group, others
- First character: type (
- Numeric chmod example (easier once you know the math):
chmod 664 file.txt
- Symbolic chmod example (even easier to remember!):
chmod u+rwx,g+r,o-rwx file.txt
Tip:
Using symbolic (u
, g
, o
, +
, -
) is often more intuitive than memorizing number codes.
👑 Changing Ownership with chown
- Change file owner and group:
sudo chown newuser:newgroup file.txt
- Change only the owner:
sudo chown newuser file.txt
Important:
Changing ownership often requires sudo
because you’re affecting other users’ access rights.
📄 Previewing Files with head
and tail
- View the first 10 lines of a file:
head file.txt
- View the last 10 lines of a file:
tail file.txt
- Customize number of lines shown:
head -n 5 file.txt tail -n 5 file.txt
Use cases:
Quickly preview configuration files, logs, or large text files without opening the whole thing.
Final Thoughts
You made it through the full CLI:Basics File Management track!
Now you have the skills to not only manipulate files and directories, but control who can access them and how.
Linux gives you freedom — real control starts with understanding permissions and ownership.
Ready for more?
Stay tuned for CLI:Advanced, where we go even deeper into system-level management, scripting, and pro-level command line workflows!
👉 Like, subscribe, and hit that notification bell to stay ahead!