[[email protected] data]# Ls-l|grep ^a to filter out the file by the start of a
In the result of Ls–l, the directory begins with D-the normal file.
[Email protected] data]# cat/etc/ssh/sshd_config|grep–v ^ #排除以 # start
[[email protected] data]# Ls-fl|grep/$ filter out files in/end
Grep-ev "^#|^$"/etc/ssh/sshd_config filter out files ending in # or $
[[email protected] ~]# Find/-type D find the current directory ending in D
./
./jeacen
./A
./P
./data
[[email protected] ~]# find. -type d! -name "." Looking for a directory that does not contain.
./A
./P
./data
[[email protected] ~]# ls-l|sed-n/^d/p Output Directory
Drwxr-xr-x. 2 root root 4096 May 8 07:39 A
Drwxr-xr-x. 2 root root 4096 May 4 23:07 data
Drwxr-xr-x. 2 root root 4096 May 8 07:39 Jeacen
Drwxr-xr-x. 2 root root 4096 May 8 08:53 p
[[email protected] ~]# Ls-l|awk '/^d/' Search catalogue
Drwxr-xr-x. 2 root root 4096 May 8 07:39 A
Drwxr-xr-x. 2 root root 4096 May 4 23:07 data
Drwxr-xr-x. 2 root root 4096 May 8 07:39 Jeacen
Drwxr-xr-x. 2 root root 4096 May 8 08:53 p
[[email protected] ~]# Find/-type d-and-name "A" look for a file with a directory name called A.
! Represents the inverse,-a for and represents and,-o for or both sides of a set can be.
cd– to a previous level directory
Cd. is the current directory
[[email protected]/]# ll-lrt/etc View Directory Recent Changes
[[email protected] oldboy]# Find/-type f-name ". Log"-mtime +7 view current directory The name ends with. Log 7 days ago
[[email protected] oldboy]# Find/-type f-name ". Log"-mtime +7|xargs rm–f View current directory name ends with. Log 7 days ago and then delete
[[email protected] oldboy]# Find/-type f-name ". Log"-mtime +7–delete view current directory name ends with. Log 7 days before deleting
(6) Differentiated files and directories in Linux