- What Is Terminal? Terminal is an app that comes with every Mac. It's a way to use the command line on the Mac and allows users to modify settings, files, and other features beyond what is available in the graphical user interface. The command line offers users total command of their Mac, from the inside out.
- For Mac geeks who want to learn more about using the command line, Wil Limoges offers this basic tip for creating and deleting files in Terminal. How to create and delete files in the Mac terminal.
- I'm not aware of a terminal command to uninstall, and neither of the two related install commands have an uninstall parameter. Most of the GUI programs must be running before any installation so they are able to record what the software installs or they look to the use of the.pkg receipts in /Library/Receipts/ for what a particular program.
- If you installed the Cisco VPN for Mac version 4.1.08005 package, enter these commands to delete the misplaced files. The deletion of these files will not affect your system, since applications do not use these misplaced files in their current location.
- When you delete a volume, all the data on the volume is permanently erased, and the volume is removed from the container. In the Disk Utility app on your Mac, select the APFS volume you want to delete in the sidebar. Click the Delete Volume button in the toolbar. Click Delete, then click Done.
Use Terminal to locate the app that is using the file. If you’re comfortable using the macOS Terminal, there is a command you can try that will identify which app is using the specific file. Double-click on the Trash and make sure that a Finder window pops up. Example: If you want to delete a folder 'xyz' in 'Macintosh HD' (the example name of your main volume) enter cd 'Macintosh HD/Users/username', replacing username with your user name. Then enter ls again to list all files and directories to be sure that you are in the correct working directory. Then enter rm -r foldertodelete or rm -rf folder.
rm -rf filename or foldernamePress RETURN
If the item is in a system owned folder then precede the above command with sudo:
sudo rm -rf filename or foldernameYou will be prompted to enter your admin password which will not be echoed.
If you know where the item is located through the Finder or on the Desktop, then drag the item into the Terminal window immediately after 'rm -rf '. Note there must be a space after '-rf'.
Jun 3, 2010 3:15 PM
Terminal
Hey
I like terminal, it is so powerful and useful. You can do so much with it. This little tip will show you how you can delete a lot of files, and certain types of files really quickly using Terminal. This tip carries a warning of “Insert Brain Before Doing Anything”, because if you type something incorrectly you can delete your entire hard drive, I am serious one little line and zip no more files. Anyway, I am going to use a bit of caution in this tutorial and you should to.
To being, open up Terminal. This this tip will show you how to delete every file and folder in a certain directory. First navigate to the folder you want using the cd command. You can then type the following. Bewarned if you type this straight into Terminal it will delete your entire user area. If you are in the root of your hard drive, it will delete your entire hard drive.
rm -rf ./*
That will delete everything in that folder. The -f option will not prompt you about file permissions and delete the files anyway, -r will delete the folders and then and files and folders in the folder and so on and so forth. Don’t do this on the root or your home directory because it will be unforgiving and will delete everything. It doesn’t move it the files to the trash. The slash dot at the beginning will make sure it will delete everything forward of the current folder and not anything else, a small security measure. The star is the wild card operator. You can delete certain files by inserting their names separated by spaces.
Another trick which you can use is to delete files by file type using the wild card operator. For example the following will delete everything that is a png file.
rm -rf ./*.png
You can also use this the other way around.
rm -rf ./test.*
That will delete everything called test not matter what the application extension it uses. You can make the wild card more open by adding the following.
rm -rf ./r*.p*
That will delete any application that any file that begins with r and the file extension that begins with p (.png, .psd etc).
The uses of this are endless. For example you can quickly clear out a whole folder in a couple of characters. How long do you think it would take to delete everything out of a folder that contains starts with the letter “t” and is a png file, this folder contains 1000 files and is mixed in with a lot of different files. You could do it within a couple of seconds with Terminal but it would take you a lot longer in Finder.
Have fun with rm, just make sure you don’t type rm -rf /* otherwise bye bye hard drive.
If you want to take your skills with Terminal a bit further I recommend you check out the Terminal Category on this site. If you fancy reading a book there is a couple on Amazon that I regularly see mentioned and recommend, O’reilly Unix Geeks and Unix Under the Hood both are designed for Mac OS X and take Terminal further.