Command line 如何仅打印符号链接的目录?
使用find命令,我可以传递标志-type以仅打印特定类型的文件。Command line 如何仅打印符号链接的目录?,command-line,directory,find,symlink,file-type,Command Line,Directory,Find,Symlink,File Type,使用find命令,我可以传递标志-type以仅打印特定类型的文件。 例如,要仅打印当前目录中的目录,我运行: find . -maxdepth 1 -type d 以下是其他类型: -type c File is of type c: b block (buffered) special c character (unbuffered) special d directory p named pipe (FIFO) f
例如,要仅打印当前目录中的目录,我运行:
find . -maxdepth 1 -type d
以下是其他类型:
-type c
File is of type c:
b block (buffered) special
c character (unbuffered) special
d directory
p named pipe (FIFO)
f regular file
l symbolic link; this is never true if the -L option or the
-follow option is in effect, unless the symbolic link is
broken. If you want to search for symbolic links when -L
is in effect, use -xtype.
s socket
D door (Solaris)
问题在于,符号链接目录不被视为-type d目录,符号链接(-type l)的标志太宽,因为它还将包括非目录的符号链接文件。也许一个符号文件无论指向目录还是文件都被视为相同的,但是我如何确保只打印指向目录的文件呢?我不必使用find命令。尝试:
find-L-xtype L-type d
这是什么操作系统?Linux?@JoeDF-Linux(Ubuntu)可以吗<代码>查找-L-X类型L-d类型