Skip to content

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.

OptionDescription
--path <path>Target note by exact file path instead of identifier
--outgoingShow only outgoing links
--incomingShow 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.

Show all links for a note:

Terminal window
foam links my-note
# Outgoing (2):
# → related-topic notes/related-topic.md
# → another-note notes/another-note.md
#
# Incoming (1):
# ← index index.md

Show only backlinks:

Terminal window
foam links my-note --incoming

Target by file path:

Terminal window
foam links --path notes/my-note.md

Get links as JSON for scripting:

Terminal window
foam links my-note --format json

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.

Published with Foam