cp Linux Command Cheatsheet

cp stands for copy. This command is used to copy files or directories. cp command require at least two filenames in its arguments.


cp [OPTION] SourcePath DestinationPath


-aarchive files
-fforce copy by removing/overriding the destination file (if already present)
-iinteractive mode override (asks before overwrite)
-llinkes the files instead copy
-Lfollows symbolic links
-nno file overwrite, if destination file already exists
-Rrecursive copy (this includes hidden files)
-uupdate mode i.e copy only when source is newer than dest
-vverbose mode i.e prints more information


$ cp file1.txt file2.txt
$ ls
file1.txt	file2.txt

┬ęCopyright 2020 OneCompiler | Privacy Policy | Terms & Conditions