Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux command file for symbolic links

when I try to check the type of an executable file, I always get this:

symbolic link to <another_file> 

Then I have to dig further and run file <another_file>. Sometimes this could take 5 or 6 rounds. I'm wondering whether there is a way to let file to recursively go to the original file and tell me the file type.

like image 564
Jay Wong Avatar asked Mar 20 '26 01:03

Jay Wong


1 Answers

Specifying -L to file should make it follow symlinks. From the man page:

   -L, --dereference
       option causes symlinks to be followed, as the like-named option
       in ls(1) (on systems that support symbolic links).  This is the
       default if the environment variable POSIXLY_CORRECT is defined.
like image 160
NPE Avatar answered Mar 22 '26 19:03

NPE