Display only files and folders that are symbolic links in tcsh or bash

后端 未结 11 859
灰色年华
灰色年华 2021-01-30 13:20

Basically I want do the following:

ls -l[+someflags]

(or by some other means) that will only display files that are symbolic links

so t

11条回答
  •  一个人的身影
    2021-01-30 13:58

    To display JUST the symlinks and what they link to:

    find -P . -type l -exec echo -n "{} -> " \; -exec readlink {} \;
    

    To limit to JUST THIS DIR

    find -P .  -maxdepth 1 -type l -exec echo -n "{} -> " \; -exec readlink {} \;
    

    Example output (after ln -s /usr/bin moo):

    ./moo -> /usr/bin
    

提交回复
热议问题