Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the common CentOS commands for copying files and folders

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "copy files and folders what are the common CentOS commands", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "copy files and folders which CentOS commands commonly used" it!

Common CentOS commands for copying files and folders

Cp

NO1. Copy the files from the specified directory to the current directory and rename

[root@rehat root] # cp ~ / .bashrc bashrc_bak

NO2. Forces a file from the specified directory to be copied to the current directory, regardless of whether the current directory contains the file or not

[root@rehat root] # cp-f ~ / .bashrc bashrc

NO2. Copy the specified directory to the current directory

[root@rehat root] # cp-r / root/test.

[root@rehat root] # cp-r / root/test/.

The effect is the same: when you copy a directory, all the directories at the last level of the source path are copied, including itself.

NO3. Copy the files from the specified directory to the specified directory

[root@rehat root] # cp ~ / .bashrc / bak/.bashrc

If prompted:

Cp: omitting directory

Then use:

[root@rehat root] # cp-r ~ / .bashrc / bak/.bashrc

If prompted:

Cp:overwrite

The slash is added:

[root@rehat root] # / cp-r-f ~ / .bashrc / bak/.bashrc

NO4. All the attributes of the source file are also copied when copying. If you do not specify parameters, the properties of the destination file and the source file may be inconsistent.

[root@rehat root] # cp-a ~ / .bashrc / bak/.bashrc

NO5. If two folders are to be synchronized, one file is changed and the other is changed, but make sure that the files of both files are up-to-date.

[root@rehat root] # cp-u / src/.bashrc / bak_src/bashrc

Thank you for your reading, the above is the "copy files and folders what are the common CentOS commands" of the content, after the study of this article, I believe that you copy files and folders CentOS commands what common commands have a deeper understanding of this problem, the specific use of the situation also need to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report