-
-
Notifications
You must be signed in to change notification settings - Fork 1
Linux realpath Guide
Mattscreative edited this page Dec 5, 2025
·
3 revisions
Complete beginner-friendly guide to realpath on Linux, covering Arch Linux, CachyOS, and other distributions including absolute path resolution, canonical paths, and path normalization.
Basic usage:
# Resolve path
realpath file.txt
# Returns absolute canonical pathRelative to absolute:
# Relative path
realpath ../file.txt
# Converts to absolute pathGet absolute:
# Absolute path
realpath file.txt
# Output: /full/path/to/file.txtFollow links:
# Follow symbolic links
realpath symlink
# Resolves to real file pathCanonical path:
# Canonical path
realpath /path/to/file
# Returns canonical absolute pathClean path:
# Remove . and ..
realpath /path/./to/../file
# Output: /path/fileMultiple paths:
# Multiple paths
realpath file1.txt file2.txt
# Resolves each pathPipe input:
# From input
echo -e "file1.txt\nfile2.txt" | xargs realpath
# Resolves each pathCheck installation:
# realpath is part of coreutils
# Usually pre-installed
# Check realpath
which realpathThis guide covered realpath usage, absolute path resolution, and canonical paths for Arch Linux, CachyOS, and other distributions.
- readlink Guide - Symbolic link resolution
- pwd Guide - Print working directory
- cd Guide - Change directory
-
realpath Documentation:
man realpath
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.