리눅스에서 vi 명령어를 통해 파일을 편집하다가 비정상적으로 종료할 경우가 종종 발생합니다.
그럴 경우 아래와 같은 에러 메시지가 발생할 때가 있습니다.
E325: ATTENTION
Found a swap file by the name ".파일명.swp"
owned by: 소유자명 dated: Mon Dec 18 10:10:32 2023
file name: /project경로/docker-compose.yaml
modified: no
user name: 사용자명 host name: 서버호스트명
process ID: 176764 (still running)
While opening file "파일명"
dated: Mon Dec 18 10:14:21 2023
NEWER than swap file!
(1) Another program may be editing the same file. If this is the case,
be careful not to end up with two different instances of the same
file when making changes. Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r 파일명.yaml"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file ".파일명.swp"
to avoid this message.
Swap file ".파일명.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (Q)uit, (A)bort:
1. swp 파일 확인
기본적으로 swp파일은 ll 명령어로 보이지 않는 숨겨진 파일이기 때문에
-all 옵션을 통해 모든 파일목록 전체를 확인해야 합니다.
ll -all
2. swp 파일 삭제
파일 삭제를 위해 rm명령어로 직접 swp파일을 삭제합니다.
rm -rf 파일명.swp
그 후 다시 vi 로 해당 파일을 열어보면 메시지 없이 정상적으로 편집이 가능합니다.
'Linux' 카테고리의 다른 글
Linux "vi: command not found" 에러 해결 방법 (0) | 2024.01.12 |
---|