← All commands
Topic hub PowerShell Equivalents
Windows Linux PowerShell Equivalents File System

Windows PowerShell Resolve-Path equivalent in Linux

Converts a relative path or symbolic link into its normalized absolute path.

Windows PowerShell Resolve-Path
Linux equivalents
Debian/Ubuntu same command
realpath path/to/file
Fedora same command
realpath path/to/file
Arch same command
realpath path/to/file

Overview

What this command does

Converts a relative path or symbolic link into its normalized absolute path.

Migration tip: realpath is useful in scripts when you need one canonical path. readlink -f provides similar behavior on GNU systems.

Practical tasks

Common use cases

Resolve an absolute path

Converts a relative path or symbolic link into its normalized absolute path.

realpath ./notes.txt

Resolve a relative path

realpath ../Downloads

Normalize parent-directory references

readlink -f symlink

Resolve a symbolic link

Ready to run

Copyable Linux commands

Review paths, device names, package names and permissions before running any command.

realpath ./notes.txt
realpath ../Downloads
readlink -f symlink

Walkthrough

Examples with explanations

realpath ./notes.txt # print the absolute normalized path
realpath ../Downloads # resolve a path containing ..
readlink -f symlink # follow a symbolic link to its final target

Reference

Common options and variations

Command or optionUse
realpath ./notes.txtResolve a relative path
realpath ../DownloadsNormalize parent-directory references
readlink -f symlinkResolve a symbolic link

Distro differences

Debian/Ubuntu vs Fedora vs Arch

This command is the same on Debian/Ubuntu, Fedora and Arch Linux when the relevant tool is installed.

DistributionPackage manager / baseEquivalent commandDifference to notice
Debian/Ubuntu same command realpath path/to/file Same command on this distribution.
Fedora same command realpath path/to/file Same command on this distribution.
Arch same command realpath path/to/file Same command on this distribution.

Important

What to watch out for

realpath normally fails when required path components do not exist. Use realpath -m on GNU systems to normalize missing paths.

Keep learning

Related PowerShell Equivalents commands