I have limited space left on my partition, and I just realized that my ~/.fonts folder is almost 1GB. How should I move it to another partition without any problems?

  • 1
    Is the other partition going to be always available and mounted? Or is it on an external drive? – Andrea Lazzarotto May 29 '17 at 12:10
  • @Andrea Always available and mounted (mounted at startup). – Abhishek Divekar May 29 '17 at 12:30
  • 3
    Do you really need 1GB of fonts, though? Unless maybe you're a graphic designer or something and you really need them, maybe you should do some cleaning up... – fkraiem May 29 '17 at 12:36
  • My problem isn't with storage space, it is with the particular partition my install is on. I was playing around with a new desktop environment, and I liked it enough to make it my primary workhorse. Unfortunately, I didn't have the foresight to keep extra space for all my program files. – Abhishek Divekar May 29 '17 at 12:40
  • @abhidivekar Please check my answer – Ali Razmdideh May 29 '17 at 12:46

Yes you can move it to any partition that you want:

mv ~/.fonts /path/that/you/want

Then edit /etc/fonts/fonts.conf file and add your directory to this file:

sudo nano /etc/fonts/fonts.conf

So add your path to the <!-- Font directory list --> section in that file:

    <dir prefix="xdg">fonts</dir>
    <!-- the following element will be removed in the future -->

| improve this answer | |
  • 5
    "without disrupting features?" So... why mv and not cp, then change fonts.conf and then delete it? The mv can "disrupting features". – Rinzwind May 29 '17 at 12:27
  • @Rinzwind Thanks for your reply, I use mv because he says that " have limited space left on my partition" So this partition must be changed. / " then change fonts.conf and then delete it?" No I haven't say that I say "just edit this .conf file by nano" – Ali Razmdideh May 29 '17 at 12:32
  • @Rinzwind I think its because of my bad english. So I use "edit" word instead of "change" – Ali Razmdideh May 29 '17 at 12:34
  • Okay I used this method and, after a restart, it seems to work fine. I'm going to accept it. – Abhishek Divekar May 29 '17 at 12:48
  • @ali76 they can copy to an external partition, change the file, then remove the old directory, which would be the 'better' method. – Thomas Ward May 29 '17 at 16:48

The method with editing /etc/fonts/fonts.conf will add the new font path to the font search list for all users. This may or may not be what you need.

If you only want to set this up for one user and not share the new directory with other users, you don't even have to gain root privileges: just make a symlink to your new path in place of the original path:

cp -r ~/.fonts /new/place/for/your/fonts
mv -v ~/.fonts{,.bak}
ln -sv /new/place/for/your/fonts ~/.fonts
rm -r ~/.fonts.bak

This will copy your current ~/.fonts directory to the new place, rename the original directory, and then, in place of it, create a symbolic link which points to that new font path. After this the renamed original directory is removed.

The rename-and-link approach above is meant to reduce time of unavailability of the ~/.fonts/ directory (to address your without disrupting features request). You can use mv as in the other answer if you don't need this. The main idea here is to make a symlink instead of editing system-wide font settings.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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