Find linux file compression

find 

According to the file name and inode lookup:
-name "file name": supports glob, *,, [], [^]?

According to owner, is a set of lookup:
-user USERNAME: Find owner for the specified user (UID) file
-group GRPNAME: Find is a group for the specified group (GID) file
-uid UserID: Find the owner of the specified UID number file
-gid GroupID: Find is a group for the specified file GID numbers
-nouser: Find the owner does not file
-nogroup: Find files do not belong to the group

the TYPE -type
• F: normal file
• d: catalog file
• l: symbolic link file
• s: socket file
• b: block device file
• c: character device file
• p: Pipe File
an empty file or directory -empty

A combination of conditions:
with: -a
or: -o
non-: -not!
De Morgan's law:
(non-A) or (non-B) = non (A and B)
(non-A) and (non-B) = non (A or B)

According to locate the file zoomed ⼩

-size [+ | -] # UNIT
common unit: k, M, G

The time stamps:
"day" as a unit,
-atime [+ | -] #,
#: [#, # +. 1)
+ #: [# +. 1, ∞]
- #: [0, #)
-mtime
- ctime
to "minutes" as a unit
-amin
-mmin
-cmin

According permission lookup:

-perm [/ | -] the MODE
the MODE: exact permissions match
/ MODE: any kind of permission (u, g, o) object as long as one can match, or relationship, + from centos7 start out of
-MODE: Each a class of objects must also have specified permissions, and 0 indicates no relationship concerns

-print: default processing operation, to display the screen
-ls: Performs like "ls -l" command to find files
-delete: delete the found files
-fls file: long format information is saved to find all files to the file specified in
-ok cOMMAND {} \; to find each file specified by a cOMMAND execution command, for each file before the execution command, the interactive will
require the user to confirm
-exec cOMMAND {} \; lookup to for each file designated by the command cOMMAND
{}: used to refer to the name of the file to find itself

Find all files in / var of Contents subordinate to the main root, and is a group of mail

 

Find / var of Contents under does not belong to root, lp, gdm all files

To delete all files ending in .log and Face No need for ⼯ find under / home / var / log to confirm the deletion of Contents

find /home/var/log -name "*.log" -exec rm {} \;

Find in / tmp of Contents, u, g, o Using whichever is user class (class ⾄ rare ⼀) has read or write access to the file;

Find / data of Contents under all empty of Contents, and moved to the / tmp down of Contents ?

find /data -type d -empty -exec mv {} /tmp \;

Find / tmp of Contents, the owner has permission to Perform while others have read access to files

find /tmp -perm 104 -ls

--------------------------------------------------------------

Compression, decompression and archiving tool

the compress / uncompress
compress [-dfvcVr] [-b maxbits] [File ...]
-d decompress, uncompress the equivalent
output -c result to standard output, do not delete the original file
-v show details
uncompress file.Z solution compression

the gzip [the OPTION] ... .. the FILE .
-d decompression, gunzip equivalent
output to standard output -c result, retaining the original document does not change
- # specify the compression ratio, the value of # 1-9, values greater compression greater than
gunzip file.gz decompression
view text files under the premise zcat file.gz not explicitly decompressed

bzip2 / bunzip2 / bzcat
bzip2 [OPTION] ... FILE ...
-k the Keep, the original file remains
-d decompress
- # 1-9, compression ratio, the default is 9
decompression bunzip2 file.bz2

xz/unxz/xzcat
xz [OPTION]... FILE ...
-k keep, 保留原文件
-d 解压缩
-# 压缩比,取值1-9,默认为6
unxz file.xz 解压缩

zip/unzip

打包压缩到/data/目录下

解压缩

tar工具

结合压缩工具实现:归档并压缩

-j: bzip2, -z: gzip, -J: xz

三种压缩效果也不一样

 

Guess you like

Origin www.cnblogs.com/fengxixiaoxiao/p/10962694.html