Command for Linux File Management MV mkdir CP RM

Source: Internet
Author: User

Create directory:

Mkdir directory

Mkdir [-M] [-p] Directory

-M: Specifies the attribute. You can also use the CHMOD command to modify the attribute later.

-P specifies the directory. By default, a new directory is created in the current directory.

RmDelete a file or directory (you can use a regular expression)

Usage: Rm [Option]... file...-F, -- Force Delete. Ignore nonexistent files and do not Prompt confirmation-I need to confirm before deleting-I requires confirmation before deleting more than three files or recursively deleting. This option is less content than-I prompts, but it can also prevent most errors from-R,-R, -- Recursive recursive deletion of directories and their content //-V is required to delete directories, -- verbose detailed display steps
 
For example:
Delete all files in the current directory, force Delete, no prompt
rm -f *.*
Delete the directory you just created
rm -rf code
 
 

MVMove a file or directory

For example, move the sibling directory of the parent directory to the current directory in the subdirectory:

MV ../instruction.

Music videos can also be used to rename files or directories.

MV gzip.txt tar.txt

CPCopy

CP-copy files and directories
Synopsis
CP [Option]... [-T] source dest
CP [Option]... source... directory
CP [Option]...-T directory source...
Description
Copy source to DEST, or multiple source (s) to directory.

Mandatory arguments to long options are mandatory for short options too.

-A, -- Archive
Same as-dr -- preserve = all

-- Backup [= control]
Make a backup of each existing destination file

-B like -- backup but does not accept an argument

-- Copy-Contents
Copy contents of special files when recursive

-D same as -- no-dereference -- preserve = links

-F, -- force
If an existing destination file cannot be opened, remove it and try again (redundant if the-n option is used)

-I, -- interactive
Prompt before overwrite (overrides a previous-N option)

-L, -- Link
Link files instead of copying

-L, -- Dereference
Always follow symbolic links in Source

-N, -- no-clobber
Do not overwrite an existing file (overrides a previous-I option)

-P, -- no-Dereference
Never follow symbolic links in Source

Frequently used:
-A: equivalent to-PDR
-I: Prompt
-F: Forced copy (replacement)
-R: recursive replication, applicable to directories

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.