160

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 rename it to 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.

6 Answers6

165

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.

33

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.

lofidevops
  • 21,912
Rinzwind
  • 309,379
6

This is currently possible as an experimental feature flag. (1)

$ sudo snap set system experimental.hidden-snap-folder=true

The flag can also be disabled by running.

$ sudo snap unset system experimental.hidden-snap-folder

  • This requires a version of Snapd greater than 2.55. (1)
  • You may not get any feedpack from the process, but you can check the output of: snap get -d system (2)
  • Users report that the data is not moved automatically and has to be moved by hand. Eventually all snaps need to be reinstalled. Don't try this on a production system if you are running snapped kernel. (3)
LiveWireBT
  • 29,597
ogtega
  • 61
6

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.

cl-netbox
  • 31,491
-1

To hide from the command line for now, alias ls to ls -I snap --color=tty

This can show the color preference.

-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