cp -p /home/user/peter/archive.txt /home/user/backup/įrom the BSD man page: -p Cause cp to preserve the following attributes of each source file in the copy: modification time, access time, file flags, file mode, ACL, user ID, and group ID, as allowed by permissions. Actually is just an exact copy of the contents of the file, because the attributes are changed, if you want them unchanged you have to use -p option. This command will keep archive.txt unchanged in /home/user/peter/ folder and create an exact copy in /home/user/backup/ folder. Let’s say you want to copy archive.txt from /home/user/peter/ to /home/user/backup/ cp /home/user/peter/archive.txt /home/user/backup/ How to copy a file from on place to another, one folder to another. How to use cp to copy files Syntax cp Ĭp This command will copy the file from one site to another on the same computer, or at least to file systems attached to that computer it could of course be a network file system so it is technically not the same computer. The answer to the questions above is solved with the cp command, cp stands for copy and it is the command you have to use to copy files from one location to another if you are using Unix, Linux or BSD like FreeBSD or Mac OS X operating systems. Spanish How to copy files on Linux or BSD systems from one location to another on the same computer? How to copy files and directories (folders) on Linux and BSD systems? Copy Files on Linux and BSD (cp command with examples)
0 Comments
Leave a Reply. |