Site TIPS PAGE🔎 SEARCH  Ξ INDEX  MAIN MENU  UP ONE LEVEL
 OJB's Web Site. Version 2.4. Mac Tip.Location: tip96 tips mac owen2 
Tip

Discuss   Up to OJB's Mac Tips List

Terminal Tips: Deleting Files

There are some situations when deleting files using the command line is preferable to deleting them in the Finder. For example, the command line can delete files which are protected because of their ownership and it can also delete files securely, so they cannot be recovered.

CAUTION: Do I need to mention that using the delete command can lead to files being deleted?

The command to delete files in Unix is "rm" (remove). To use it, just navigate to the directory (folder) containing the file(s) to delete and type "rm filename", where filename is the name of the file to delete. You can delete multiple files using a "wildcard" in the filename, for example rm file* will remove all files starting with "file". Use rm * to remove everything in the current folder (be careful, OK?).

Theoretically, files which have been deleted can be recovered using the correct software (file recovery or "undelete" programs). If you have sensitive data you really want to delete, use the "rm -P filename" command. Remember, the idea of this is to make the file unrecoverable so don't use it on useful files!

If the files you want to delete are not owned by you they can still be deleted using the "sudo" command with "rm", like this: "sudo rm filename", then supply the admin password.

Related Tips

Terminal Example: Listing Files
Terminal Example: Shell Script
Terminal: Change Priority
Terminal: Changing Privileges
Terminal: Fixing a Hang
Terminal: Listing Directory
Terminal: Manual and Help
Terminal: Remote Secure Login
Terminal: Terminate a Process
Terminal: Top Processes





I usually write a blog post about once a week. The latest post can be viewed here: Think for Yourself: In the end, everything is just an opinion. Be skeptical, and think for yourself! (posted 2026-04-25 at 21:12:02). Or go to the Home Page of My Blog to choose a post to view.

I do podcasts too! You can listen to my latest podcast, here: OJB's Podcast 2026-04-14 How Far is that Star?: How would we really know how big the universe is? Or subscribe to my podcast RSS feed, on my RSS Feeds page.

If you're not sure what to view from the thousands of pages on my site, here are some suggestions: My Latest Airshow Report (photos and movies from Warbirds Over Wanaka, 2026), My Favourite Wines and Beers (tasting notes for some of my favourites), An Interesting Astronomical Observation (learn a bit about astronomy from these observing notes), See Some Photos (A short rail journey through the Taieri Gorge), Read Some Mac Tips (Learn about how to use your Mac, and fix some problems).


Latest Site News and Notifications (Desktop): You are currently viewing OJB's web site, version 2.4 which has some major changes, and possibly errors! Please report any problems to ojb@mac.com.

 Site ©2026 by OJBRSS FeedWhy Macs are BestMade & Served on Mac 
Site Features: Blog RSS Feeds Podcasts Feedback Log07 Jun 2024. Hits: 1,001,485,072
Description: Mac TipLogged: nothingLoad Timer: 259ms