Home > OS >  Printing full symbolic link information, starting from a root directory
Printing full symbolic link information, starting from a root directory

Time:04-24

We are interested in printing all the symbolic link information, starting from a root directory. We would like the information to be printed in the following format:
symbolic name -> actual name [Notice the same line]

We have tried the following and it gives us the symbolic name and actual name, but on different lines:
find . -type l -print -exec readlink -f {} \;

CodePudding user response:

If using GNU find:

find . -type l -printf '%p -> %l\n'

The %p format is the file name and %l the target of a symbolic link (or blank for other file types)

  • Related