The Dropbox application keeps a cache folder for efficiency purposes and also if you want to recover a file/files that you accidentally deleted. This folder is located in the root Dropbox folder by the name of “.dropbox.cache”. This cache also serves as a staging area while you are uploading or downloading files through Dropbox. Although this folder is cleared every three days, you might still want to delete the contents urgently for some reason. This is especially useful if you want to remove any sensitive files and even some larger files to free up space on your system. The effect might not be very huge right then, but if you get rid of a very large file, cache clearing can have a significant effect on your storage. This also helps your system perform better and faster.
Note: The time duration of three days for which your files are saved in the cache provides a good retrieval time if you have accidentally deleted any sensitive files and folders from your system.
In this article, we will explain how you can clear the Dropbox cache both through the UI and the command line.
We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system
Clear Dropbox Cache through the Ubuntu UI
The Dropbox root folder, that is usually present in the current user’s Home folder, contains a hidden cache folder named “.dropbox.cache”. This is the folder that we need to empty in order to clear up our Dropbox cache. Open your Home folder in the file manager(Nautilus) as follows:
After you have located the Dropbox folder, as shown above, please open it. By default, Ubuntu does not display hidden files and folders. Therefore you first need to tell your system to display hidden files and folders so that we can view the .dropbox.cache folder. You can do this through the Ctrl+h shortcut. As you do so, you will be able to see the hidden Dropbox cache folder as follows:
Simply open the folder and delete all or some specific files from the folder. The files/folders will no longer be part of your cache now. Deleting all cache items would mean that you have “cleared” your Dropbox cache altogether.
Clear Dropbox Cache through the Command Line
If you prefer using the command line for using Dropbox and even managing files in general, you will be using the Ubuntu Terminal application to clear the cache.
Open the Terminal either through the Ctrl+Alt+T shortcut or by accessing it through the Ubuntu Application Launcher search.
If you want to clear the Dropbox cache all at once, you can do so through the following command:
$ rm -R ~/Dropbox/.dropbox.cache/*
This command will delete all the files and folders in the .dropbox.cache folder.
If you want to delete a specific file from the Dropbox cache, you first need to access the hidden Dropbox cache folder. Here is how you can do it:
From your Home folder, switch to the Dropbox cache folder as follows:
$ cd Dropbox/.dropbox.cache
When you list the contents of this folder through the simple ls command, it will not show the hidden ones for privacy reasons. Since .dropbox.cache is a hidden folder, you need to use the -al flag to list its contents as follows:
$ ls -al
You can then delete the individual files through the rm command.
This was how you can save system space by removing unwanted files from the Dropbox cache, both through the UI and the command line.