when we just want to show the folder, it can often ....
first of all, there has to be such a environment.
The first way (using grep command to filter ):
command:ls-l|grep D
command:ls-lf|grep/$
The second way (using awk command to filter ):
command:Ls-l|awk '/d/{print $} '
command:Ls-l|awk/^d/
command:Ls-l|awk '/d/{print $NF} '
The Third Way (using sed command to filter ):
command: ls-l|sed-n '/d/p '
Fourth Way ( filter by using the Find command)
command : find/wuxb/day1/-type D
Find Common parameters:
-type Find a file of a certain type: for example:
B- block device files
D- Catalog
C- character device files
P- Piping file
| - Symbolic Link file
F- normal file
-name finding files by file name
The-exec find command executes the shell command given by the parameter to the matching file . The corresponding command is in the form of 'command{} \; ' Note The space between {} and / ;
File filtering for Linux commands magical