Written by
Amanda WongSummary: This post elaborates on the Mac delete keyboard shortcuts and command line. After reading, you will know how to delete a file/folder or multiple ones using keyboard shortcuts and the command lines.
When specific files or folders are unwanted, you can delete them from your Mac to tidy the desktop or free up more space. Instead of the traditional routine to delete files on Mac, such as dragging-dropping files to the Mac Trash and right-clicking the file and choosing Move to Trash, there are also some keyboard shortcuts and command lines for deletion.
Delete on Mac keyboard shortcuts
Your productivity can increase by using keyboard shortcuts. With the use of a keyboard shortcut, you may perform tasks on a computer that ordinarily demands the use of a mouse or trackpad and the pull-down menu on the screen. Besides, when drag-drop not working on Mac, you can try keyboard shortcuts. Here, we are going to introduce several Mac delete keyboard shortcuts.
Command + Delete
After you select the unwanted item, be it a file or a folder, or select multiple items, press the Command and Delete keys, and you can move the selected items to Mac Trash. You may need to confirm if the item is locked, just click continue and you can move it to Trash. The deleted files/folders are kept in Trash.
Shift + Command + Delete
This key combination will empty the Trash and permanently remove them from Mac. Command + Delete only moves the deleted files to the Mac Trash folder, and these items still occupy your disk space, or they will be emptied with the "Remove items from Trash after 30 days" enabled(check this from Finder > Settings > Advanced). To immediately empty the Mac Trash, just press Shift, Command, and Delete, then choose Continue to confirm.
Option + Shift + Command + Delete
Without the need for confirming your intention and empty the Mac Trash, you can simultaneously hit the 4 keys: Option, Shift, Command, and Delete. The confirmation dialog will not pop up and the sites kept in Mac Trash will be deleted permanently once you press, so use caution.
If the Delete button is not working on your Mac, check your keyboard connection or try to delete with command lines.
Mac Trash Won't Empty? Why & How to Force Empty Trash
Guide to fixing the MacBook Trash that won't empty in different scenarios and tell the reasons why you can't empty Mac Trash. Also, available ways are offered for you to force empty Trash on Mac. Read more >>
Delete on Mac command lines
In addition to keyboard shortcuts, you can also use command lines in the Terminal to delete files/folders on Mac. You can take it as an alternative method to effortlessly erase multiple files/folders, empty Mac Trash when confronted with persistent issues, and delete files when Finder not spending.
Warning: Using Terminal command lines should be very careful given that you can't undo the operations. You'd better back up your Mac with Time Machine or other methods so that you can restore your Mac when unexpected errors happen.
- Open Terminal from your Utilities folder in Applications.
- Check which directory you're in by typing ls -la
- Navigate down a directory with cd [directoryname] or up a directory with cd ../
Then, type different command lines as below based on your needs.
rm: delete files
You can delete single or multiple files on your Mac with the terminal command rm. Just type rm filename(there is a space in front of the filename, replace the filename with the true name of the file you want to delete), then press Enter to run the command. It will immediately delete the files without confirmation. If you're feeling cautious, you can use the -i flag to confirm the deletion, just type rm i filename and type yes.
rmdir: delete empty folders
If you want to remove an empty folder from Mac with Terminal, you will need to command line rmdir. The rmdir command is a little riskier as you can't use the -i flag with it. Remember that only empty folders are deleted by this command line. Continue reading if you wish to delete a directory and the files it contains.
rm -R: delete folders
Using the command rm -R, it deletes the whole contents of that folder, including any files, subfolders, and files or folders within those subfolders, this is the final deletion. For further security, you can use the -i flag(rm -iR filename), which prompts you to approve the deletion of each item. This can be annoying, but it's probably preferable to be safe unless you're quite certain that you want to remove all those files.
If you accidentally delete files on Mac, try iBoysoft Data Recovery to get them back!
Share Mac delete keyboard shortcuts and command lines!