{"slug": "realpath", "title": "realpath", "summary": "A developer documents the Unix command 'realpath' for outputting the absolute path of a file, noting its utility when referencing file paths for large language models (LLMs). The author suggests aliases like 'ap' or 'abspath' for convenience.", "body_md": "Quick note post. I wanted to document this handy little Unix command for spitting out the absolute path of a file:\n\n```\ncd ~/projects/<project>/docs\nls\nthing.md\nrealpath thing.md\n/path/to/home/projects/<project>/docs/thing.md\n```\n\nSo, if `thing.md`\n\nlives at ~/projects//docs/thing.md, we'd get something like...\n\n```\n/path/to/home/projects/<project>/docs/thing.md\n```\n\nEspecially when dealing with LLMs (needing to reference paths on your machine for the LLM to read), this is a handy one to have floating around your brain.\n\nMy only gripe is this has that old school linux command naming style when it should be something like `ap`\n\nor `abspath`\n\n. Aliases to the rescue!\n\n```\nalias ap=\"realpath\"\nalias abspath=\"realpath\"\nalias absolute_path=\"realpath\"\n```\n\nPop this in your Bash or ZSH config and open a new terminal:\n\n```\ncd ~/projects/<project>/docs\nls\nthing.md\nap thing.md\n/path/to/home/projects/<project>/docs/thing.md\n```\n\nEnjoy!", "url": "https://wpnews.pro/news/realpath", "canonical_source": "https://graybeard.ing/realpath/", "published_at": "2026-07-23 22:35:00+00:00", "updated_at": "2026-07-23 23:03:09.310566+00:00", "lang": "en", "topics": ["developer-tools", "large-language-models"], "entities": ["Unix"], "alternates": {"html": "https://wpnews.pro/news/realpath", "markdown": "https://wpnews.pro/news/realpath.md", "text": "https://wpnews.pro/news/realpath.txt", "jsonld": "https://wpnews.pro/news/realpath.jsonld"}}