Common Linux commands.

Source: Internet
Author: User

You can use the MV command to rename a file or directory or move the file from one directory to another. This command is like a combination of Ren and move in msdos.

Syntax: MV [Option] source file or directory target file or directory<--- Move a file

Note: depending on the type of the second parameter in the MV command (whether it is the target file or the target directory), the MV command renames the file or moves it to a new directory. When the second parameter type is file, the MV command renames the file. At this time, only one source file (or the source directory name) can be used ), it renames the given source file or directory to the given target file name. When the second parameter is an existing directory name, there may be multiple source files or directory parameters. The MV command moves the source files specified by each parameter to the target directory. When a file is moved across file systems, the MV copies the file first, and then deletes the original file. The link to the file will also be lost.

The meaning of each option in the command is:

-I interactive operation. If the MV operation will overwrite the existing target file, the system will ask whether to rewrite the file and ask the user to Answer Y or N. This will avoid overwrite the file by mistake.

-F prohibit interactive operations. When an MV operation overwrites an existing target file, no instructions are given. If this option is specified, the I option will no longer work.

If the target file (not a directory) already exists, the content of the file will be overwritten by the new file. To prevent the user from using the MV command to destroy another file, it is best to use the I option when using the MV command to move the file.

 

Rm command <--- delete an object

You can use the RM command to delete unnecessary files. This command is used to delete one or more files or directories in a directory. It can also delete a directory and all its files and subdirectories. For linked files, the link is closed, and the original file remains unchanged.

The common format of the RM command is:

Rm [Option] file...

If the-r option is not used, RM will not delete the directory.

The options of this command are as follows:

-F ignores non-existing files and never gives a prompt.

-R indicates that Rm recursively deletes all directories and subdirectories listed in the parameter.

-I.

Copy: CP directory

View disk: DF-H

Create directory: mkdir directory name

View process: PS-ef

Killall httpd

VI usage:
Edit file:
Exit EDIT: ESC button
Save and write:
Exit without writing: Q!

View the directory size
Du-SH dirname
-S only displays the total
-H is measured in K, M, and g to improve information readability. KB, MB, and GB are measured in 1024 units and-H is measured in 1000 units.

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.