Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (18.4k points)

I have my directory /dir inside which there are 3 symlinks to other directories

 /dir/dir11, /dir/dir12, and /dir/dir13.

I want to list all the files in dir including those in 

dir11, dir12 and dir13.

To be more generic, i would like to list all files including those within the directories which are symlinks. find ., ls -R, etc

1 Answer

0 votes
by (36.8k points)
edited by

The -L option to ls will do the work. It dereferences the symbolic links.

So your command has to be:

ls -LR

You can also do this using

find -follow

The -follow option finds the following symbolic links to directories.

On Mac OS X use

find -L

as -follow has been deprecated.

To know about Linux join the Linux training

Do check out the video below

Related questions

0 votes
1 answer
asked Dec 24, 2020 in Linux by blackindya (18.4k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...