Saturday, January 18, 2025
HomeProgrammingHow to get full path of a file?

How to get full path of a file?

To get the full path of a file in Linux, you can use the realpath command. This command resolves the absolute path of a file or directory. Here’s the syntax:

realpath filename

For example, to get the full path of a file named example.txt:

See also  How do you implement a FOR EACH loop in SQL Server?

realpath example.txt

Alternatively, you can use the readlink command with the -f option:

readlink -f filename

Both commands will return the absolute path to the specified file, resolving any symbolic links if applicable.

RELATED ARTICLES
0 0 votes
Article Rating

Leave a Reply

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
- Advertisment -

Most Popular

Recent Comments

0
Would love your thoughts, please comment.x
()
x