리눅스 폴더별 용량 확인 명령어


du 명령어를 사용해서 폴더별 용량을 확인할수있습니다.


확인하고 싶은 폴더로 이동합니다.

$ du -h --max-depth=1


-h 옵션은 사람이 보기 편한 단위로 변경합니다. byte -> mb or gb

--max-depth=1 디렉토리 깊이1만큼만 출력하라는 뜻입니다.




특정 폴더 및 파일 일괄 지우기


방법은 간단합니다.


find로 원하는 목록을 뽑고 그뒤에 -exec를 붙이고 하고싶은 일을 하시면 됩니다.


ex) find . -name "test" -tyhpe d // 폴더명 중에 test가 들어간 폴더를 찾는다

ex) find . -name "test" -type d -exec rm -rf {} \; 폴더명 중에 test가 들어간 폴더를 찾아서 rm -rf 명령어로 지운다.


1. 특정 폴더 일괄 지우기


find . -name "test" -type d -exec rm -rf {} \;

or

find . -name "test*" -type d | xargs rm -rf


2. 특정 파일 일괄 지우기


find . -name "test" -type f -exec rm -rf {} \;

or

find . -name "*test*" -type f | xargs rm -rf

우분투 12.04를 서치하는데 패키지 파일이 제대로 설치 혹은 업데이트가 안될때 가있습니다.


저같은경우는  sudo apt-get update를 실행했을경우 아래와 같은 에러 메시지가 여러게 뜨면서

몇가지 업데이트및 패키지 설치가 되지 않았습니다.

 

failed to fetch :  http://kr.archive.ubuntu.com/ubuntu/*******   Hash sum mismatch


이렇게 Hash sum mismatch가 뜰경우 아래와 같이 하시면 해결이 됩니다.


$sudo rm /var/lib/apt/lists/*


$sudo apt-get update

가끔 sudo apt-get update를 할때 에러코드를 네고 업데이트가 되지 않을때가 있습니다.


ex에러메시지 

W: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/dists/precise/Release.gpg      Unable to connect to ph.archive.ubuntu.com



이런경우 해결할수 있는 한가지 방법을 소게한다. 이방법이 위의 경우를 모두 해결하지는 않습니다.


아래방벙븐 잘못되어있거나 변경이 되었을수도있는 /etc/apt/sources.list 를 다시 업데이트 해주는 방법입니다.


http://repogen.simplylinux.ch/  사이트에 접속합니다.



Select your country : 자신의 나라를 설정합니다.

Select your release : 우분투 버전을 선택합니다.

Ubuntu Branches, Ubuntu Updates  모두 선택


Generate LIst를 선택하면  아래와 같은 리스트가 나옵니다.


해당 리스트를 /etc/apt/sources.list의 내용을 모두 지우고 기록합니다.


이제 sudo apt-get update 를 실행합니다.


sources.list가 문제였다면 이로써 해결이 됩니다.



한국 우분투 12.04버전 예제 리스트


#############################################################

################### OFFICIAL UBUNTU REPOS ###################

#############################################################


###### Ubuntu Main Repos

deb http://kr.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse 

deb-src http://kr.archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse 


###### Ubuntu Update Repos

deb http://kr.archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse 

deb http://kr.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse 

deb http://kr.archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse 

deb http://kr.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse 

deb-src http://kr.archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse 

deb-src http://kr.archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse 

deb-src http://kr.archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse 

deb-src http://kr.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse 



우분투 서버 모드 설치할때 언어를 한글로 선택하게되면 최초 뜨는 콘솔에서 한글 깨짐 현상이 발생합니다.


원인은 콘솔은 1바이트만 보여주는데 한글은 2바이트이기 때문입니다.


이는 우선 간단하게 해결이 가능합니다.


$sudo apt-get install fbterm

$sudo apt-get install ttf-nanum-coding //한글 폰트 설치 (14.04에서는 fonts-nanum-coding로 변경)

$sudo fbterm

+ Recent posts