Home
Back To Top
Home
Copy a file to another folder
cp filename /tmp
Copy a file content to another file
cp filename1
filename2
Copy folder to another location
along with files that it contains
cp -r foldername /tmp
cp -R foldername /tmp
Copy files in a folder to another folder
cp foldername/* /tmp
Copy files starting with a pattern
to a folder
cp PATTERN* /tmp
Copy files ending with a pattern to
a folder
cp *PATTERN /tmp
Copy files containing a pattern to a
folder
cp *PATTERN* /tmp
Copy files by preserving mode of
source file at destination
cp -p mode filename
/tmp
cp --preserve=mode
filename /tmp
Copy files by preserving ownership
of source file at destination
cp -p ownership
filename /tmp
cp --preserve=ownership
filename /tmp
Copy files by preserving timestamps
of source file at destination
cp -p timestamps
filename /tmp
cp --preserve=timestamps
filename /tmp
Copy files by preserving context of
source file at destination (Usefule only in terms of SElinux)
cp -p context
filename /tmp
cp --preserve=context
filename /tmp
Copy file to another folder by
forcing overwrite
cp -f filename /tmp
Copy file to another folder with a
prompt for files to be overwritten
cp -i filename /tmp
Copy a file to another location only
if file existing on destination is older than source or destination file is
missing
cp -u filename /tmp
Copy a file to another folder by
assigning a specific context
cp -Z CONTEXTNAME
filename /tmp
cp
--context=CONTEXTNAME filename /tmpBack To Top
Home
No comments:
Post a Comment