Linux 如何使用终端复制文件夹中的特定文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18831259/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 00:51:34  来源:igfitidea点击:

How to copy a specific file in a folder using terminal

linuxcommand

提问by Hyman

I am using terminal on linux. I am in my current folder now. I want to take a file in this folder that I am currently in and copy it in the exact same folder and I also want to rename it.

我在 linux 上使用终端。我现在在我当前的文件夹中。我想在我当前所在的文件夹中取出一个文件并将其复制到完全相同的文件夹中,我还想重命名它。

What command should I use?

我应该使用什么命令?

采纳答案by SriniV

Copy command works well.

复制命令运行良好。

cp /currentfolder/filename /currentfolder/newfilename

回答by Ali Farshidi

If you wanna copy a file like .cpp file it is really easy to use:

如果你想复制一个像 .cpp 文件这样的文件,它真的很容易使用:

cp filename.cpp destination