Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The .cache directory is full of volatile, non-essential files.

I would like to move it to a more appropriate partition, i.e. faster and not backed up.

I believe that ~/.pam_environment file is appropriate for this but am not sure if is the best or if it is documented properly or working properly.

share|improve this question
How are you preserving /some/other/place/.cache between reboots? If one moves .cache to, say, /dev/shm, when the box is rebooted /dev/shm/.cache is missing and so ~/.cache is dangling symlink. – user257772 Mar 13 '14 at 8:06
Related guide for google chrome here:… – Kzqai Feb 23 at 18:31
up vote 9 down vote accepted

If you don't care about keeping the stuff there across reboots, you can use tmpfs to store the cache.

Set something like the following in /etc/fstab:

tmpfs /home/someuser/.cache tmpfs defaults,size=512M 0 0

Now, your .cache will be stored in memory instead of on disk, though if you have insufficient memory it could end up being swapped out.

A more traditional approach would be to move the directory to wherever you like and symlink it as appropriate:

mv ~/.cache /some/other/place
ln -s /some/other/place/.cache ~/
share|improve this answer
This is working well. I had hoped to use pam-env as it is the "preffered" way, but this works, and if it isn't broke, don't fix it. BTW Chrome is much speedier now! – keepitsimpleengineer Dec 24 '11 at 17:21
~/.pam_environment is for setting environment variables, which has nothing to do with the task at hand. Besides, though some claim that .pam_environment is preferred, I don't think that's necessarily so, considering how few people (according to Google) are using it. .bashrc is good enough for me. – Scott Severance Dec 25 '11 at 1:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.