Linux File Management command notes, linux File Management notes

Source: Internet
Author: User

Linux File Management command notes, linux File Management notes

More \ less: Paging command

More: view the file content in the form of pages. This command can be used as a pipeline command.

Keys used during page flip:

Space: Page flip down;

Press Enter: Open a line down;

B: turning back, only available, but invalid for pipeline commands.

Q: leave more now.

 

Less: it is easier to flip pages than more and can flip pages up. Can be used as pipeline commands.

The available keys, including the more command function, also include the following:

[Pageup] [pagedown]: One page is up and one page is down;

 

Head/tail: displays part of the article content.

Head [-n number] File: displays the content of the first few lines of files.

Tail [-n number] File: displays the content of the last few lines of files.

 

Tee: a multi-pass command that transfers standard output to a file and sends the same data to the screen for processing.

Example: ls-l/home | tee ~ /Homefile | more

 

Pr: indicates the output command in reorganization format. If the file name is omitted, it can be used as a pipeline command.

Command Format: pr <optional> [file name]

+ <Page number>: output from the specified page number. The default page number is 1;

-<Number of columns>: specify the number of columns for output. The default value is 1;

 

Wc: counts the number of lines of text, the number of words, and the total number of characters in a file (or standard input. Can be used as pipeline commands

Option:

-L: only list rows;

-W: only the number of words listed;

-M: The number of characters.

 

Find command:

Basic usage:

Find <Directory List> <search method> [<execute Operation>]

Directory List: directory tree to search. Multiple directories can be separated by spaces or use wildcards;

Retrieval Method:

-Name <File name>: the file name is available *? And other wildcards;

-Iname can be case insensitive;

-Type <type value>:

F: common file; d: Directory; l: Symbolic Link file; p: Pipeline file; c: character device file; B: block device file; s: Socket file;

-Perm [-] <gossip permission string>

If "-" is added before the "octal" permission, the system searches for files with permissions other than this.

(4) search by row based on the file size.

-Size <number> k

(5) search by the row of the object owner.

-User <owner Account Name>

(6) Search objects based on the time when the objects are accessed and disabled.

-Atime <number>

Searches for files that have been accessed before the specified number of days. And:

-Mtime <number>

Indicates that the files modified before the specified number of days are retrieved.

-Newer <File Name>

Indicates to retrieve all files updated at a time later than the specified file name.

 

The preceding <search method> can also be combined with two rows through logical operations to generate more complex search conditions.

These logical operations include:

And: that is, the. and. operation. No special operator expression is required. You only need to list all the retrieval methods, and use spaces to separate them.

Or:. or. Operation, represented by the operator-o. When the two search conditions are "quit", place "-o" between the two search conditions.

No:. not. Operation, Operator! .

Use "()" When combining some search conditions, but "()" has special meanings, therefore, use the Escape Character "\" to write it as "\ (" and "\)".

 

Common <execution actions> include:

-Print: displays the retrieved file name on the standard output (screen.

-Exec <command >\;: Execute <command>. If you want to use the retrieved file name in the command, replace it with the symbol, the system will pass the retrieved file name to the command where "{}" is found.

 

Grep: full-text search. It can be used to retrieve files that contain a specified character expression. A character expression can contain "*","? "And other wildcards to implement fuzzy query (also known as" Regular Expression ").

Grep <Regular Expression> <File Name List>

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.