# 📂 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:

```bash
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 Permissions** | **Links** | **Owner** | **Group** | **Size (bytes)** | **Last Modified** | **Name** |
| --- | --- | --- | --- | --- | --- | --- |
| 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](http://dotnet-install.sh) |
| drwxrwxr-x | 2 | utsav | utsav | 4096 | फरवरी 11 2024 | dotTraceSnapshots |

Let's break this down:

---

## 🛠️ What Each Column Means

| Column | Meaning |
| --- | --- |
| 1 | File type and permissions |
| 2 | Number of links (or subdirectories inside if a folder) |
| 3 | Owner/User (who owns the file) |
| 4 | Group (group the file belongs to) |
| 5 | File size (in bytes) |
| 6, 7, 8 | Last modified date and time |
| 9 | File 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:
> 
> ```bash
> $ 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:

```plaintext
-rwxr-xr-x
```

Breakdown:

| Set | Meaning |
| --- | --- |
| 1st character | File type (`-` for file, `d` for directory) |
| 2-4 | Owner permissions (e.g., `rwx` = read, write, execute) |
| 5-7 | Group permissions (e.g., `r-x` = read, execute) |
| 8-10 | Others permissions (e.g., `r-x` = read, execute) |

**Permission letters:**

* `r` → Read
    
* `w` → Write
    
* `x` → Execute
    
* `-` → No permission
    

---

## 🎯 Example: Breaking Down a Permission

```plaintext
-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! 🐧

---
