How to display full path/absolute path with ls command

How to list files and directories to show full path / absolute path name in the shell terminal.

We can use the ls command -d option in combination with the environment variable $PWD.

Syntax

ls -d $PWD/*

Example

Use the ls command to display the absolute path names of all files or directories in the current directory.

➜  ~ ls -d $PWD/*

Use the ls command to display absolute path names in long list format (-l).

➜  ~ ls -dl $PWD/*

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *