-
How to copy file or directory in linux (cp)linux 2023. 2. 20. 16:41
In Linux, cp is a command-line utility used to copy files and directories from one location to another. Here is a table of common options for the cp command in Linux:
OptionDescription
-r Copy directories and their contents recursively -v Output the names of the files being copied -i Prompt for confirmation before overwriting existing files -u Copy only newer files or files that do not exist in the destination directory And here are some simple examples of how to use the cp command:
- To copy a file to a new location, use the following command:
cp /path/to/source /path/to/destination- To copy multiple files to a new location, specify the file names as arguments to the cp command:
cp file1.txt file2.txt file3.txt /path/to/destination- To copy a directory and its contents recursively to a new location, use the following command:
cp -r /path/to/source /path/to/destination- To output the names of the files being copied, use the following command:
cp -v /path/to/source /path/to/destination- To prompt for confirmation before overwriting existing files in the destination directory, use the following command:
cp -i /path/to/source /path/to/destination- To copy only newer files or files that do not exist in the destination directory, use the following command:
cp -u /path/to/source /path/to/destination'linux' 카테고리의 다른 글
How to create a file in linux (touch) (0) 2023.02.20 How to move file or directory in linux (mv) (0) 2023.02.20 How to delete file and directory in linux (rm) (0) 2023.02.20 How to change current directory in Linux (cd) (0) 2023.02.20 How to make directory, folder in Linux (mkdir) (0) 2023.02.20