[Unix] getting the absolute path of a file in Unix/Linux

 

Getting the absolute path of a file in Linux is a common task, and there are several ways to do it depending on whether the file is in your current directory or somewhere else on the system.

 

Goal Command
Resolve links and relative paths realpath <file>
Simple path expansion readlink -f <file>
Find file by name and get path find $(pwd) -name <file>
Locate an installed program which <program>
posted @ 2026-01-22 03:54  profesor  阅读(5)  评论(0)    收藏  举报