> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bash Older Than

The `-ot` (older than) operator is a binary file test operator in Bash used within conditional expressions to compare the modification timestamps (`mtime`) of two files. It evaluates to true (returns exit status `0`) if the first file is strictly older than the second file, or if the second file exists but the first file does not.

## Syntax

The operator can be used with the Bash `test` builtin (`[ ]`) or the Bash extended test keyword (`[[ ]]`). Note that `-ot` is a Bash/Ksh extension and is not part of the POSIX standard; it should not be relied upon for strictly portable POSIX `sh` scripts.

```bash theme={"dark"}
[ file1 -ot file2 ]

# or
[[ file1 -ot file2 ]]
```

## Evaluation Matrix

The operator resolves the comparison based on file existence and the `mtime` metadata retrieved via the `stat` system call. It returns false (exit status `1`) in any scenario not explicitly evaluating to true.

| State of `file1` | State of `file2` | Evaluation Result                                                                                |
| :--------------- | :--------------- | :----------------------------------------------------------------------------------------------- |
| Exists           | Exists           | **True** if `file1` `mtime` \< `file2` `mtime`. **False** if `file1` `mtime` >= `file2` `mtime`. |
| Does not exist   | Exists           | **True**                                                                                         |
| Exists           | Does not exist   | **False**                                                                                        |
| Does not exist   | Does not exist   | **False**                                                                                        |

## Technical Characteristics

* **Strict Inequality:** The comparison is strictly "older than". If both files have the exact same modification timestamp, the operator evaluates to false.
* **Symlink Dereferencing:** The `-ot` operator automatically dereferences symbolic links. It compares the `mtime` of the ultimate target files, not the timestamps of the symlinks themselves. If a symlink points to a non-existent file (a broken link), it is treated as a non-existent file.
* **Timestamp Precision:** In Bash 5.0 and later, running on modern filesystems (like ext4, xfs, or zfs), the `-ot` operator utilizes sub-second (nanosecond) precision (`st_mtim`) for its comparisons. In Bash 4.4 and earlier, or on legacy filesystems, the comparison is truncated to the nearest second (`st_mtime`).
* **Metadata Scope:** The operator strictly evaluates the modification time (`mtime`), which updates when file contents change. It does not evaluate the change time (`ctime`, metadata changes) or access time (`atime`).

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor Bash Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
