How to Delete a File in Terminal on Your Mac GA S REGULAR Menu Lifewire Tech for Humans Newsletter! Search Close GO Computers, Laptops & Tablets > Apple
How to Delete a File in Terminal on Your Mac
Use the command line to permanently delete files from a Mac
By Brenna Miles Brenna Miles Writer The University of Phoenix Brenna Miles is a technology writer with a B.A. in Business Management and HR Management. She's been writing about technology for 6+ years. lifewire's editorial guidelines Updated on September 20, 2022 Reviewed by Ryan Perian Reviewed by Ryan Perian Western Governors University Ryan Perian is a certified IT specialist who holds numerous IT certifications and has 12+ years' experience working in the IT industry support and management positions. lifewire's editorial guidelines Tweet Share Email Tweet Share Email Apple Macs iPad 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 Mac computers with macOS and OS X Lion (10.7) and later. 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. How to Delete a File in Terminal on 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. There you have it. Harness your new power to delete files easily, but remember to use it with care. FAQ How do I delete multiple files at once from Terminal? In Terminal, type in rm [FILENAME].[EXTENSION] followed by the filename and extension of every other file you want to delete—leaving a space between each entry. So it should look something like "rm [FILE1].[EXTENSION] [FILE2].[EXTENSION] [FILE3].[EXTENSION]" and so on. How do I delete a hidden file using Terminal? First you'll want to "un-hide" or reveal the files. Type in defaults write com.apple.Finder AppleShowAllFiles TRUE and press return, then type in killall Finder and press return again. Once the files are revealed you can delete them either by typing in rm [FILENAME].[EXTENSION] or typing rm and then dragging and dropping the file icon into Terminal, then pressing return. Was this page helpful? Thanks for letting us know! Get the Latest Tech News Delivered Every Day Subscribe Tell us why! Other Not enough details Hard to understand Submit More from Lifewire How to Delete Files on Mac How to Make a Bootable Flash Installer of OS X or macOS How to Turn off Mouse Acceleration on Mac How to Access Google Docs Trash How to Delete Temporary Files in Windows How to Show or Hide Hidden Files and Folders on Mac View Hidden Files and Folders on Your Mac With Terminal How to Delete Streamlabs on Mac How to Block a Website How to Delete or Split Your Mac's Fusion Drive How to Use Mac Terminal Commands Make a Bootable USB Installer for OS X El Capitan How to Flush DNS Cache on a Mac How to Delete Time Machine Backups Three Ways to Access the Library Folder on Your Mac How to Install Android Debug Bridge (ADB) Newsletter Sign Up Newsletter Sign Up Newsletter Sign Up Newsletter Sign Up Newsletter Sign Up By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. Cookies Settings Accept All Cookies