linux命令行只显示文件或者文件夹

在linux/unix下面显示当前的目录目录下面的所有的文件和文件夹,ls就可以。 但是如果想只显示文件或者只显示文件夹ls就无能为例了,find可以做到。   只显示文件 find . -type f -maxdepth 1 =================================================================== 这里说一点,如果按照上面的命令就会显示一条警告,虽然它这条命令能够达到预期的效果, find: warning: you have specified the -maxdepth option after a non-option argument -type, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it).  Please specify options before other arguments. 这条warning的大概的意思是 -maxdepth这个选项被放在了-type这个非选择选项后面,正确的做法就是将选项放在-type前面,因此正确的因该是: find . -maxdepth 1 … Continue reading linux命令行只显示文件或者文件夹