Q:

copy command in linux

# Linux - Bash

# syntax:
# cp [option(s)] <source-filepath> <destination-filepath>

# example-1 (fundamental - no options):
cp "C:\Windows\System32\drivers\etc\hosts.txt" "C:\Users\hosts.txt"

# example-2 (fundamental - with options):
cp -nR "C:\Windows\System32\drivers\etc" "C:\Users"

# + ------ + ------------------------------------------------------- +
# | OPTION |  DESCRIPTION                                            |
# + ------ + ------------------------------------------------------- +
# |   -a   | archive files                                           |
# |   -f   | force copy by removing the destination file if needed   |
# |   -i   | interactive - ask before overwrite                      |
# |   -l   | link files instead of copy                              |
# |   -L   | follow symbolic links                                   |
# |   -n   | no file overwrite                                       |
# |   -R   | recursive copy (including hidden files)                 |
# + ------ + ------------------------------------------------------- +
9
cp text.txt Documentos/
#copy arquivo text.txt to directory Document/
3
move command : mv filename dirname
remove command : rm -r filename
copy command : cp filename dirname
zip command : zip -r filename.zip foldername
unzip command : unzip filename.zip -d dirname
2
cp [OPTION] Source Destination
cp [OPTION] Source Directory
cp [OPTION] Source-1 Source-2 Source-3 Source-n Directory

First and second syntax is used to copy Source file to Destination file or Directory.
Third syntax is used to copy multiple Sources(files) to Directory.
0

New to Communities?

Join the community