ZWOS Episode 1: What you always have to remember when using linux

ZWOS of course is the acronym for Zoltan's Word on Sunday, and while I can't even promise or commit to a word every Sunday going forward, I thought that it was appropriate for a number of boring reasons.
These are going to be small linux fundamentals, snippets, things that teach new users something, and make seasoned users smile and think back of stuff.

So, Episode 1: What you always have to remember when using linux... part 1

"EVERYTHING IS JUST A FILE"

This is something that every linux users always falls back to when solving problems or issues, and new users typically fall off their chair when they discover this principle and suddenly realize how bloody simple linux suddenly is, and then they become very angry when then immediately afterwards realize that they've wasted so much time and energy wrestling with problems on other platforms where this is not the case, or where this is not transparent to the user, hence why there is Blackwater-level security in Richmond, but that's another issue.

What does it mean exactly?
1.
It means that everything that you can imagine that has something to do with the operating system, is nothing but a file, whether that be hardware or software or data, binary or not.
It means that a hard disk, is just a file. A graphics card, is just a file. A USB port, is just a file. A keyboard, is just a file. The Steam client, is just a file. A complete spell check solution in language X, is just a file. Etc... The entire operating system, all the applications, all functionality and all hardware, is entirely defined by a structured collection of files, whereby this structure is very similar between distros, with some small differences for really old distros that still use SysVInit for example, but nothing really too difficult.
And suddenly, problems seem far less intimidating, because all you have to do to solve a problem, is to remove that problem from the right file.
2,
It means that the entire functional reality of the operating system, is nothing but a file. Want to know how exactly the graphics card was connected... it's file. Want to know exactly what power profile that particular USB port applied... it's a file. You can basically immediately access all data, however granular and detailed you want, immediately, and know exactly what happened in every part of your hardware and software.
And suddenly, you find yourself far less searching for problems, the entire system talks to you openly, is transparent and easy to control.
3,
It means that the entire system, and it's subsystems, hard- and software, is basically "portable". That means that files can be copied and moved, and the system does not break, and the files moved outside to another linux environment, will function just the same as in the previous environment. It means that when you install the Steam client, that proprietary piece of 32-bit-only retarded spyware piece of crap, is nicely confined to where you allow the folder for it, typically /.steam in the /home folder, which means that the piece of crap is confined to userspace, and can't touch your system, and if you want to confine it from even communicating with other files within userspace, you can run it in an unprivileged container (LXC container), and it will be absolutely confined to it's own files without exception, and without system overhead.
Another example of the portability is that you can rip out the GPU of a running linux system, and nothing will happen, the linux system will continue to run, because only some files were affected, the system will just do what it does, and when the gPU is plugged in again, the GPU will just work again, no restart required. If the GPU was just on full load for something like OpenCL filter rendering or something when it was ripped out, maybe, just maybe, the display server might restart, which means that the screen will turn black for like 2 seconds, but the system will not stop and the running tasks will not be stopped. The worst that can happen is that some files need to be fetched or created or moved, because everything is just a file, even a graphics card or a display server.
4,
It means that the entire evolution of the system is just a matter of file versioning. Which means that a journalling file system will always be able to rollback the entire system by moving just a handful of bytes. It also means that data can be entirely recovered by moving proportionally few bytes, and that means that snapshotting of both system and data partitions is of course very inexpensive and super fast.
5,
It also means that there are never driver problems. All drivers are already in the underlying Linux kernel, so that in the actual operating system that is built upon that kernel, drivers must not be installed and uninstalled, the only thing that needs to be changed for a complete driver change, is a line of text in a file. Erratically reinstalling stuff, installing stuff downloaded from websites of ill repute and from dodgy repos, it's all completely unnecessary... just find the file that defines the piece of hardware you're having issues with, tweak a line or two, and it's solved. And to be honest, the fact that this would be necessary, would mean that it would have to be some pretty dodgy hardware, because all the hardware in the world pretty much has drivers in the Linux kernel.

