How To Delete Something Downloaded On Mac
When it comes to quickly taking care of daily tasks, the control line can be both powerful and dangerous. Take the commands in this article as an example: the rm command allows you lot to remove (or delete) files. The rmdir control does the same to directories (also know as folders). But exist careful: Unlike when you motility files to the Trash from the Finder, there's no way to get them back if you use these commands.
Still, if yous want to tap into Terminal's powers, this is a command you lot can't overlook. I'll evidence you how to add together a safeguard to ensure that y'all only delete files you really want to delete.
Why bother deleting files with the command line?
Deleting files with the Finder isn't too difficult, plus y'all can e'er fish files out of the Trash if you change your mind. And then why bother using the command line? Here are some reasons:
- You can utilize wildcards to delete multiple files quickly and efficiently.
- You can remove files from the Trash when you run across stubborn errors.
- You lot tin delete files that are hidden in the Finder. These files, which can contain settings for sure apps or parts of macOS, incorporate a dot (.) before their names and the Finder doesn't prove them.
- If you've lost admission to the Finder considering your Mac is on the glimmer, you might be able to utilize the command line to troubleshoot the trouble.
How to delete files
It's dangerously easy to delete files with the rm control. Hither'southward an example. After you launch Terminal (in your /Applications/Utilities folder) type cd ~/Desktop to navigate to the Desktop directory. To delete a file, type rm filename , replacing filename with the bodily name of the file you desire to delete. (If you have a file name with spaces, you lot need to put the proper name in quotes: "For Example.txt" .) If you lot had a file here named MyFile.rtf that you never, always wanted to see again, yous could run this control:
rm MyFile.rtf
When you press Return, the file will go poof! The Mac doesn't confirm if you want to delete the file. It volition be gone, toast, history. You can't get information technology back.
You can even delete multiple files in a single command. If you accept iii files on your Desktop that you want to delete, and you desire to delete them all at one time, y'all can do so like this (if you have a file proper name with spaces, y'all demand to put the name in quotes: "For Example.txt" .):
rm MyFile.rtf MyCV.rtf MyGreatAmericanNovel.rtf
Once more, pressing the Return primal does the dingy piece of work.
Information technology'south worth repeating: this command deletes files. It nukes them. Yous can't get them back. You can't click on the Trash icon and call up files you've accidentally deleted.
But there is a safety net: information technology'southward the -i (interactive) flag. So if y'all're feeling cautious, you could run the above commands with this flag as follows:
rm -i MyFile.rtf Or, in the instance of deleting multiple files:
rm -i MyFile.rtf MyCV.rtf MyGreatAmericanNovel.rtf
In each case, pressing Return won't actually actuate the rm command, because the -i flag acts as a intermission push. You'll see the following in Terminal when running these commands:
IDG
In order to proceed, you need to type yeah , or simply y . In the case of multiple files, yous'll see i query for each file. Granted, information technology's easy to become into the habit of quickly typing y , but the question is intended to make yous stop and think very carefully well-nigh whether you really want to delete that file.
How to delete empty directories (a.k.a folders)
Deleting directories, or folders, is a bit different. If you try to run the rm command on a directory, yous'll see the post-obit message:
You tin can't delete a directory using the rm command.
IDG
In that location's a special command for deleting directories: rmdir . So to delete a directory named Athenaeum, run this command (If you have a directory name with spaces, you need to put the proper noun in quotes: "For Example" .):
rmdir Athenaeum
You tin can't apply the -i flag with the rmdir command, then the command is a bit riskier.
Note that this command merely deletes empty directories. If you want to delete a directory and the files it contains, read on.
How to delete everything in a directory
The rm command has a powerful option, -R (or -r ), otherwise known as the recursive selection. When you run the rm -R control on a binder, you're telling Terminal to delete that folder, any files information technology contains, any sub-folders it contains, and any files or folders in those sub-folders, all the way down. You enter the command as m -R directoryname , where you substitute directoryname for the name of the directory you want to delete. (If you have a directory proper name with spaces, you lot need to put the name in quotes: "For Example" .)
For case, let'south say you have a directory full of archives, containing sub-directories and files. Deleting each item individually from the Finder or the command line can take a long time. And so simply run the command like this:
rm -R Archives
Remember, this deletion is final. But you can use the -i flag for protection:
rm -iR Athenaeum
This volition ask y'all to confirm the deletion of each item. This tin can exist abrasive, but unless yous're really sure yous want to delete all those files, information technology's probably best to be prophylactic.
Can't empty Trash in the Finder? Use the Terminal
When can the rm -R command come in handy? Say you tin't empty the Trash on your Mac. A file might be locked or y'all may not take permission to delete i or more files. This sort of glitch is annoying, merely you can use the command line to provide an easy solution.
In Terminal, type the post-obit:
rm -R
Then type a space.
In the Finder, open the Trash, and and so elevate the items it contains to the Terminal window. You'll encounter one or more files with paths such as /Users/.Trash/file.txt.
If there are lots of files, y'all may find that the resulting list—all on one long line, wrapping in the Terminal window—may exist very long. If yous're absolutely sure that y'all want to delete all these items, press Return. Terminal will empty the Trash. Command line win!
IDG
Want to learn more? See our articles about navigating the file organisation with the command line, learning from human being pages, and copying and moving files.
Notation: When you purchase something after clicking links in our articles, nosotros may earn a small commission. Read our affiliate link policy for more details.
Kirk McElhearn (@mcelhearn) writes virtually Macs, music and more than on his blog Kirkville. He besides runs Kirk's iTunes Forum, where users tin can talk over iTunes, iOS devices, music, and more.
DOWNLOAD HERE
Posted by: campbelllowitood.blogspot.com

0 Komentar
Post a Comment