우분투 "파일을 열 권한이 없습니다." 해결

Apic·2025년 3월 27일
0

우분투/wsl

목록 보기
6/8

텍스트 파일을 열었는데 이런 창이 떴다.

터미널에서 열 때는 잘 열리는데 gui로 열때만 문제가 생겼다.

먼저 인코딩 방식을 확인한다.

file -i [파일 명]

그러면 이런식으로 뜬다.

1.txt:text/plain; charset=utf-16le
2.txt:text/plain; charset=utf-8
3.txt:text/plain; charset=utf-16le
4.txt:text/plain; charset=utf-8
5.txt:text/plain; charset=utf-8
6.txt:text/plain; charset=utf-16le
7.txt:text/plain; charset=unknown-8bit

그 다음 utf-8 인코딩으로 변환한다.

iconv -f [기존 코딩] -t [바꿀 인코딩] [파일명] > [파일명].utf8 && mv [파일명].utf8 [파일명]
iconv -f utf-16le -t utf-8 1.txt > 1.utf8 && mv 1.utf8 1.txt

그러고 나서 다시 file -i [파일 명]으로 다시 확인해 보면 바뀌어있다.

https://daeunnniii.tistory.com/168

profile
코딩 공부하는 사람

0개의 댓글