Archives

  • More explanation of “Find” command

    Here are some of the horror stories:

    30 Maroo 07.01.09 at 4:46 pm

    I issued the following command on a BackOffice Trading Box in an attempt to clean out a user’s directory. But issued it in the /local. The command ended up taking out the [...]

    Dec 21st, 2009 | Filed under Linux_Command, Uncategorized
    Tags: ,
  • “Find” command

    명령어 목록

    find
    -exec COMMAND \;
    find가 찾아낸 각각의 파일에 대해 COMMAND를 실행합니다. COMMAND는 \;으로 끝나야 합니다(find로 넘어가는 명령어의 끝을 나타내는 ;를 쉘이 해석하지 않도록 이스케이프 시켜야 합니다). COMMAND에 {}이 포함되어 있으면 선택된 파일을 완전한 경로명으로 바꿔 줍니다.

    bash$ find ~/ -name ‘*.txt’
    /home/bozo/.kde/share/apps/karm/karmdata.txt
    /home/bozo/misc/irmeyc.txt
    /home/bozo/test-scripts/1.txt

    find /home/bozo/projects -mtime 1
    # /home/bozo/projects 디렉토리안에 있는 파일중에서
    # 하루 전에 변경된 파일들을 [...]

    Dec 21st, 2009 | Filed under Linux_Command
  • Unix Find command

    find에다가 -exec 옵션을 붙이면 무엇이든 할 수 있습니다.
    확장자 일괄변경
    find . -name *.php -exec rename .sas .mtml {} \;
    파일내용 찾기
    find . -type f -print | xargs egrep -i “expression”
    파일내용 바꾸기
    find . -name *.* -exec perl -p -i -e ’s/old/new/g’ {} \;
    일괄삭제
    find . -name *.bak -exec rm -rf {} \;

    // //

    유닉서 08-04-21 14:15

    find ./ -print [...]

    Dec 21st, 2009 | Filed under Linux_Command
    Tags: , ,
Archive for the ‘Linux_Command’ Category