Preloader image
DDD

리눅스

find command (명령어)

작성자 관리자 (admin)
조회수 613
입력일 2021-10-19 09:43:49

복잡하다.
간단히 자주 사용하는 방법을 알아보자.
$ find . -name "찾을단어"

이 명령어는 프로젝트에서 처음 접한 구조를 해석하는데 도움이 될 수 있다.
그리고, 특정 파일을 가늠해 "*abc*.xml" 이런식으로 찾을 수 있다.

예)
$ find ./ -name "repenhart"
./tomcat/conf/repenhart
./tomcat/work/repenhart
$ find ./ -name "*.xml"
./tomcat/webapps/host-manager/WEB-INF/web.xml
./tomcat/webapps/host-manager/manager.xml
./tomcat/webapps/host-manager/META-INF/context.xml
./tomcat/webapps/manager/WEB-INF/web.xml
./tomcat/webapps/manager/META-INF/context.xml
./tomcat/webapps/ROOT/WEB-INF/web.xml
./tomcat/conf/tomcat-users.xml
./tomcat/conf/context.xml
./tomcat/conf/web.xml
./tomcat/conf/server.xml
./tomcat/bin/catalina-tasks.xml

-----------------------------------------------------------------------

아래는 find 명령어의 가이드이다.

$ find -help
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]

default path is the current directory; default expression is -print
expression may consist of: operators, options, tests, and actions:

operators (decreasing precedence; -and is implicit where no others are given):
      ( EXPR )   ! EXPR   -not EXPR   EXPR1 -a EXPR2   EXPR1 -and EXPR2
      EXPR1 -o EXPR2   EXPR1 -or EXPR2   EXPR1 , EXPR2

positional options (always true): -daystart -follow -regextype

normal options (always true, specified before other expressions):
      -depth --help -maxdepth LEVELS -mindepth LEVELS -mount -noleaf
      --version -xautofs -xdev -ignore_readdir_race -noignore_readdir_race

tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N
      -cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME
      -ilname PATTERN -iname PATTERN -inum N -iwholename PATTERN -iregex PATTERN
      -links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE
      -nouser -nogroup -path PATTERN -perm [-/]MODE -regex PATTERN
      -readable -writable -executable
      -wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N
      -used N -user NAME -xtype [bcdpfls]
      -context CONTEXT


actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print 
      -fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit
      -exec COMMAND ; -exec COMMAND {} + -ok COMMAND ;
      -execdir COMMAND ; -execdir COMMAND {} + -okdir COMMAND ;

Report (and track progress on fixing) bugs via the findutils bug-reporting
page at http://savannah.gnu.org/ or, if you have no web access, by sending
email to <bug-findutils@gnu.org>.
 

^