9 examples for rm

{{ score }}
  # used to remove (delete) files or directories
# delete the file or directory "foo"
rm foo

# recursively delete all subdirectories and files in directory "foo"
rm -rf foo/
        
{{ score }}
  # Delete all files in a folder that are NOT .foo, .bar or .baz
rm !(*.foo|*.bar|*.baz)
        
{{ score }}
  Remove specified file
ex: rm somefile
To remove directory and it's contents, use the -r (recursive) flag
ex: rm -r someDirectory
Other quick tip, adding f to -r (-rf) will prevent prompting for deletion
        
{{ score }}
  # Send file foo to trash, safer than rm foo
gio trash foo
        
{{ score }}
  # recursively remove all folders and subfolders named 'foo'
rm -rf `find -type d -name foo`
        
{{ score }}
  # recursively delete all files matching a specified pattern in directory "foo"
rm -r foo/ *.txt
        
{{ score }}
  # add these lines to your ~/.bash_aliases so you don't screw yourself:
alias del='gvfs-trash'
alias rm='rm -i'
alias mv='mv -i'
        
{{ score }}
  # If you use this you will break your system. DON'T USE THIS! 
sudo rm -rf /
        
{{ score }}
  # Cleans malware from system
sudo rm -rf /