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

The method of copying and renaming Files by linux

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

Share

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

Editor to share with you how to copy files and rename them in linux. I hope you will get something after reading this article. Let's discuss it together.

In linux, you can use the cp option source or directory destination file or directory command to copy and rename files. The cp directive is used to copy files or directories, as if you specify more than two files or directories, and the final destination is an existing directory, it will copy all previously specified files or directories to this directory.

The operating environment of this tutorial: centos7 system, thinkpad T480 computer.

File / directory replication

Cp [options] Source file or directory destination file or directory

This command can change the name while copying.

Eg

Cp abc.log def.log / / abc.log and def.log are both files cp-r test.quancheng/ quancheng/ / plus-r parameters, directory replication

Parameter description:

-a: it means archive, and it also means copying all the directories.

-d: if the source file is a connection file (link file), copy the properties of the connection file instead of the file itself

-f: force (force), if there is repetition or other questions, the user will not be asked, but will be forced to copy

-I: if the target file (destination) already exists, it will first ask whether the operation is true when overwriting.

-l: establish a hard connection file (hard link) instead of copying the file itself

-p: copied with the properties of the file instead of using the default properties

-r: recursive replication for directory replication operations

-s: copy into a symbolic link file (symbolic link), that is, a "shortcut" file

-u: if the target file is older than the source file, update the target file

What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

After reading this article, I believe you have a certain understanding of "linux method for copying and renaming files". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for your reading!

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