Linux Find Files and Symbolic Links

Linux Find Files and Symbolic Links

The find command is used to find the files and folders in a certain directory or the path defined with it.

With the option or flag -type we can filter what we need to search. The common ones are -type d — for directory or -type f — for file.

However, when using the option -type f the find command lists only the files and NOT the symbolic links. So we may get the list of files which are physical files and not the link files or symbolic links.

Linux Find Files and Symbolic Links

We can however use -type l for find command but this will list just the symbolic links and not the physical files.

The find command however has an option/flag which can get the symbolic links as well. The -L option for find command asks it to follow the symbolic links.

So the following command combination will list the files along with the symbolic files as well.

find -L /PATH/TO/SEARCH -type f

There are many combination you can use but this will ease out the life when you want to ensure ALL the files are listed.

Linux Find Files and Symbolic Links

No Comments

Post a Comment

Time limit is exhausted. Please reload CAPTCHA.