usage: rm [-f | -i] [-dPRrvW] file ...
ex) 디렉토리 삭제
> rm -rf 디렉토리명
: r 옵션 - 디렉토리내에 파일이 있더라도 삭제시킴
: f 옵션 - 삭제여부 묻지 않고 바로 삭제
ex) arg list too long 메세지가 나오며 에러날 경우(rm의 버퍼한계때문)
> find . -print | xargs 로 응용
find . -name '*.bak' -exec rm -vf {} \;
-->파일의 확장자가 .bak 로 끝나는 파일들을 찾아 삭제시킴
rm 의 v 옵션은 삭제되는 파일들을 보여줌
The options are as follows:
-d Attempt to remove directories as well as other types of files.
-f Attempt to remove the files without prompting for confirmation, regardless of the file's
permissions. If the file does not exist, do not display a diagnostic message or modify the
exit status to reflect an error. The -f option overrides any previous -i options.
-i Request confirmation before attempting to remove each file, regardless of the file's per-
missions, or whether or not the standard input device is a terminal. The -i option over-
rides any previous -f options.
-P Overwrite regular files before deleting them. Files are overwritten three times, first
with the byte pattern 0xff, then 0x00, and then 0xff again, before they are deleted.
-R Attempt to remove the file hierarchy rooted in each file argument. The -R option implies
the -d option. If the -i option is specified, the user is prompted for confirmation before
each directory's contents are processed (as well as before the attempt is made to remove
the directory). If the user does not respond affirmatively, the file hierarchy rooted in
that directory is skipped.
-r Equivalent to -R.
-v Be verbose when deleting files, showing them as they are removed.
-W Attempt to undelete the named files. Currently, this option can only be used to recover
files covered by whiteouts.
'Unix & Linux > 명령어' 카테고리의 다른 글
find 명령어 (0) | 2013.10.03 |
---|---|
유용한 명령어 - A (0) | 2012.12.18 |
netstat (0) | 2012.11.02 |
whereis 명령어 (0) | 2011.06.17 |
[UNIX/Linux] history 명령어 (0) | 2011.05.06 |