Server/linux

[linux] 리눅스 명령어 mkdir, rmdir, rm (파일이나 디렉토리 생성, 삭제)

코딩for 2022. 8. 30. 15:23
반응형

 

mkdir : 디렉토리 생성

 

 

rm :  파일 삭제

rmdir :  (비어있는) 디렉토리 삭제 

 

디렉토리 내에 파일이 존재할 경우 rmdir 명령어로 삭제 불가

디렉토리 하위 모든 파일을 삭제는 -fr 옵션을 이용해서 삭제

rm -fr [디릭토리명]

 

rm 명령어 옵션

  -f, --force           ignore nonexistent files and arguments, never prompt
  -i                    prompt before every removal
  -I                    prompt once before removing more than three files, or
                          when removing recursively; less intrusive than -i,
                          while still giving protection against most mistakes
      --interactive[=WHEN]  prompt according to WHEN: never, once (-I), or
                          always (-i); without WHEN, prompt always
      --one-file-system  when removing a hierarchy recursively, skip any
                          directory that is on a file system different from
                          that of the corresponding command line argument
      --no-preserve-root  do not treat '/' specially
      --preserve-root   do not remove '/' (default)
  -r, -R, --recursive   remove directories and their contents recursively
  -d, --dir             remove empty directories
  -v, --verbose         explain what is being done
      --help     display this help and exit
      --version  output version information and exit

 

 

 

 

반응형