cp
cp명령어는 copy의 의미입니다. 파일을 복사할대 사용합니다.
|
옵션
-p : 원본 파일의 소유권 등의 정보를 그대로 복사
-r : 서비 디렉토리 안의 모든 파일까지 전부 복사 |
|
[root@localhost test]# ls -al /home/leeahnlee/ 합계 48 drwx------ 3 leeahnlee leeahnlee 4096 5월 31 14:48 . drwxr-xr-x 6 root root 4096 5월 31 14:48 .. -rw-r--r-- 1 leeahnlee leeahnlee 33 5월 31 14:48 .bash_logout -rw-r--r-- 1 leeahnlee leeahnlee 176 5월 31 14:48 .bash_profile -rw-r--r-- 1 leeahnlee leeahnlee 124 5월 31 14:48 .bashrc drwxr-xr-x 4 leeahnlee leeahnlee 4096 5월 31 14:48 .mozilla [root@localhost test]# cp /home/leeahnlee/.bashrc /test/ [root@localhost test]# ls -al /test/ 합계 24 drwxr-xr-x 2 root root 4096 5월 31 16:00 . drwxr-xr-x 24 root root 4096 5월 31 15:21 .. -rw-r--r-- 1 root root 124 5월 31 16:00 .bashrc |
cp 명령어만으로 복사를 하면 소유권이 복사하는 계정으로 변경되는것을 볼수 있습니다.
그럼 -p 옵션으로 복사를 하고 상태를 확인해 보겠습니다.
|
[root@localhost test]# cp -p /home/leeahnlee/.bashrc /test/ [root@localhost test]# ls -al /test/ 합계 24 drwxr-xr-x 2 root root 4096 5월 31 16:01 . drwxr-xr-x 24 root root 4096 5월 31 15:21 .. -rw-r--r-- 1 leeahnlee leeahnlee 124 5월 31 14:48 .bashrc |
소유권이 기존에 있던걸 유지하고 있네요.