Linux Directory and file management

Source: Internet
Author: User

Directory Management

1.mkdir Create empty directory

-P automatically creates a path directory when the path does not exist when creating the directory

-V Details to display the creation process

Create multiple /a/b/{c,d/e} curly braces at the same time expand

{A,b}_{c,d} = = A_c, A_d, B_d, B_c

2.Tree View file or directory number

3.rmdir Delete empty directory

-P

4.Touch Modify file timestamp

Created when the file does not exist

-C does not create any files

-A Change access time

-M Change modification time

-T specify time

Touch a B builds two files a and b

Touch ' a B ' Create a file of a b

Generally do not use a space for the file name made

5.stat view file information

6. Creating a file can also use a text editor

Nano

Ctrl+o Save

Ctrl+x Exit

7. RM Delete file

-I interaction

Administrator default -i command alias

\RM using the command itself, without using aliases

-F reject prompt

-R Delete Directories recursively delete all files under directory and directory

File Management

1. cp file copy

-R Recursive copy directory

-F forced override

-P Save the original group permissions and timestamp of the file (not specified who copied the file belongs to WHO)

-P Keep the link

-L Copy the file that the link points to

-A archive replication

2.mv moving files

3. Install copy file

4. file Content type View

To view text:

Cat, TAC, more, less, head, tail

5.Cat

-N Display line number

-e display line terminator

the line terminator for the Linux text file is $

the line terminator of the Window file is $ plus carriage return

6.theTAC Displays the text in turn

7.Ctrl + C termination signal

8,shift+page up turn graphic shift+page down graphic

9, more single screen query file

Ten, less like man . View text, forward and backward, find and more

One,head can see the first few lines ( no option default )

Tail can view the following lines ( no option default )

-F do not exit wait for display text up to date append content

Text Processing:

Cut, join, SED, awk,

Cut

-D Specify delimiter (default is a space)

- f Specifies the number of fields 1,3 1 and 3 fields 1-3 1 to 3 A field

Example:cut-d:-f1/etc/passwd

text sort: sort Simply sorts the display without affecting the contents of the source file

Sort by default by Ascoll code
-N Sort by numeric size

-R Reverse

-T field delimiter

-K to make the first few fields prevail

-U Remove Duplicates

-F ignores case

Example:sort-t:-k3-n/etc/passwd

uniq adjacent repeating rows

Remove duplicate rows By default

-D Show duplicate rows

-C shows the number of repetitions per line

text Statistics WC (word count)

Show sequential number of lines Word book bytes

-L Display number of rows

-W display number of words

-M display number of characters

-L the longest line contains the number of characters

+tr replacement and deletion

TR AB-AB

TR A-Z A-B lowercase are converted to size

-D Delete all characters in the character set

tr-d ' AB '

File name wildcard

*: Any number of characters

? : an arbitrary character

[]: Any single letter in the specified range

[^]: Specifies any single character other than this range

[: Space:]: white space character

[:p Unot:]: punctuation

[: Lower:]: lowercase letters

[: Upper:]: size Letter

[: Alpha:]: uppercase and lowercase letters

[:d igit:]: number

[: Alnum:]: numbers and uppercase and lowercase letters

Man 7 glob view all wildcard characters


This article is from the "Mr.zhu-Technology Exchange" blog, please be sure to keep this source http://bjishu.blog.51cto.com/7481301/1682956

Linux Directory and file management

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.