📂 Understanding Linux File and Directory Properties


ls -l command

When you run the ls -l command in a Linux terminal, you get detailed information about the files and folders in your directory.

Here’s an example output:

drwxrwxr-x 3 utsav utsav 4096 मई 11 2024 build
drwxr-xr-x 22 utsav utsav 4096 अप्रेल 26 23:11 Desktop
-rw-r--r-- 1 root    root    101639228 नवम्बर 25 23:25 discord-0.0.76.deb
drwxr-xr-x 9 utsav utsav 4096 अप्रेल 21 21:37 Documents
-rwxr-xr-x 1 root    root    62121 फरवरी 9 2024 dotnet-install.sh
drwxrwxr-x 2 utsav utsav 4096 फरवरी 11 2024 dotTraceSnapshots
drwxr-xr-x 15 utsav utsav 32768 अप्रेल 27 11:16 Downloads

Let’s see this in a proper tabluar form:

File/Directory PermissionsLinksOwnerGroupSize (bytes)Last ModifiedName
drwxrwxr-x3utsavutsav4096मई 11 2024build
drwxr-xr-x22utsavutsav4096अप्रैल 26 23:11Desktop
-rw-r--r--1rootroot101639228नवम्बर 25 23:25discord-0.0.76.deb
drwxr-xr-x9utsavutsav4096अप्रैल 21 21:37Documents
-rwxr-xr-x1rootroot62121फरवरी 9 2024dotnet-install.sh
drwxrwxr-x2utsavutsav4096फरवरी 11 2024dotTraceSnapshots

Let's break this down:


🛠️ What Each Column Means

ColumnMeaning
1File type and permissions
2Number of links (or subdirectories inside if a folder)
3Owner/User (who owns the file)
4Group (group the file belongs to)
5File size (in bytes)
6, 7, 8Last modified date and time
9File or directory name

📌 Understanding File Types

  • If the first character is d, it’s a directory (folder).

  • If it’s -, it’s a regular file.

  • If it’s l, it’s a symbolic link (like a shortcut).

Important:
- You can only use the cd command (change directory) on directories (d).
- If you try cd on a regular file (-), you’ll get an error!

Example:

Attempting to Navigate into discord-0.0.76.deb

When you try to change into a file that is not a directory, such as the .deb file in this case, you will encounter an error. Here's the command and the resulting error:

$ cd discord-0.0.76.deb
bash: cd: discord-0.0.76.deb: Not a directory

🔐 Permission Details (r, w, x)

The first 10 characters represent permissions:

Example:

-rwxr-xr-x

Breakdown:

SetMeaning
1st characterFile type (- for file, d for directory)
2-4Owner permissions (e.g., rwx = read, write, execute)
5-7Group permissions (e.g., r-x = read, execute)
8-10Others permissions (e.g., r-x = read, execute)

Permission letters:

  • r → Read

  • w → Write

  • x → Execute

  • - → No permission


🎯 Example: Breaking Down a Permission

-rwxr-xr--

Means:

  • Owner can read, write, and execute.

  • Group can read and execute, but not write.

  • Others can read only.

📌 A user with rwx permissions can perform all CRUD operations (Create, Read, Update, Delete).


🖥️ Linux vs Windows: A Simple Comparison

  • In Linux, ls -l shows you file properties directly in the terminal.

  • In Windows, you right-click → Properties to see the same kind of info (like size, permissions, owner, etc.).


🏁 Wrapping Up

Understanding file types, ownership, and permissions is critical when working in Linux.
It helps you move safely between directories, manage files properly, and avoid common permission errors.

Next time you list files with ls -l, you’ll know exactly what each part means! 🐧


0
Subscribe to my newsletter

Read articles from Utsav Lamichhane directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Utsav Lamichhane
Utsav Lamichhane