this post was submitted on 02 Mar 2024
58 points (87.2% liked)
Linux
48008 readers
1462 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
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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).
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!
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.
There is a simple trick, as a basic user, do not ever run your (gnome) file explorer as root and if a permission error (requiring "escalation") pops up you shoud double check what you are doing.
I think most graphical file mangers also keep most of the weird/important/system folders away from user and you have to directly navigate to them.