MinUk.Dev
rm (Linux Command) - minuk dev wiki

rm (Linux Command)

created : Sun, 12 Apr 2020 20:22:32 +0900
modified : Sat, 27 Jun 2020 15:13:51 +0900

자주 사용하는 거 모음

특정 파일 제외하고 지우기

  • 단일
$ rm -v !("filename")
  • 다중
$ rm -v !("filename1" | "filename2")
  • 만약 zsh을 쓰고 있다면
$ setopt extendedglob
$ rm ^("filename1" | "filename2")

Delete Files Using Extended Pattern Matching Operators

  • *(pattern-list) : matches zero or more occurrences of the specified patterns
  • ?(pattern-list) : matches zero or one occurence of the specified patterns
  • +(pattern-list) : matches one or more occurrences of the spcified patterns
  • @(pattern-list) : matches one of the spcified patterns
  • !(pattern-list) : matches anytthing except one of the given patterns
  • 자세한건 [[glob]] 참고