Linux readlink Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
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
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
- realpath Guide - Absolute path resolution
- ln Guide - Create links
- File Operations - File management
- readlink Documentation:
man readlink
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.