xargs 연결하여 사용하기



    xargs 란?

    xargs 란? 서버를 운영하다보면 다양한 파일을 목록으로 추출하여 삭제, 복사 등등할때가 있다

    이러한 작업을 진행할수 있게 도움을 주는 명령이 xargs입니다





     

     xargs 사용해보기


    find로 tmp디렉토리의 .png, .txt확장자만 제외하여 찾은파일을 backup파일의 권한, 소유자를 등등 그대로 복사하기


    find /tmp -type f | grep -v ".png" | grep -v ".txt" | xargs cp -pt /backup


    위와 같은 명령어로 연결하여 복사를 할수 있습니다


    [위의 find, grep, cp 옵션]

    find와 grep : http://itstudyblog.tistory.com/309

    cp 명령어 옵션 : http://itstudyblog.tistory.com/310

    Posted by 서버이야기