ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • UNIX 에서 File을 찾는 여러가지 방법(.find)
    UNIX / LINUX 2010. 5. 3. 08:17

    작업을 하다보면, 여러가지 많은 file 및 directory가 많을때.. 하나 하나 찾아보기 어렵읍니다.


    아래의 여러가지 다양한 find 를 이용하며 쉽게 작업 할수 있죠...


    -- listener.ora가 어디있는지 찾기. find . -exec grep -lis listener.ora {} \;


    -- 현재 directory 및에서 모두 찾기.

           find . -exec grep -lis fdugpi.lpc \{\} \\;
            (searches in this directory down)
    
            find / -exec grep -lis fdugpi.lpc \{\} \\;
            (searches from root directory down)
    
            find . -exec grep -lis file {} \;
    
            find . -exec grep -lis rcache {} \;
    
            (searches this directory down)
    
            find . -follow -name bug734234 -print
            (use if there are linked sub-directories, such as in tcpatch)
    
            find . -name "*.pls" -exec egrep -il ARP_STANDARD {} \;
            (This searches all .pls files for a file that contains the string ARP_STANDARD)
    


    -- 모든 sql에서 DROP이 있는 file찾기 find . -name "*.sql" -exec egrep -il DROP {} \;


    -- 최근 하루(1) 동안(-)에 변경(change)된 파일을 찾을려면(-ctime)?

    1. find / -ctime -1 -a -type f | xargs ls -l | more

    find $ORACLE_HOME -name 'orcl_ora_*.trc' -mtime +7 -exec rm -r {} \;


    -- 수정된지 5일 이상된 모든 file지우기

     -- 우선 ls로 확인
    

    find . "*.trc" -mtime +5 -exec ls -l {} \;

     -- 지우기
    

    find . "*.trc" -mtime +5 -exec rm -r {} \;

    'UNIX / LINUX' 카테고리의 다른 글

    UNIX / LINUX 명령어 팁  (0) 2010.05.03
    UNIX / LINUX 유용한 명령어 모음.  (0) 2010.05.03
    UNIX 명령어 모음.  (0) 2010.05.03
Designed by Tistory.