aix vs linux 비교

cp 명령어

infra 2022. 3. 17. 22:05

https://www.ibm.com/docs/ko/aix/7.2?topic=c-cp-command 

소스와 타겟을 구분하여 명령어를 수행한다. 소스와 타겟이 같게된다면 리눅스에선 다음과 같이 뜨게 된다.

예시)

[root@local-client leesh]# touch infraleesh_220504_2000.nmon
[root@local-client leesh]# touch infraleesh_220504_2100.nmon
[root@local-client leesh]# touch infraleesh_220504_2200.nmon
[root@local-client leesh]# touch infraleesh_220504_2300.nmon

[root@local-client leesh]# ls
a  Desktop  
infraleesh_220504_2000.nmon  infraleesh_220504_2100.nmon  
infraleesh_220504_2200.nmon  infraleesh_220504_2300.nmon

[root@local-client leesh]# cp ./infraleesh_220504_2*.nmon ~leesh
cp: ‘./infraleesh_220504_2000.nmon’ and ‘/home/leesh/infraleesh_220504_2000.nmon’ are the same file
cp: ‘./infraleesh_220504_2100.nmon’ and ‘/home/leesh/infraleesh_220504_2100.nmon’ are the same file
cp: ‘./infraleesh_220504_2200.nmon’ and ‘/home/leesh/infraleesh_220504_2200.nmon’ are the same file
cp: ‘./infraleesh_220504_2300.nmon’ and ‘/home/leesh/infraleesh_220504_2300.nmon’ are the same file

[root@local-client leesh]# ls
a  Desktop  infraleesh_220504_2000.nmon  infraleesh_220504_2100.nmon  infraleesh_220504_2200.nmon  infraleesh_220504_2300.nmon

[root@local-client leesh]# cp ./infraleesh_220504_2*.nmon ~test2

[root@local-client leesh]# ls -al ~test2
total 32
drwx------   7 test2 test2 4096 May  7 20:31 .
drwxr-xr-x.  5 root  root    45 Nov  5  2021 ..
-rw-r--r--   1 root  root     0 May  7 20:17 a
-rw-------   1 test2 test2  596 Nov 12 08:20 .bash_history
-rw-r--r--   1 test2 test2   18 Aug  3  2017 .bash_logout
-rw-r--r--   1 test2 test2  193 Aug  3  2017 .bash_profile
-rw-r--r--   1 test2 test2  231 Aug  3  2017 .bashrc
drwx------   8 test2 test2  167 Nov 11 22:48 .cache
drwx------  10 test2 test2  126 Nov 11 22:48 .config
drwx------   3 test2 test2   25 Nov 11 22:48 .dbus
drwxr-xr-x   2 test2 test2    6 Nov 11 22:48 Desktop
-rw-------   1 test2 test2   16 Nov 11 22:48 .esd_auth
-rw-------   1 test2 test2  314 Nov 11 22:48 .ICEauthority
-rw-r--r--   1 root  root     0 May  7 20:31 infraleesh_220504_2000.nmon
-rw-r--r--   1 root  root     0 May  7 20:31 infraleesh_220504_2100.nmon
-rw-r--r--   1 root  root     0 May  7 20:31 infraleesh_220504_2200.nmon
-rw-r--r--   1 root  root     0 May  7 20:31 infraleesh_220504_2300.nmon
drwx------   3 test2 test2   19 Nov 11 22:48 .local
-rw-------   1 test2 test2  670 Nov 12 02:45 .viminfo

[root@local-client leesh]# ls -al ../test2/infraleesh_220504_2*.nmon
-rw-r--r-- 1 root root 0 May  7 20:31 ../test2/infraleesh_220504_2000.nmon
-rw-r--r-- 1 root root 0 May  7 20:31 ../test2/infraleesh_220504_2100.nmon
-rw-r--r-- 1 root root 0 May  7 20:31 ../test2/infraleesh_220504_2200.nmon
-rw-r--r-- 1 root root 0 May  7 20:31 ../test2/infraleesh_220504_2300.nmon

 

 

 

cp: ‘./infraleesh_220504_2000.nmon’ and ‘/home/leesh/infraleesh_220504_2000.nmon’ are the same file

 

 

[1] AIX

 

cp -Rph ./소스/. /타겟

현재 경로에 있는 소스( 파일 또는 디렉터리)를 타겟(대상)으로 복사하는 명령어

 

R : 파일 계층을 이동하는 중 발견된 기호 링크 또는 SourceFile 피연산자로 지정된 기호 링크에서 조치를 수행합니다. 
->하위에 있는 파일 또는 디렉터리를 복사함

p: 파일 권한을 복사함

h: 심볼릭 링크파일을 복사

 

 

 

 

[2] linux

 

option 설명  
-a 복사되면서 파일의 속성값까지 복사된다  
-p permanent
ls -al로 소유권 등등 파악이 가능한데,
원본 파일의 소유자,그룹,권한등의 정보까지 복사된다.
scp 명령어에도 p 옵션이 동일하다
-i 덮어 쓰기 전에 덮어 쓸건지 아닌지를 물어본다.  
-r 또는 -R recursive 로서 재귀를 의미하는데,
하위 디렉터리 또는 파일까지를 복사하겠다는 의미
 
-v 현재 cp 명령어의 복사 진행 상태를 verdose 하게 자세히 나타내줌  
-u 최신 파일일 때 복사한다.  
-b 이미 존재하는 파일일 때 백업파일을 생성한다.  

 

 

'aix vs linux 비교' 카테고리의 다른 글

passwd 변경 관련[AIX vs Linux]  (0) 2022.03.31
init 관련 rc.local (linux vs aix)  (0) 2021.12.29
/etc/ssh/sshd_config  (0) 2021.03.04