How to manipulate files and directories under Linux

Source: Internet
Author: User
Tags character classes character set mkdir linux

CP-Copy (copy) files and directories;

MV-Mobile (move)/rename files and directories;

mkdir-Create a folder (make directories);

RM-Delete (remove) files and directories;

wildcard character (wildcards):

*: Match any character;

?: Match any single character;

[characters]: matches any character that belongs to a character set, such as [ABC]

[!characters]: matches any character that is not part of the character set, such as [!BCD]

[[: Class:]]: matches any character that belongs to a particular class, such as [[: Alpha:]], any letter;

Common character classes:

[: Alnum:]: A character of any alphanumeric (alphanumeric), all number;

[: Alpha:]: A character of any letter (alphabetic);

[:d Igit:]: any number;

[: Lower:]: arbitrary lowercase letters;

[: Upper:]: arbitrary capital letters;

Note: Use character classes as much as possible instead of [A-z], [a-z];

mkdir-Create a directory:

mkdir directory ... Parameters can be duplicated, creating multiple folders;

CP-Copy files and directories:

CP item1 item2, copy single

CP Item ... directory, copy multiple

Parameters:

-A,--archive, copy the attributes of the file \ Directory (owner and permissions);

-I,--interactive, overwrite an already existing file, will prompt the user, otherwise is silent (silently);

-R,--recursive, replication folders and contents of iterations, Replication folder (-a), need this parameter;

-U,--update, copy only nonexistent files or directories, update (update);

-V,--verbose, hints useful (informative) information;

MV-Copy and rename files

MV Item1 item2, copy or rename the file;

MV Item ... directory, move to folder;

Parameters:-I; -U; -V;

RM-Delete files and directories

RM Item ...

Parameters:-I, R, V;

--force: Ignore nonexistent files, no prompts, will overwrite-I (hint);

Note: RM and wildcard use, you need to check the input, try to use LS check delete files, and then replace RM Delete;

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/

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.