My main question is about /run/user/1000:

  • Should I avoid touching it?
  • Could I delete it?
  • Is there something wrong with it?

Background: I'm fairly new to Linux and just getting used to it.

I use fsearch to quickly find files (because my filenaming convention helps me to get nearly everything in mere seconds). Yesterday I decided to let it index from root and lower instead of just my home folder.

Then I got a lot of duplicate files. For example in subfolders relating to my mp3 player I even discovered my whole NextCloud 'drive' is there again: /run/user/1000/doc/by-app/org.strawberrymusicplayer.strawberry/51b78f5c/N

Searching: Looking for answers I read these, but couldnt make sense of it.

  • https://unix.stackexchange.com/questions/162900/what-is-this-folder-run-user-1000
  • https://forums.linuxmint.com/viewtopic.php?t=412850 So if its a bug with flatpaks I'm inclined to delete a certain db at ~/.local/share/flatpak/db

Puzzled:

  • Is this folder some RAM drive so my disk doesnt show anything strange? Because this folder doesnt even show up at the root level.
  • Are these even real? Because the size of it (aprox 370 GB) is even bigger then my disksize (screenshot).

Any tips about course of (in)action appreciated.

  • FrostyPolicy@suppo.fi
    ·
    9 months ago

    I'd say a good rule of thumb for a beginner is not to touch anything outside of their own home directory. Modifying or deleting files in other locations is an easy way to break your system.

    • CarbonScored [any]
      ·
      9 months ago

      Honestly as a power user for 10 years I very, very rarely come across a time it's a good idea to touch anything outside the home directory.

  • MonkderZweite@feddit.ch
    ·
    edit-2
    9 months ago

    Only thing i saw here are general answers. /run/user/1000 resp. $XDG_RUNTIME_DIR is a tmpfs (somt. like a ramdisk) created by PAM (pluggable authentication module) on login, 1000 being your user id. It is more restricted in security and size than cache and should be used for small files where quick access or security matters. A common example are sockets.

    You can delete it, it will just be regenerated next log in, but your very session will run into trouble, you should log out after (if you don't just get booted out, that is).

    And yeah, like others said; this is not Windows, you don't have to, and shouldn't, clean up anything outside your home dir.

  • forwardvoid@feddit.nl
    ·
    edit-2
    9 months ago

    Something to realise when starting with Linux is that everything is a ‘file’. Sockets, processes, input, output etc. That’s very different from Windows and part of why scripting on Linux is so powerful. You can interact with anything.
    So some directories are filled with things that aren’t necessarily files but look like it. Someone else posted a whole list, just realise that under those directories/paths shouldn’t be messed with unless you know what it’s for.
    Generally when you’re getting used to Linux, /home/$user (aka ~) is where you put personal things. The rest is managed by OS and applications, don’t worry about it.
    Edit: spelling

    • Ramin Honary@lemmy.ml
      ·
      edit-2
      9 months ago

      @joeldebruijn@lemmy.ml the /run/user/1000 directory is an in-memory file system of a fairly small size. The operating system creates it for you to store certain things that are for your user account only. The permission settings on this directory forbid any other user on the system (except for "root") to see what is inside. This makes it safe to store secret information that only you should know.

      One typical example of something stored in this directory would be your plain text (unencrypted) password database if you use a password manager. No other user but you (and "root") can see it, and it is in-memory only so it is not accidentally copied to your persistent memory (HDD or SSD disk drive) where it might be removed and read by hackers if someone steals your computer from you. At the same time, any program running on the system that was launched by you and only you has access to your passwords so you don't need to remember passwords for everything. (Actually it is a socket to a server containing your unencrypted password database in memory, it is probably not actually a file in that directory.)

      Other things that go in this /run/user/1000 directory are socket connections to the desktop bus (allows for things like copy-and-paste or drag-and-drop to work between programs), socket connections to your audio mixer (allows you do things like to listen to music and do video chat at the same time), and a record of what external media devices you have connected to the computer which you are using via GVFS, and so on.

      Also, the number 1000 is your user ID number assigned to you by the operating system. If you create other accounts, they will have ID 1001, 1002, and so on, and each of them will have a directory with that number created in the /run/user directory for them when they login.

    • Joël de Bruijn@lemmy.ml
      hexagon
      ·
      9 months ago

      When I let fsearch index from root, it counted 1.9 million files, which baffled me a lot. Before knowing the things in this thread. A typical windows install can have 50k ~ 100k files, but .... 2 million I thought it was insane.

      But in this context its something like if LibreOffice Calc had an API and upon start it registers a filesystem with a 'folder' for every worksheet and a 'file' named A1, A2, B1 .... for every cell. Not real I know but a novice way of understanding.

      • forwardvoid@feddit.nl
        ·
        9 months ago

        Something like that indeed.
        Every active network connection, every process, every piece of hardware and others are in your file system.
        Then there’s also the possibility for linking to a file and links take up no space, but can show up like files.
        You can use a command like ‘stat’ to get more information about a file (or directory).

  • blobjim [he/him]
    ·
    edit-2
    9 months ago

    The most important thing to realize about the "file system" in Linux is it does a lot more than just persist your documents and app data. You shouldn't index your root directory because almost everything other than your home directory is some kind of Linux distro/application-specific directory that is often not a normal directory stored on a storage device. If you run the mount command with no arguments, every line of output is a separate file system, mounted at some specific directory of the current "mount namespace". Kinda confusing, but every process in Linux has a mount namespace that has a list of mounted file systems, often that namespace is shared between many/most processes, such as your terminal shell. Most of the file systems will be virtual i.e. not representing anything in storage. For example sysfs (always mounted at /sys), proc (always mounted at /proc), devtmpfs (mounted at /dev), etc. are all completely virtual and are ways for system services and applications to access state and devices exposed by the Linux kernel. They should never be indexed, treated as normal files, or modified by the user.

    That's probably even more confusing, sorry. But the gist of it is, the only directory on your system you can really count on actually being stored on disk and always available to you is your home directory. Basically everything else exists as an implementation detail of the operating system and software applications.

    If I were you, I'd stick to only indexing your user home directory. Indexing /usr or /tmp or /etc or whatever is like indexing C:\Windows and C:\Program Files, except even weirder since at least on Windows those are actually files stored on disk whereas in Linux they may not even be actual files (although most of them in /usr and /etc are actual files on disk).

    • Joël de Bruijn@lemmy.ml
      hexagon
      ·
      9 months ago

      Ow ... this ... just realise its my Windows "legacy-skills" to unlearn ...

      Although its indeed more confusing it does explain rather well I cant just "port" my habits from Windows to Linux (Debian Gnome in my case).

      Also it gave me hints for more research. Thanks!

      • blobjim [he/him]
        ·
        edit-2
        9 months ago

        You may also encounter some contradictory information out there too. For example, I said don't modify stuff outside of your user home directory, but some people will advise to modify stuff in /etc. Although I would never do this on a desktop distro (usually /etc is set up the way the distro maintainers want it, and anything you need to modify will have another more user-friendly way to modify it), especially one where you're mostly just trying to run desktop applications. It might make sense to modify stuff in /etc on a server installation since that's where a lot of configuration for different daemon processes (i.e. system services but also server applications) and even software libraries goes.

        That's one of the good and bad things about linux. There is some information about all this stuff on the internet if you can find it, but it is also an information overload and you're basically learning about the internals of the operating system with all the associated complexity. That's one thing that threw me off about linux initially (I started getting into this stuff only a couple years ago), almost everything you learn about linux is basically an implementation detail. There are Windows equivalents to most things in linux, but when you use Windows as a desktop user you don't really think about them unless you're developing an application using Windows-specific APIs.

        Windows has things like COM (linux equivalent is gobject and dbus), Services (linux equivalent is systemd services), Win32 API (this is a million things in Linux like glibc and a bunch of other system libraries, just check out how many files are in /usr/lib or /usr/lib64), Registry (dconf/gsettings) and so on.

        There's also unfortunately no real clean break between "stuff anyone should know" and "stuff programmers and linux distro developers should know". A lot messier than something like iOS or Android where if you're a normal user you basically don't see the OS implementation or hints of it at all.

        Trying to hide the implementation details is also why the GNOME Files app shows you some documents folders on the left but makes it more difficult to view the root directory or even the current file path. Which was very frustrating and confusing for me, coming from Windows.

  • Alex@lemmy.ml
    ·
    9 months ago

    Don't delete it. It's an area of the filesystem where the current user session data is kept. This includes things like sockets to communicate with other session components and lock files. It's usually hosted on a ram disk so takes up no space in the system and goes away when you shutdown your machine.

      • FrostyPolicy@suppo.fi
        ·
        9 months ago

        Files in /run will be (re)created (and removed) at runtime if/when needed by programs that need them. They pose no problems and don't persist between reboots.

  • Joël de Bruijn@lemmy.ml
    hexagon
    ·
    9 months ago

    Thanks everybody, I learned a ton these 2 days. Like a ' jump' in understanding. Not only the specific answer to my concrete question but also on a conceptual level as well.

    The thing that makes Linux next level for me now is the extra 'abstraction layer'.

    Thing is, for me, digital files always were as tangible as the analog object they represent. A digital document is as 'real' as a paper document. An email as real as a letter. But untill now files where 'real' digital artefacts. And thats ... a bit different with 'virtual' files, sort of.

    Anyway, new concepts to explore which is great!

  • MajinBlayze [any, he/him]
    ·
    edit-2
    9 months ago

    You're using flatpak, right? Flatpak uses "portals" to provide access to other parts of your system. When you open files in flatpak apps, you'll see this folder used for those.

    These shouldn't actually take up any meaningful space, and I wouldn't delete anything unless you're experiencing an issue.

      • Alex@lemmy.ml
        ·
        9 months ago

        It is most likely another filesystem mounted where the flatpak can see it. A terminal tool like ncdu or even du will take an -x option to not cross file-system boundaries. That will show the true usage of everything bellow where you call it (even though it is a ramfs so not persisted across reboots).

  • piefedderatedd@piefed.social
    ·
    9 months ago

    Nice that you are using FSearch :) I would put more excludes in it when you really want to index / In fact, apart from /home I would not index anything else than /etc /usr/share/doc and maybe /var/run/media or /media (depending on which Linux distribution you are using, for example Arch Linux will use /var/run/media and Ubuntu will use /media for removable devices).