How to Delete Files/Folders on Mac with Terminal RM Command
macOS includes a built-in Terminal app. You can use Terminal commands to do various tasks on your Mac. Learn how to delete files on Mac with Terminal below.
How to Delete Files on Mac with Terminal
- Open the Terminal app via Spotlight. You can also click Finder > Applications > Utilities > Terminal to open the app.
- In Terminal, type the
rmcommand and type a space after it.
- Drag the file that you want to delete after the command. Alternatively, you can manually enter the path of the file after the “rm” command.
- Press Enter and the file will be permanently deleted from your Mac.
How to Delete Multiple Files in Terminal on Mac
- Open Terminal on Mac.
- Type the command
rm filename.extension. Enter the real file name and extension after the “rm” command. Add the file name and extension of every file that you want to delete one by one, and leave a space between each file.
- Press Enter to delete the files with Terminal.
How to Delete Folders on Mac Using Terminal
If you want to use Terminal to delete a folder including any files or sub-folders it contains, you can use the “rm” command with the “-r” option. Follow the steps below.
- Launch Terminal via Spotlight.
- In Terminal, type the command
rm -r foldername. Replace “foldername” with the exact name of the folder. If the folder name has spaces, you need to put it in quotes. For instance, rm -r “my folder”.
Delete Files and Free Up Space on Mac with BuhoCleaner
If you can’t delete a file using Terminal or a normal way introduced below, you may try BuhoCleaner which lets you easily delete and shred the file.
BuhoCleaner is a Mac cleaner app to help you clean and speed up your Mac. It allows you to flash scan and clean your Mac, uninstall unwanted apps without leftovers, find and delete large or duplicate files, free up RAM, manage startup items, monitor system resource usage, shred files, and more.
Download and install BuhoCleaner on your Mac and use it to delete files on your Mac.
- Launch BuhoCleaner
- Click Toolkit > Shredder.
- Click the Select Files button and select the target file that you want to delete.
- Click the Securely Remove button to permanently delete the file from your Mac.
Other Ways to Delete Files or Folders on macOS
Instead of using Terminal to delete files and folders on Mac, you can use some normal ways to delete files.
- Open Finder.
- Select the target file that you want to delete. To select multiple files on Mac, press and hold the Command key and select the files.
- Press the Delete key to delete the files.
Via keyboard shortcut:
Select the file or folder that you want to delete and press Command + Delete to move it to the Trash. To bypass the Trash and permanently delete the file, press Shift + Command + Delete.
You can directly drag and drop the file to the Trash icon in the Dock to delete it.
Use Move to Trash:
Right-click the target file or use Control + Click. Select Move to Trash to delete the file.
This post offers a detailed guide on how to delete files on Mac with Terminal. You can use the Mac Terminal rm command or rm -r command to easily remove a file or folder from your Mac. Some other ways to help you delete files and folders on Mac are also introduced. Hope it helps.