Linux File (folder) creation, copying, moving (rename), deleting command tutorial, linux rename

Source: Internet
Author: User

Linux File (folder) creation, copying, moving (rename), deleting command tutorial, linux rename

Ubuntu

Ctrl + Alt + T (Terminal)

1. Create (mkdir)

Syntax format: mkdir [Option] DirName

The [Options] in the Command generally have the following two types:

-M is used to set the access permission for the new directory. You can also use the chmod command to set the access permission.

-P is required to create upper-level folders (or directories), even if these folders (or directories) already exist, it is not considered as an error.

Create demo1 where everyone has the permission to read, write, and execute:

Ii. Copy (cp)

Syntax format: cp [Option] source file or directory target file or directory

Note: This Command copies the specified source file to the target file or multiple source files to the target directory.

The [Options] in the Command generally include:

-R,-r, -- recursive Recursively copies all contents in the directory and Its subdirectories.

-F, -- force: delete an existing target file without prompting.

-I, -- interactive, and f options are opposite. A prompt asking the user to confirm is given before overwriting the target file. When the answer is y, the target file will be overwritten, which is an interactive copy.

Create a new a.txt file:

Copy a.txt to the demo1 file:

Iii. Mobile (rename) mv

Syntax format: mv [Option] source file or directory target file or directory

The [Options] in the Command generally include:

-F, -- do not ask before force overwrite (default)

-I, -- ask before interactive Overwrite

Rename: the target file name is different from the source file name, which can be renamed.

Move a.txt in the demo folder to the demo1 file (overwrite)

Iv. Delete (rm)

Syntax format: rm [Option] file...

The [Options] in the Command generally include:

-F, -- force Delete ignore non-existing files and never give a prompt.

-R,-r, -- recursive recursively deletes all directories and subdirectories listed in the parameter.

-I, -- ask before interactive deletion.

Delete a.txt in the demo1 Folder:

Note: Be careful when using rm-rf. There is no recycle bin in linux.

Related Article

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.