this post was submitted on 02 Mar 2024
3 points (100.0% liked)

Linux

47237 readers
3343 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

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.

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.

top 16 comments
sorted by: hot top controversial new old
[–] [email protected] 3 points 6 months ago

Other people already answered the question, I just want to say that this question was incredibly well asked.

[–] [email protected] 2 points 6 months ago (1 children)

https://serverfault.com/questions/24523/meaning-of-directories-on-unix-and-unix-like-systems

  • /bin - Binaries.
  • /boot - Files required for booting.
  • /dev - Device files.
  • /etc - Et cetera. The name is inherited from the earliest Unixes, which is when it became the spot to put config-files.
  • /home - Where home directories are kept.
  • /lib - Where code libraries are kept.
  • /media - A more modern directory, but where removable media gets mounted.
  • /mnt - Where temporary file-systems are mounted.
  • /opt - Where optional add-on software is installed. This is discrete from /usr/local/ for reasons I'll get to later.
  • /run - Where runtime variable data is kept.
  • /sbin - Where super-binaries are stored. These usually only work with root.
  • /srv - Stands for "serve". This directory is intended for static files that are served out. /srv/http would be for static websites, /srv/ftp for an FTP server.
  • /tmp - Where temporary files may be stored.
  • /usr - Another directory inherited from the Unixes of old, it stands for "UNIX System Resources". It does not stand for "user" (see the Debian Wiki). This directory should be sharable between hosts, and can be NFS mounted to multiple hosts safely. It can be mounted read-only safely.
  • /var - Another directory inherited from the Unixes of old, it stands for "variable". This is where system data that varies may be stored. Such things as spool and cache directories may be located here. If a program needs to write to the local file-system and isn't serving that data to someone directly, it'll go here.
[–] [email protected] 0 points 6 months ago (2 children)

Thanks, this doesn't say anything tho about 2 levels deep in bullet 10. But I get anything in run/user/1000 serves the same purpose.

[–] [email protected] 1 points 6 months ago

The above is accurate, and can be considered accurate for any directory below or at well.

Per /run, it's also mounted in memory, so trying to "declutter" it won't get you anywhere and things will return on reboot.

[–] [email protected] 1 points 6 months ago

In this case, yes anything under /run should not be considered as normal files.

[–] [email protected] 2 points 6 months ago* (last edited 6 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

[–] [email protected] 1 points 6 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!

[–] [email protected] 1 points 6 months ago* (last edited 6 months ago)

/run contains all sorts of virtual stuff, it doesn't persist over a reboot,

I would advise against deleting anything in it as those files are used by programs running as whether user has the ID of 1000 (most likely you)

it contains things such as sockets and lock files so that programs can interact with each other

[–] [email protected] 1 points 6 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.

[–] [email protected] 1 points 6 months ago* (last edited 6 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.

[–] [email protected] 0 points 6 months ago* (last edited 6 months ago) (1 children)

Never touch anything in /run directory.

[–] [email protected] 0 points 6 months ago (1 children)

Thanks! And I will remove it from my search index to restrain from "decluttering". 👌👍

[–] [email protected] 1 points 6 months ago

Don't "declutter" manually. Use your package manager.

[–] [email protected] 0 points 6 months ago* (last edited 6 months ago) (1 children)

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).

[–] [email protected] 0 points 6 months ago (1 children)

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!

[–] [email protected] 1 points 6 months ago* (last edited 6 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.