foam links
Show links to and from a note.
foam links (<identifier> | --path <path>) [options]Displays the outgoing links (notes this note links to) and incoming links (notes that link to this note, also called backlinks). The command can also be invoked as foam connections.
Options
Section titled “Options”| Option | Description |
|---|---|
--path <path> | Target note by exact file path instead of identifier |
--outgoing | Show only outgoing links |
--incoming | Show only incoming links (backlinks) |
--workspace <dir> | Workspace root (default: FOAM_WORKSPACE env var, then current directory) |
--format <fmt> | Output format: text (default) or json |
By default, both outgoing and incoming links are shown.
Examples
Section titled “Examples”Show all links for a note:
foam links my-note# Outgoing (2):# → related-topic notes/related-topic.md# → another-note notes/another-note.md## Incoming (1):# ← index index.mdShow only backlinks:
foam links my-note --incomingTarget by file path:
foam links --path notes/my-note.mdGet links as JSON for scripting:
foam links my-note --format jsonNote identifiers
Section titled “Note identifiers”Foam identifies notes by the shortest unique part of their filename (without extension). For example, a note at projects/alpha/notes.md might be identified as notes if that’s unique, or alpha/notes if there’s ambiguity. Use foam note id to check how a note is identified.
See also Backlinks for the backlinks panel in VS Code.
LINKS TO THIS PAGE
Foam CLI
Published with Foam