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/*

This entry was posted in Internet Technology and tagged , , . Bookmark the permalink.

One Response to How to display full path/absolute path with ls command

  1. Tristan says:

    This seems to break the -R flag. Do you know of a way around this?

Comments are closed.