(6) Differentiated files and directories in Linux

Source: Internet
Author: User
Tags ssh


[[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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.