Linux in respect of such a school - packed novice must master the command of compression and search command group

tar command

Purpose: to pack or unpack files

Format: tar [options] [file]

Table parameters and the role of the tar command

parameter

effect

-c

Create a compressed file

-x

Extract the file

-t

What view files in the archive

-with

Gzip compression or decompression with

-j

Compression or decompression with bzip2

-v

Displaying the compression or decompression process

-f

The destination file name

-p

Preserve the original permissions and attributes

-P

Use an absolute path to compress

-C

Specify the directory to unzip

Example:

Create a compressed file

 

Unzip the file

 

grep command

Uses: for text perform a keyword search, and displays the matching result

Format: grep [options] [file]

parameter

effect

-b

The executable (binary) as a text file (text) search

-c

Display only the number of lines found

-i

Ignore case

-n

Show Line Numbers

-v

Invert Selection ---- not only lists the line "key words" in

Example:

 

 

find command

Uses: used in accordance with the specified criteria to find files

Format: find [Search Path] Looking operating conditions

Table parameters and the role of the find command

parameter

effect

-name

Matching name

-perm

Matching permissions (mode can be included as an exact match -mode)

-user

Matching owner

-group

All group matches

-mtime -n +n

Time matching the content of (-n to + n is within n days ago n)

-atime -n +n

Matching file access time (-n to + n is within n days ago n)

-ctime -n +n

Matching time modify the file (-n to + n is within n days ago n)

-nouser

No matching file owner

-nogroup

No matching files for all groups

-newer f1 !f2

But new match than f1 f2 than the old files

--type b/d/c/p/l/f

Match the size of the file (parameter letters behind the order represented as a block device, directory, character device, pipe, link files, text files)

-size

Match the size of the file (+ 50KB 50KB to look over the documents, and to find the file is less than 50KB -50KB a)

-prune

Ignore a directory

-exec ...... {}\

Command can be followed by further treatment with search results for

Example:

1. Get all the host at the beginning of the / etc directory list of files

 

2. Search the file permissions include all SUID privileges, you can just use -4000

 

3.在整个系统中找出所有归属于Linuxprobe用户的文件并复制到/root/findresult目录下

 

Guess you like

Origin www.cnblogs.com/studyandstudy/p/12041587.html