Development

"find" command의 대안 "fd"/"fd-find"

chbae 2023. 4. 26. 22:03
728x90
반응형

find 명령어로 제일 많이 사용하는게 find . -name "*xxxxx*" 구문인데 alias를 걸기도 매번 치기도 귀찮아서 검색하다고 좋은 대안이 있어서 간단히 소개하고자 한다. 명령어는 바로 fd 이다.  MACOS 뿐만이 아니라 거의 모든 리눅스 Distro를 지원하고 엄청나게 빠르고 쓰기 편하다.

 

공식 저장소: https://github.com/sharkdp/fd

 

GitHub - sharkdp/fd: A simple, fast and user-friendly alternative to 'find'

A simple, fast and user-friendly alternative to 'find' - GitHub - sharkdp/fd: A simple, fast and user-friendly alternative to 'find'

github.com

설치 방법

MACOS

$ brew install fd

 

Ubuntu

$ apt-get install fd-find

 

사용 명령어는 MACOS에서는 fd이고 리눅스에서는 fd라는 다른 명령어가 있어 fdfind로 사용한다. fd가 설치되어 있지 않다면 ln으로 링크를 걸어서 사용할 수도 있고 이에 대한 설명은 위의 github의 README에 잘 설명되어 있다.

 

옵션 없이 fd나 fdfind 뒤에 문자열을 넣으면 find . -name "*xxxxx*" 와 비슷하게 보여준다. 물론 정규표현식을 포함하여 다양한 옵션을 지원하며 위의 문서를 보거나 fd --help 명령어로 자세한 옵션을 볼 수 있다.

함께 쓰면 좋은 명령어

필자의 동료가 grep의 대안으로 ripgrep를 알려주었다. 이것도 정말 간단하다. 설치 방법도 brew install ripgrep, apt-get install ripgrep로 간단하고 실행 명령어도 rg로 간단하다.

 

공식 저장소: https://github.com/BurntSushi/ripgrep

 

GitHub - BurntSushi/ripgrep: ripgrep recursively searches directories for a regex pattern while respecting your gitignore

ripgrep recursively searches directories for a regex pattern while respecting your gitignore - GitHub - BurntSushi/ripgrep: ripgrep recursively searches directories for a regex pattern while respec...

github.com

 

728x90