[Linux command] cp command option list [Must-see for beginners]

[Linux command] cp command option list [Must-see for beginners]

Summary Linux command list

What is the cp command?

Linux commands used to copy files and directories. "cp" is an abbreviation for "copy".

How to use commands

$cp copy source copy destination

#Copy in the same directory
$ cp test.txt test2.txt

#Another directory(test directory)Copy to
$ cp test.txt /home/hoge/test2/test2.txt

#Another directory(test directory)Copy with the same name
$cp Copy source Copy destination directory name
$ cp test.txt test2

#Copy multiple files
$cp Copy source part 1 Copy source part 2 Copy destination directory name
$ cp test.txt test2.txt test3

List of options for the cp command

option Description
-a Preserve and copy the attributes of the original file and the directory structure.
-b Make a backup of the overwritten file
-d Copy the entity when copying a symbolic link
-f Overwrite without warning when there is a file with the same name in the copy destination.
-i Confirmation is given when there is a file to be overwritten.
-l Create a hard link
-P Copy the entire directory structure
-p Keep original file owner, group, permission, timestamp
-r If you specify a directory as the copy source, copy recursively (including subdirectories)
-s Create a symbolic link instead of a copy
-u If the save destination is a file with the same file name, check the time stamp, and if it is new or the same, do not copy.
-v Display execution contents

-r option

/home/hoge


#Copy the entire directory
$ cp -r Copy source directory Copy destination directory

#Copy the test directory under the test2 directory
$ cp -r test /home/hoge/test2

-s option

#Create a symbolic link
$ cp -s Original file symbolic link

#test.Create txt symbolic link
$ cp -s test.txt test_symbolic.txt

List of options for other Linux commands

pwd, mkdir, cd , cat, cp, ls, touch, less, mv, rm, ssh, man, ** Adding at any time **

Advertising space

We undertake various development and construction contracts and mentor work for beginners. If you are interested, please go to ** here **

Recommended Posts

[Linux command] cp command option list [Must-see for beginners]
[Linux command] ls command option list [Must-see for beginners]
[Linux command] touch command option list [Must-see for beginners]
[Linux command] less command option list [Must-see for beginners]
[Linux command] cat command option list [Must-see for beginners]
[Linux command] pwd command option list [Must-see for beginners]
[Linux command] rm command option list [Must-see for beginners]
[Linux command] cd command option list [Must-see for beginners]
[Linux command] mv command option list [Must-see for beginners]
[Linux command] man command option list [Must-see for beginners]
[Linux command] ssh command option list [Must-see for beginners]
[Linux command] mkdir command option list [Must-see for beginners]
[Linux command summary] Command list [Must-see for beginners]
Linux command memorandum [for beginners]
[Must-see for beginners] Basics of Linux
Linux command list
Linux operation for beginners Basic command summary
Linux command for self-collection
What is Linux? [Command list]
Linux distribution recommended for beginners
Linux Command Dictionary (for myself)
Python #list for super beginners
Convenient Linux shortcuts (for beginners)
Frequently used Linux commands (for beginners)
Linux command # 4
Linux command # 3
Linux command # 5
How to create a shortcut command for LINUX
linux at command
[Linux] Search command
Roadmap for beginners
Linux command <Basic 2>
Linux [directory command]
Linux server command
Linux # Command Memo 1
Linux command [read]
Linux Command Summary
[Basic] linux command
Linux [shell command]
[Linux] Command / Knowledge
pyenv for linux
My linux command
Linux command <Basic 1>
Linux command collection
Linux mkdir command
Linux command basics
[Linux] Git command
Linux (command memory)
[Linux] A list of Linux commands that beginners should know
[For beginners] How to use say command in python!
[Linux] Basics of authority setting by chmod for beginners