Skip to content

Linux readlink Guide

Mattscreative edited this page Dec 5, 2025 · 3 revisions

Linux readlink Guide

Complete beginner-friendly guide to readlink on Linux, covering Arch Linux, CachyOS, and other distributions including symbolic link resolution, link target reading, and path resolution.


Table of Contents

  1. readlink Basics
  2. Reading Links
  3. Canonical Paths
  4. Multiple Links
  5. Troubleshooting

readlink Basics

Read Link Target

Basic usage:

# Read link target
readlink symlink

# Shows target of symbolic link

Absolute Path

Full path:

# Absolute path
readlink -f symlink

# -f = canonicalize (follows all links)

Reading Links

Simple Link

Basic link:

# Read link
readlink /path/to/symlink

# Output: target path

Relative Link

Relative target:

# Relative link
readlink symlink

# Shows relative target path

Canonical Paths

Follow All Links

Canonical path:

# Follow all links
readlink -f symlink

# -f = canonicalize (resolves all links)

Real Path

Real file path:

# Get real path
readlink -f /path/to/link

# Returns absolute path to real file

Multiple Links

Chain Resolution

Link chains:

# Follow link chain
readlink -f link1

# Resolves: link1 -> link2 -> target

No Follow

Don't follow:

# Don't follow (default)
readlink symlink

# Shows immediate target only

Troubleshooting

readlink Not Found

Check installation:

# readlink is part of coreutils
# Usually pre-installed

# Check readlink
which readlink

Summary

This guide covered readlink usage, symbolic link resolution, and path resolution for Arch Linux, CachyOS, and other distributions.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally