Skip to content
Advertisement

Bash output all links in following format [closed]

i want to display all links in a directory in the following format:

JavaScript

How can i do this?

Advertisement

Answer

You can use find to search for symbolic links and use the builtin function printf to make it look like you want:

JavaScript

Explanation: find . searches in the actual directory, -maxdepth 1 only looks this directory, if omitting find runs through all subdirectories, -type l looks only for symbolic links, %f means the filename and %l the target of the link (empty if no link)

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement