Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get absolute path of a directory?

Tags:

linux

bash

I want to automate the following thing:

cd into current directory

cd workdir

make a new directory

mkdir mydata

and get the absolute path to this mydata directory

like image 382
Hello lad Avatar asked Sep 07 '25 14:09

Hello lad


1 Answers

There is a Unix utility that can achieve that:

readlink --canonicalize nameofyourfileorfolder
like image 167
edi9999 Avatar answered Sep 10 '25 05:09

edi9999