如何显示目录中的管道或 socked 文件?
echo "give name of directory: "
read directory
if [ -d "$directory" ]
then
echo "thanks again"
else exit
fi
find $directory -maxdepth 1 -type f
find $directory -mtime -$integer2 -ls
find $directory -ctime -$integer2 -ls
答案1
从find
手册页:
-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 s
用于套接字和-type p
管道(或 FIFO)
编辑:如果您想列出套接字或管道的文件,那么您需要在命令中指定“OR”。例如find . \( -type s -o -type p \)