Windows PowerShell Resolve-Path equivalent in Linux
Converts a relative path or symbolic link into its normalized absolute path.
PowerShell Resolve-Path
realpath path/to/file
realpath path/to/file
realpath path/to/file
Overview
What this command does
On Windows, "PowerShell Resolve-Path" is used to resolve an absolute path. On Linux, the closest practical mapping shown here is "realpath path/to/file". Converts a relative path or symbolic link into its normalized absolute path. This reference is grouped under PowerShell Equivalents → File System.
Windows → Linux context
What changes when you use this on Linux?
Equivalent task, different tool
Windows PowerShell Resolve-Path maps to realpath path/to/file for this task. Treat this as a workflow mapping rather than a character-for-character syntax translation.
Portable across the compared distros
The Debian/Ubuntu, Fedora and Arch rows use the same command in this mapping. Package availability or defaults can still vary, so check the installed tool version when an option behaves differently.
Command-specific caution
realpath normally fails when required path components do not exist. Use realpath -m on GNU systems to normalize missing paths.
For the broader concept behind this mapping, read PowerShell vs Bash.
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 option | Use |
|---|---|
realpath ./notes.txt | Resolve a relative path |
realpath ../Downloads | Normalize parent-directory references |
readlink -f symlink | Resolve a symbolic link |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
Debian/Ubuntu, Fedora and Arch all use "realpath path/to/file" for this mapping. The command syntax shown here is portable across the three rows, although installed versions and system defaults can still vary.
| Distribution | Package manager / base | Equivalent command | Difference 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
Keep learning