71

I'm not particularly fond of apps cluttering my $HOME directory with their own files or directories. It's rarely a problem, because most apps have the courtesy to hide their data by prefixing it with a dot or conforming to the ~/.config standard. But not snap.

Q1: Have I misunderstood this directory? Is ~/snap really a directory which I'm supposed to enter and access on a daily basis on a par with ~/downloads, ~/pictures, ~/work, etc?

Q2: In any case: Can I move it e.g. ~/.snap? I can't find anything like /etc/snap, /etc/default/snap, or ~/.config/snap to tweak things. I tried export SNAP_USER_DATA=$HOME/.snap but it didn't work.

  • how can a single file clutter your home folder?? – doug Mar 30 '18 at 20:44
  • 16
    It can't. But I don't have just this one file in my home dir, I have quite a lot. And many a little makes a mickle. Furthermore I have configured my system so that not $HOME/Desktop but $HOME directly is shown on my desktop because it makes more sense to me this way, but this also means that unwanted directories and files here will be even more visible and annoying. And then there's this whole thing about apps should hide their configuration files. – Stephan Henningsen Mar 31 '18 at 22:08
  • 19
    Or thinking about it this way: Suddenly someone walks in, puts a box on your table, and walks out again without a word. Don't you think that at some point you'd find that box got in you way and would want to remove it? =) I for sure like to decide what goes on my own table, and similarly what files are (visible) in my $HOME. – Stephan Henningsen Mar 31 '18 at 22:20
  • 11
    Trololo? Run this in your home folder and you'll see what happens if every program just created one single folder in your home dir: for f in .*; do g="${f#.}"; echo "How can a single file clutter your home folder? It's just ${g}." ; echo ln -sv "$f" "${g}_"; done This is actually harmless to run, but you should remove the last echo there and I think you'll "buy my line of thought". – Stephan Henningsen Apr 5 '18 at 7:49
  • 10
    Internet people love to tell you how your question is wrong rather than just answering your question, don't they? – Greg Sep 19 '18 at 8:25
84

So..

A1: No; ~/snap is not supposed to be accessed manually on a daily basis; it's a settings directory.

A2: No; ~/snap cannot be changed; it's cluttering your home dir by design.

However there is already a bug report on this issue, but it's currently only prioritized as wishlist. If you're affected by this bug (and you are if you have a ~/snap =) then let the kind developers know, and encourage them to fix the bug by raising its significance:

  1. Go to the bug report
  2. Login to Launchpad (top right corner).
  3. Click This bug affects N people. Does this bug affect you? (near top left)
  4. Click Yes, this bug affects me

In the meantime do like @Rinzwind suggests and simply hide the directory from Nautilus by typing this in a shell:

echo snap >> ~/.hidden

Alternative get completely rid of snap by downright uninstalling everything related snap, as described here.

  • 21
    Done. Thanks for pointing out that bug report. Believe me, if a snap directory appears in my $HOME when I install a snap, I can confidently say that I won't ever use this technology. If, as I suspect, this becomes a concrete piece of the Ubuntu landscape, I'll have to rethink my decades-long commitment to the platform. Crazy decision. – Scaine Aug 29 '17 at 19:06
  • 1
    Just voted as well - seems like something might be happening. I'll repeat from Stephan's comment in the bug report: "It's 2017, come on." – Larpon Oct 5 '17 at 8:16
  • 3
    It's 2019, and still no progress on this. Come on! Purging snap right now. – Murphy Apr 9 at 8:33
20

Q1: Have I misunderstood this directory? Is ~/snap really a directory which I'm supposed to enter and access on a daily basis on a par with ~/downloads, ~/work, ~/tmp, etc?

It is a regular directory but is not really meant for user access. It is managed by the snapd utility. It seems likely it will be renamed to ~/.snap at some point. Or less likely to ~/.local/share/snap.

Q2: In any case: How do I hide it?

When it is renamed it will be hidden automatically.

To hide from the desktop shell for now, create a text file called ~/.hidden and put the word "snap" in it. This will hide the "~/snap" folder from Nautilus.

To hide from the command line for now, alias ls to ls -Isnap. Now "snap" will be ignored when ls-ing.

  • 1
    "alias ls to ls -Isnap" Note that it will hide "snap" wherever you run ls, not only in the $HOME directory. The real solution belongs to snap. – jrouquie Sep 29 '18 at 10:47
  • This solution does not show show the snap directory, but it also ignores the color preferences I have saved for different file types, i.e. there is no way to visually distinguish between files and directories. Any tips? – Nicholas Cousar Apr 8 at 14:35
5

All snap applications themselves (in case they are installed) are located in the /snap directory.
/home/user/snap contains your personal settings of those snaps (in case they are installed).
The /home/user/snap folder was created once when you've installed the first snap package.

In case you don't have snap applications installed, you can delete the /home/user/snap folder.
If you install and use new snap applications, the folder will be re-created - this is done by design.
As snapd is "work in progress" - maybe another default directory can be selected in the future.

  • 3
    If you desire a configuration option for this, I'd recommend filing a bug against snapd itself, here:- bugs.launchpad.net/snappy/+bugs – popey Feb 12 '17 at 16:43
  • 1
    @popey Way ahead of you =) I even found out someone already filed a bug report. I'm answering my own question with instructions on how to encourage the developers to fix it. – Stephan Henningsen Feb 12 '17 at 17:14
-3

I think I actually have a solution for this! Well kinda. There's a Nautilus extension called "Nautilus Hide" that will hide files and folders without changing their name. It basically writes the name of the folder to a file that Nautilus uses to see if a folder should be hidden or not.

Works like a charm!

https://github.com/brunonova/nautilus-hide

  • 1
    I'm unsure what to make of this. While this does answer half of the question's title, it doesn't address any of the two questions in the body. You describe another work-around to hide a directory in Nautilus though (what I see is) a user-friendly plug-in for users who aren't comfortable with shell one-liners (ie. echo snap >> ~/.hidden) ... but do know their way around git, cmake and sudo make install. I guess this adds something new to the table. – Stephan Henningsen Aug 16 '18 at 6:31
  • Sometimes you want to hide and unhide a folder without having to pull up your CLI yah know? It's faster to right click on something and say hide than it is to open a program and type out a command. At least for me. – David A. French Aug 16 '18 at 22:07
  • 1
    You say "sometimes", but this question is all about one single directory. And you still have to "pull up the CLI" to do the work you propose, and you're need to install git to pull it, and the whole build system to compile it, and finally run sudo to install it. This is far more complicated. At least for me. – Stephan Henningsen Aug 17 '18 at 6:15
  • Cool, Don't really see why it's worth a downvote though. Seems to not fall within the community guidelines. My solution isn't wrong and may be considered useful to someone else who views this page. – David A. French Aug 20 '18 at 21:06
  • Your solution to add snap to ~/.hidden was already explained in two existing answers; only difference is that your approach is way more complicated. I don't find that useful, I wouldn't recommend this approach to anyone, hence -1 to usefulness. – Stephan Henningsen Aug 29 '18 at 5:41

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.