In practice?
New users should get accustomed to the linux system directory tree. That - by it's structure - already gives a very good overview of how everything fits together. There are only a handful of directories, pretty much the same for every distro. Once you get to know these, you know how to immediately find the right file to get to the deepest deep of the settings you want to influence. There actually are less system subdirectories in linux than there are subcategories in the simplified settings in WIndows 10... and in Windows 10, whatever you set there doesn't matter anyway, whereby in linux, you can manipulate even the finest detail of your system, hardware and software.
It's remarkably easy to understand and astonishingly logical, and it will lead to an immediate understanding of other *nix systems like BSD, UNIX, OSX, Android, iOS, etc...

Why everyone should learn it?
Because when that day comes that you are sent to recover vital sensor data from a crashed Mars Explorer, and the thing only has 20 seconds of power left, you want to know where to find the data on that linux based robot...
Because you realize that the Mars Explorers are exactly the same as the small kit robot you've built with a RasPi at home, except the Beluga caviar version of every single part instead of the mac-and-cheese version, but you could totally control the Mars Explorer with your laptop without problems.
Because it really is one of the principles of open source software design and use: it's a principle you cone back to several times a day, a trusted friend of a principle, a principle that keeps you in control.

21 Likes

Really looking forward for this series,
I think these concepts can be better understood if you could provide a small excercise, at the end for the learner to practice.

Actually, this morning I just quickly posted this because there were some threads with questions, whereby the posters would benefit greatly from this principle. It gave me the idea of posting elementary things like that, things experienced users have forgotten basically but use every day. It would be nice for the community to post examples and exercises that make use of this, whilst keeping it simple, I would like this to be aimed primarily at beginners, and not be a tutorial, because a tutorial might teach someone how to deal with a particular problem, but doesn't help understanding the principles of how those problems are tackled, and how easy it often is.

Fair enough, really appreciate the effort, and its also perfectly in time for me as I started reading Linux : The complete Reference

This was entertaining and helpful. Would love for those to become weekly / bi-weekly. Thanks for the good read.

Would it be worth adding this as a blog entry so it buids into a resource that maybe more easily accessed than a forum thread?

Enjoyed & subbed - thanks.

@Zoltan Neat!

Im using Linux for about 2 1/2 Months now and it helped my understanding of Computing in general a huge bump.
And it is really easy.

I find it very strange to operate Windows and MacOS after this time just because of all the little stones in your way of fixing a tiny little file somewhere. In Linux its 1 command line.

Linux - There is a Command Line for EVERYTHING

Thank you for sharing, this is a really interesting read, I had no idea that linux was structured that way. as a windows dev and being used to an OS where everything is hidden, this is really interesting.

I think it would be cool to see something like this kind of being like a online class from start to finish. One distro walking you step by step from beginning to intermediate to advanced topics.
Covering potential problems and how to resolve them etc.
Like a free udemy course.

2 Likes

I don't think that's even remotely close to truth. Have you not seen the amount of people on the forum complaining about their GPUs not working properly or at all. "nVidia driver for this card can't do this. AMD driver in such and such distro can't do that. Everytime I try to do xyz it shits the bed....etc"

My Canon Pixma MG3150 can't even print in colour when using Fedora. In windows It does print in colour.

Not working? Nope, not working with full performance for proprietary applications, yes... big difference!

I've seen my X session conmpletely fall apart and have a fit due to GPU problems, but the system stayed up and I was able to SSH in from my laptop and cleanly shut it down etc.

Windows with the same iffy GPU blue-screened, so kudos to Linux. Now Apple OSX on the other hand used to have kernel panics, but it's a different beast to linux despite its *nix heritage.

Nice series @Zoltan, thanks for taking the time to write :-)

EDITED: Spellings...

1 Like

Thank you for this it really helped me understand more about linux. You should not only turn this into a blog on the forums but maybe think of an independ blog that everybody can access. Can't wait to follow this.