Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

About find and tar

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Find

-type (f d c b s)-find data by file type

-name-find data based on file name

-size (b c w k M G)-find data based on file size

Iname-find data by file name (ignore case)

-d (delete)-Delete found data

-exec-the data found by search will be processed

-a-the relationship between multiple search conditions is and

-o-the relationship between multiple search conditions that are or

-noth or!-find the condition to reverse

-maxdepth-find the maximum depth of the file directory

-mindepth-find the minimum depth of the file directory

-mmin-find the file directory by minute

-mtime-find the file directory by day

-perm to find file directories by permission

-path limit range

Example:

Adding I before name indicates ignoring case.

Find / oldboy-name has dog lookups in the "dog" file

How to exclude two or more directory lookups

Find. -path. / oldboy01-o-path. / oldboy02-a-prune-o-name "oldboy*"-print

Find a specified file but exclude a directory

Find /-path / S1-prune-o-name ".txt"

Find /-path / S1-prune-o-name ".txt"-print

Find it and delete it.

Find / S1-name ".jpg"-delete

Find / S1-name ".txt"-exec rm-rf {}\

Rm-f find / S1-type f-name "oldboy*"

Copy

Cp find / S2-type f-name "* .txt" / S1

Find / S2-name ".txt"-exec cp {} / S1\

Find / S2-name ".jpg" | xargs cp-t / S1

Find / S2-name ".jpg" | xargs-I cp {} / S1

Tar compression

Tar zcvf / s/ss.tar.gz / s/s1 / s/s2 / s/s3

Z compressed data mode gzip

C create a compressed package

V the process of compressing data in reality

F specify compressed file path information and compressed file name information (f can only be placed at the bottom in centos6)

Tar zcvhf generates compressed package path / compressed package. Tar.gz needs to compress the link file

-h specifies the source file specified by the compressed link file

Tar decompression

Tar xf archive file

X extract) extract the data in the compressed package (decompress)

Tar xf + compressed package

Tar xf + package-C specified directory

View compressed package

-tf + compressed package t view file to display data information in compressed package

-exce excludes specified file data from being compressed

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report