본문 바로가기
리눅스/기본 명령어 모음

mv 명령어 - move (rename) files

by 리재윤 2021. 1. 3.

명령어 설명

파일의 이름을 바꾸거나 위치를 옮긴다.

 


사용법 및 옵션

사용법

mv [옵션] source destination

 

*대상파일(디렉터리)이 존재하지 않을 경우 이름 바꾸기 기능이 된다.


옵션

mv 옵션 기능
-f --force 강제 실행

- destination이 파일일 때

source가 destination에 흡수된다.

 

- destination이 디렉터리일 때

파일(source)이 디렉터리(destination)로 들어갔다.
여러개의 파일(source)을 디렉터리(destination)에 넣을수도 있다.
파일과 디렉터리(source)를 디렉터리(destination)에 넣었다. 

 

- destination이 파일도 아니고 디렉터리도 아닐 때

file2(source)가  file1(destination)으로 이름이 바꼈다.
dir1(source)이 dir2(destination)로 이름이 바꼈다.


 

반응형

댓글