LINUX common Commands (ii)

Source: Internet
Author: User
Tags alphabetic character time and date

3. find files by name

Absolute path: The fully qualified name, which defines each subdirectory that arrives and uniquely represents a single file, and the first character is the absolute path.

Relative path: The same as the absolute path is a relative path that also identifies a unique file, that is, the path that is required to make the current directory to work, except for the path name of the other character that the first character is / is relative to the path .

PWD Displays the full path name of the current path.

Ls Lists the directory contents of the specified directory.

Ls-l shows the long list format.

Ls-a Show all files including hidden files (hidden files are not for security purposes, but to prevent the necessary user profiles to make the main directory seven or eight bad, good can prevent the inconvenience caused by false modification, etc.).

Ls-r Displays the contents of all subdirectories in a recursive way.

Cd back to the home directory.

Cd.. returns to the current parent directory.

Cd..   /.. moves up two levels from the current position.

Cd- go back to the previous directory.

Touch can change the timestamp of a file to the current time and date without making any other changes, and you can create a file with Touch xx when there is no file .

4. managing files using a command-line file

Mkdir Creating a directory or subdirectory

Mkdir-p Creating a missing parent directory

Cp copies a file or multiple files and becomes a new standalone file.

Cp-r Copying a non-empty directory with content requires the- r recursive option.

Cp AA bb aa duplicate name is BB

Cp AA1 AA2 Aa3 SS will aa1,aa2,aa3, copy into SS , theSS must be a directory.

The Mv command renames the file in the same directory, or the file is re-placed in a new directory, which is equivalent to clipping.

Mv Aa1 Aa2 if the aa2 file is renamed, if the aa2 is the directory is cut.

the Rm default syntax deletes files instead of directories.

Rm-r Delete the directory and there may be many subdirectories and files under it.

Rm-i recursively deletes directories and directories and files that may exist under it.

Rm-f Force Delete

Rmdir only empty directories are deleted.

5. Use the pathname extension to match the file name.

Pattern matching: Wildcard is a shlle Command parsing operation that extends a wildcard pattern to a set of matching pathname. The command line source character is replaced by the matching list before the command is executed. A pattern that does not return a match, displaying the original schema request as literal text.

* any string consisting of a collar or more conceit.

? Any one character.

~ The home directory of the current user.

~username username The user's home directory.

~+ Current Working directory

~- Top Level working directory

[ABC ...] enclose any one of the characters in a class

[!abc ...] Do not enclose any one of the characters in the class

[^abc ...] Ibid .

[[: Alpha:]] ... any alphabetic character

[[: Lower:]] ... any lowercase alphabetic character

[[: Upper:]] ... any uppercase characters

[[: Alnum:]] .... any alphabetic character or number

[[:d Igit:]] ..... any number

[[: Space:]] ... any whitespace character

Can be used with ls echo , etc.

For example:

Ls A * lists All files or directories starting with a

Ls ???? List all files or directories of four characters

Ls [! B]* ..... list is not in B the beginning of a file or directory

LINUX common Commands (ii)

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.