rm (Linux Command)

created : 2020-04-12T11:22:32+00:00
modified : 2020-06-27T06:13:51+00:00

linux rm cli command glob

자주 사용하는 거 모음

특정 파일 제외하고 지우기

  • 단일
    $ 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]] 참고