Linux file Management basic commands and wildcard basics

Source: Internet
Author: User
Tags glob

    1. first introduce to you the Linux system copy, cut, delete Three musketeers:

      (1)CP command is actually copy files and directories;

      Common options:

      -A, which means preserving the original data attributes;

      -R, which represents the recursive option, all directories and all files under the directory;

For example:

the as shown: -A Options

650) this.width=650; "title=" CP command option 1.1.JPG "src=" http://s3.51cto.com/wyfs02/M01/73/1D/ Wkiom1x1xlsievc4aane7dya7wo871.jpg "alt=" Wkiom1x1xlsievc4aane7dya7wo871.jpg "/>

we can see the /tmp/uo There are many files and directories below, so we use #cp –a uo./ou put the current directory under the UO directory is copied to the current ou directory, use the ls command to view it.

below are the following -A option, here is an example of a diagram ; as shown in 1.2

650) this.width=650; "title=" CP command option 1.2.JPG "src=" http://s3.51cto.com/wyfs02/M02/73/1D/wKiom1X1Xu_ Jpmysaahwhe7jtws596.jpg "alt=" Wkiom1x1xu_jpmysaahwhe7jtws596.jpg "/>

Here we use the Filter command to view the letters "S" start with a letter "E" end of the file as an example, and is a linked file, we can see that the file size is "+" , we use the " -A "option to copy the command, save his original property, and the blue part is not added ' -a ' option, his file size is " - ".

( 2 ) MV the order is actually Move (rename) files , and in the same directory this command is renamed;

MV command common options are: -T, copy source all to target and rename;

2.1 as shown:

650) this.width=650; "title=" MV command option 2.1.JPG "src=" http://s3.51cto.com/wyfs02/M00/73/1B/ Wkiol1x1yvczkqk1aafoinl95do361.jpg "alt=" Wkiol1x1yvczkqk1aafoinl95do361.jpg "/>

( 3 ) RM the order is actually Remove files or directories ,

Common Options - R: Recursive options

- F : Mandatory Options

3.1 as shown:

650) this.width=650; "title=" MV command option 3.1.JPG "src=" http://s3.51cto.com/wyfs02/M00/73/1D/ Wkiom1x1xz6b0urgaado982dg1a183.jpg "alt=" Wkiom1x1xz6b0urgaado982dg1a183.jpg "/>

( 4 ) Here we talk about linux [glob] knowledge, when we are in the /etc/

4.1 as shown:
Here we take / etc under, with the letter "S" start with the letter "E" the end of the file or directory, shown here is a link file,

650) this.width=650; "title=" Find filter command -1.1.jpg "src=" http://s3.51cto.com/wyfs02/M01/73/1B/ Wkiol1x1yzqasirxaacplhhekte215.jpg "alt=" Wkiol1x1yzqasirxaacplhhekte215.jpg "/>

Let me introduce you to some wildcard characters:

[[: Alpha:]]: Any uppercase and lowercase letters;   * : Any character that represents any length;

[[: Lower:]]: any lowercase letter; ? : represents any single character;

[[: Upper:]]: any uppercase letters;    []: the character of the specified range;

[[:d Igit:]]: any number;         [^] : A character that indicates a match;

[[: Alnum:]]: any number and letter

[[: Space:]]: White space characters

[[:p UNCT:]]: arbitrary Punctuation

Next we'll do an example:

View / etc directory, with the letter S,n,r start, middle, and at least one number, ending with . D end of file or directory

4.2 as shown: #ls-D/etc/[s,n,r]*[0-9]*[[:p unct:]]d

650) this.width=650; "title=" Find filter command -1.2.jpg "src=" http://s3.51cto.com/wyfs02/M01/73/1D/ Wkiom1x1x4qaycxbaacr1s7nawo293.jpg "alt=" Wkiom1x1x4qaycxbaacr1s7nawo293.jpg "/>

The above content is not very simple, please pay attention to this blog, every week will have new discoveries!!

later I will introduce the other three musketeers: grep , sed , awk


Linux file Management basic commands and wildcard basics

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.