티스토리 뷰

개발/Linux

find command

Jaeyeon Baek 2011. 11. 29. 12:47



find 명령 하나만 잘 사용해도 원하는 코드 원하는 위치를 찾을 수 있음은 누구나 아는 사실입니다. 임베디드 개발자라면 자신만의 alias는 갖고 있을텐데, (bashrc) 제 경우에는 아래와 같이 사용합니다. 기본적으로 c의 경우에 finds를 정의해 놓습니다.

$ alias finds='find . -name "*.[cChH]" -print | xargs grep -n --color=auto '

이렇게 사용할 경우 .c와 .h를 모두 뒤져서 auto color로 결과가 출력되어 원하는 문자열 검색에 용이합니다.

출력결과
$ finds debug_locks
./lib/debug_locks.c:2: * lib/debug_locks.c
./lib/debug_locks.c:15:#include <linux debug_locks.h="">
./lib/debug_locks.c:24:int debug_locks = 1;
./lib/debug_locks.c:25:EXPORT_SYMBOL_GPL(debug_locks);


적합하게 바꾸어 사용하도록 합시다.
(추가로 php나 다른 언어의 경우에는 다른 alias를 사용해서 *.php 와 같은 식으로 find 구문을 만들어 사용합니다.)


'개발 > Linux' 카테고리의 다른 글

Kernel Netfilter socket option (getsockopt, setsockopt)  (2) 2011.12.02
64bit kernel + 32bit iptables (Application)  (0) 2011.11.30
비용이 낮은 연산자 선택 [%->&, / -> >>]  (0) 2011.11.20
pages_to_mb  (0) 2011.11.02
for_each_possible_cpu  (0) 2011.11.01
댓글
최근에 올라온 글
최근에 달린 댓글
글 보관함
Total
Today
Yesterday