How to Copy Files and Folders on Linux (Command Line)

How to Copy Files and Folders on Linux (Command Line)

Kung sa DOS/Windows ay “copy”, sa Linux ay “cp”

‘cp’ command is one of the basic and most widely used Linux commands for copying files and directories from one location to another.

When copying files from source to destination, the source file remains the same and the target file may have the same or different name.

Syntax:

cp [Option] [Source] [Destination]

Command Options:

OptionsDescription
-vVerbose mode (para kita mo ano nangyayari)
-r/Rcopy recursively (lahat kasama directory or folders)
-nDon’t overwrite
-dCopy a link file
-iMag warning muna bago mag overwrite
-pPreserve the specified attribute
-bMake a backup of each existing destination file

Example:

cp /home/username/listahan_ng_utang.txt /home/username2 

kung gusto iba filename pag copy

cp /home/username/listahan_ng_utang.txt /home/username2/bayad_na.txt 

Pag maramihan pwede ka rin gumamit ng asterisk (*)

cp /home/username/*.* /home/username2/ 
No Comments

Post A Comment