본문 바로가기

Ubuntu/linux Command

Advanced grep/find technique - linux

728x90

directory 아래 subdirectory 중에 특정 string 을 포함하고 있는 directory 가 있는지 확인하는 방법

 

tree | grep vue-3  :  vue-3 를 포함하고 있는 directory name 와 file name 만 볼수 있다.

tree  -f  | grep vue-3  : vue-3 를 포함하고 있는 full directory name 와 file name 만 볼수 있다.

find . -name ".git"  : current directory 아래 subdirectory 중에 .git 이라는 것을 볼 수 있다.

 

 

directory 아래 subdirectory 중에 특정 string 을 포함하고 있는 directory 를 모두 지우는 방법

find . -name .git -type d -exec rm -rf {} + : current directory 아래 subdirectory 중에 .git 이라는 것을 찾아서 모두 지운다.