WhichFile

Reports symlink targets and file types, like `which` and `file`.


Keywords
python, python3, 2, 3, which, file, whichfile, tool, executable
Licenses
GPL-3.0/GPL-3.0+
Install
pip install WhichFile==1.0.3

Documentation

WhichFile

This is a combination of the which and file commands. It will follow symlinks, reporting each link on the way, and then use libmagic to tell you what type of file it is.

Example:

Determine where rlogin is linked, and what type of file it is:

whichfile rlogin

Output:

/usr/bin/rlogin:
    -> /etc/alternatives/rlogin
        -> /usr/bin/slogin
            -> /usr/bin/ssh
                  Type: ELF 64-bit LSB  shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=2d691144f816b05319ba27679df4b847107b99d7, stripped
                  ```

This means that `rlogin` links to `/etc/alternatives/rlogin`,
which links to `slogin`, and finally `ssh`.

Options:
--------

Usage:
    whichfile -h | -v
    whichfile PATH... [-D] [-m] [-s]

Options:
    PATH          : Directory path or paths to resolve.
    -D,--debug    : Print some debugging info.
    -h,--help     : Show this help message.
    -m,--mime     : Show mime type instead of human readable form.
    -s,--short    : Short output, print only the final target.
                    On error nothing is printed and non-zero is returned.
    -v,--version  : Show version.