What to Know
- In a Finder window, go to Applications > Utilities, type rm, space, drag the file to the Terminal window, and press Enter.
- You can also press Command+Space to open Spotlight, type terminal, and press Enter to access the Terminal window.
In this guide, we show you how to delete a file in Terminal on a Mac. Instructions apply to devices running macOS and OS X Lion (10.7) and later.
How to Use Terminal to Delete a File From Your Mac
Whether you're dealing with a problem file that refuses to leave your Mac or you want to delete multiple files quickly, Terminal makes it quick and easy. Here's how:
-
Navigate to Terminal on your Mac by opening a Finder window and selecting Applications > Utilities.
You can also press Command+Space to open Spotlight. Then, type terminal and press the Enter key.
-
In the Terminal window, type rm and a space.
-
Next, drag the file you want to delete into the Terminal window.
-
Press Enter, and the file is gone forever.
Want to go faster? Remove the file by entering the path to the file into Terminal, without the drag and drop.
What Is Terminal?
Terminal is an app that comes with every Mac. It's a way to use the command line on the Mac. It allows you to modify settings, files, and other features beyond what is available in the graphical user interface (GUI). The command line offers you total command of your Mac from the inside out.
Why should you use Terminal? Here are a few of the key benefits of using Terminal for Mac:
- It rings true to Unix: Mac users coming over from Unix will find Terminal easier to use due to its similarity.
- It allows you to unlock all preference settings: Everything you can customize can be unlocked using Terminal, even things you can't access through the GUI.
- It cuts down on clicks: Want to move all your files from one folder to another? A few seconds of typing in Terminal is all you need, versus the time and clicks it takes to transfer files manually.
- It helps you remove files with ease: If you want to remove a file from your Mac forever, you can skip the Trash and use Terminal. It's quick, only taking a few seconds.
The Terminal is a dangerous place if you're inexperienced in the command line. Before you enter Terminal, familiarize yourself with the basic commands. One wrong command can damage your system.