Like any other computer, your Raspberry Pi can fill up with unwanted items. You may have created a file that you no longer need or downloaded a file you no longer want.
If you’re ready to do a bit of cleaning on your Raspberry Pi, we’ll show you how to delete a file.
New to Raspberry Pi? Start here first:
Delete a file on Raspberry Pi OS
If you are running Raspberry Pi OS, deleting a file couldn’t be easier. You can do so right from the graphical interface.
Select the file and drag it to the Trash bin on the desktop or right-click the file and choose Move to Trash. You’ll be asked to confirm; click Yes to move the file to the Trash.
If you change your mind later and want the file returned to its location, right-click it in the Trash and select Restore.
When you’re ready to clean out the Trash bin, you can delete files from it to get rid of them for good. Right-click a file and choose Delete from the shortcut menu. You’ll be asked to confirm; click Yes to delete the file.
For multiple files, hold Control and click each one, or for a range, select the first, hold Shift, and select the last one.
Delete a file with Terminal
You may not be using Raspberry Pi OS, in which case you can delete a file using a simple Terminal command.
Open Terminal from the Task Bar or by accessing the Applications Menu > Accessories. Enter the command “rm” followed by a space and then the file name. Hit Enter.
To delete multiple files, enter “rm” followed by each file name separated by spaces and hit Enter.
Important note: You will not be asked to confirm or see a response after using this command. So be sure that you want to permanently delete the file. Unlike the Trash bin, you cannot restore a file you delete with the “rm” Terminal command.
Wrapping it up
Removing files you no longer need on your Raspberry Pi is a good maintenance task. Just like on your Mac, ridding yourself of unwanted files keeps your storage space open for things you really need.
What tips like this do you have for new Raspberry Pi users? Share them below or with us on Twitter!