본문 바로가기
Linux

find 고찰 및 활용

by Leo 리오 2011. 9. 19.
반응형
#find -name $filename
$filename의 이름을 가진 파일을 찾는다. (RE로 정확히 매칭)
recursive하다.
 


#find -perm -u+x
user permission이 x(execute)인 파일들을 찾는다.
 


#find -type f
폴더를 제외한 파일만(?) 찾는다.
 


#find ........ | xargs file
.......조건으로 찾은 파일들의 정보를 본다.
( #file  $files )
찾은 파일이 가장 마지막의 argument로 들어가게 된다.
 

 
#find ........ -exec cp {} directory/ \;
.......조건으로 찾은 파일들을 directory/로 복사.
( #cp $files directory/ )
찾은 파일이 {}자리의 argument로 들어가게 되고 \;는 끝을 알린다.



#find . -name "*.c" -type f -exec grep xx {} \; 
#find . -name "*.c" -type f | xargs grep xx 

모든 *.c파일들중에서 xx가 들어간 파일을 찾음.

 
반응형

'Linux' 카테고리의 다른 글

install GMP MPFR MPC  (0) 2011.09.22
arm-linux-gcc toolchain 컴파일 및 설치  (1) 2011.09.20
리눅스 fg(fore ground), bg(back ground)  (0) 2011.09.19
[펌]vi로 error/warning 추적하기  (0) 2011.01.13

댓글