About Linux - for curious Windows users
It just so happened that even on Habré many have a very vague idea of the OS Linux family.
The purpose of this article is to tell the most popular language about the features and differences of Linux from Windows for those who did not deal with it at all.
I have been using Archlinux freely for several years now, loading Windows only "to play around". This article talks about things that I found out empirically, poking around like a blind kitten. If at the time I would have come across just such information in exactly this form - it would save me at least 2 years, during which I switched from Windows to Linux.
Almost quote from Lurkmore :
The cornerstone of working with linux systems is “From Understanding to Action,” while on Windows, “I know where to click / where to put a tick, I do it.” In other words, in order to do something, you need to understand how it is arranged inside.
Thesis number 1 - you MUST own the work with the system from a text console!
“Clean” Linux (the base system) in any distribution looks like DOS - black screen, text mode, a blinking cursor is waiting for input. When you come across this for the first time, you sit and think: “Damn, what should I write?”
Modern user-friendly distributions give the illusion that the user does not need a console. Good uncles, they say, have already taken care of everything. Here is a wallpaper for you in FullHD-resolution, here is a program for setting parameters - know check the boxes, everything is like in Windows ... To avoid unnecessary holivars, I will make a digression at this place.
There are Linux users who never fail. Ubuntu is being upgraded from one major version to another, starting with Ubuntu 1.0, and so on. Guys, do not write anything in the comments about the uselessness of the console for the user, go better admire the rainbow that the pink ponies are pooping in your world.
In my world, Linux crashes and breaks. No, everything’s okay if you just run the programs and use them. But then suddenly the moment comes when you desperately need to, say, change open firewood to proprietary ... well, or just upgrade the system. And here, if the stars got up unsuccessfully, you get a broken system and a text console as the only way to interact with it. And (the worst thing) - such garbage tends to happen regularly .
My experience is that at such moments, the Windows user acts as he is used to, obeying the usual ideology. First comes the attempt to “fix”. Windows-ideology requires that you find on the internet a discussion of a similar problem and its solution, and then repeat all the actions that led to the solution of the problem . Bottom line - the user thoughtlessly drives incomprehensible commands to him. Sometimes it even helps, more often it doesn’t: the contents of the commands need to be modified for specific conditions and a specific local machine, but there is no knowledge for this. As a result, the next logical step is reinstalling the system. Believe me, I know what I'm talking about - I broke and reinstalled Ubuntu more than 10 times ... of which about a third after the spontaneous death of the system during the update process, without correlation with hand curvature.
Studying the system device and working with it from the console is akin to the well-known “lose day - fly in an hour”. To fix the problem in this case is much faster than reinstalling, not to mention that it becomes much easier to “not break” :) In addition, the difference completely disappears - you are sitting at the computer locally or through a remote SSH session. Believe me, this feeling is worth a lot.
Thesis No. 2: user-friendly distributions for studying the system are not suitable.
The developers of such distributions carefully create an interface graphic layer designed to reduce the interaction of the user and the system to thoughtless mouse clicks. Technically, this layer can be a completely enchanting pile of crutches - on bash, python, perl ... the most complete hell for a beginner trying to understand the logic of the system. In addition, the sane documentation (if any) is lost among forum posts of the form “to get A, enter in console B, and in the settings, click button C”
For training, technically minimalistic distributions with high-quality and detailed documentation are best suited. Those, for example, are Gentoo and Archlinux. Personally, I recommend the latter - simply because in my case it worked. After a couple of years of ordeal with Ubunta, just a couple of months with Arch promoted me to comprehend Linux 10 times further.
There are several reasons for this:
- The technical minimalism of the system greatly facilitates its understanding.
- High-quality, detailed documentation facilitates the learning process.
- Leaving the “graphic comfort zone” is very conducive!
The last point is worth noting especially. Ubuntu with its graphical interface does not add any motivation to poke around the console. Another thing - when initially there is only a console and the strongest motivation to “configure this graphical interface already” - there’s simply nowhere to go, you have to master the documentation and acquire knowledge.
Windows and Linux: fundamental differences
1. File system
- On Linux, logical drive volumes are not assigned letters. Instead, one of them is assigned as root, and the rest are connected to the specified folders inside it. All paths begin with a slash, without any C drives:
- All system files are dumped in the root file system, and are divided into directories by type / purpose. Relatively speaking, all the settings are located in / etc, the executable files are in / bin and / usr / bin - and for all this good a normal user (not an administrator) has read / execute access only, and this is not always (when it comes to system services )
- File extensions on linux are completely optional. Whether the file is executable is determined by a special mark - by the type of mark “hidden” or “archive” in Windows. Executable files without extension in linux - the norm of things!
- There is no special mark on linux that a file is hidden. Instead, names with a dot at the beginning are used, and file managers already allow you to turn off the display of such files. That is, the file /home/user/.bashrc is hidden. The point in this case is part of the file name!
- A regular user has full access only to his personal folder, which is usually located in / home /% username%. Similar to drive D: on Windows, a separate partition is often connected to the / home folder. Thus, all user data is located on a separate partition (or even a physical hard disk).
- All user (non-system) programs, if necessary, save some of their data or settings, do this only in the home folder of the user from whom they are launched - simply because only in it they have the right to write.
- The very concept of “file” in Linux is a little different, broader. There is a so-called “Device files”. For example, / dev / sda is usually a hard drive (although it may be a flash drive), and / dev / sda1 is the first partition of this hard drive. Hence, tricky maneuvers are possible, such as dd if = / dev / sda1 of = / home / user / backup - the command will copy the entire first partition of the / dev / sda drive by byte into the backup file in the user's home directory. There is a so-called “Symbolic links” - in the file manager they look like a regular file, in fact they refer to another file, and they do not take up disk space. That is, there can be one executable file and a bunch of symbolic links to it in different places.
2. Package manager and the concept of “package”, installation of programs.
- Programs are installed only from the administrator account. During installation, all files related to the program (for example, Firefox) are “spread out” on the root file system - settings common to all users will go to / etc, executable files to / usr / bin, and icons and various resources like graphics and sounds - in / usr / share / firefox. In this situation, the user, in principle, can not know where he has what exactly lies. The package manager is responsible for this. For example, the “Firefox” package includes a bunch of files. When installing a package, the package manager will decompose them on the file system, and upon removal, it will delete them accordingly.
- Another important function of a package manager is to satisfy package dependencies. For example, Firefox requires the libjpeg library to work. This means that during installation, the package manager will automatically install the libjpeg package, and upon uninstallation, it will be removed if it is not required by any other package.
- A package manager usually has a database with all the packages available, and it has search tools on this database. Therefore, installing programs in linux is incredibly simple - the first team we search for the exact name of the package using the database keywords, the second one we set. No need to climb sites, search and download something. If I need to install skype in Arch, I type pacman -S skype and press ENTER, and in a minute I have Skype installed. Firefox is necessary - I am writing pacman -S firefox . Etc. In another distribution, the command and syntax will be different, you may need to specify the address of the repository - the principle itself is unchanged.
- Never, never even try to download and run anything through a browser, like on Windows! Only if you fully know what you are doing - but then why are you reading all this?) Downloading and running a file is part of a completely foreign (even hostile) ideology for Linux. Programs must be installed through the package manager. Point.
- Never use the “configure && make && make install” method to install a program. Every time this happens - in the world with a painful death, a dozen innocent kittens die. This set of commands will collect the program from the source, and then scatter its files through the file system without the knowledge of the package manager. This is a violation of the normal logic of working with the system. Do not do this))
- Perhaps I’ll add here one more thing. Very often you can see persistent tips "do not work as an administrator", and there is a reason that is not entirely obvious to Windows users. The fact is that typing a command in the console is fraught with the danger of typos and accidental clicks. The situation is quite real when you are going to delete a folder, start writing a path to it and accidentally hurt ENTER. Linux has no habit of asking, “Are you really such a fool? y / n "- he just does. Therefore, under the root to recruit teams have to be extremely careful. In Windows, of course, there is no such problem.
3. Graphical user environment
- The entire graphical environment of the user is a collection of application programs. Historically, for a Windows user such concepts as “Desktop”, taskbar, system tray, volume control, clock and calendar, “Start” menu, access to network settings from the tray are an integral part of Windows. In Linux, all of the above is implemented by separate programs. Moreover, for each task from the above list there is far from one program. As a volume control, I can put volumeicon written in C, or volwheel in python
- The basis of the graphical environment are the following programs:
- X-server, or simply “X”. A program that receives data from the user (from input devices) and basic window management, minimizing and maximizing them. It is called “server” because it provides “network transparency”: for Linux, there is no difference in how a user logged on to a graphical session, either locally or remotely. A kind of RDP as basic functionality, simply put.
- Window Manager, aka WM. It is engaged in rendering elements of the window interface, plus (depending on the tricked out) providing a number of other functions. Some WM allow you to set the desktop background, some add the functionality of the “system menu”. Sometimes the simplest (to have) window manager - TWM - is installed with the X server. Terrible as God's sin, straight from the 70s.
- Window decorator - sometimes the functionality for window decoration, the ability to change the design theme is carried out in a separate program
- Composite manager - also happens as part of WM, or as a separate program. Its task is to shift the rendering of the interface to the video card. Technically, the principle is simple - each rendered window is a separate texture in the memory of the video card. And they can handle textures, add effects and distortions, project onto a plane in space, change translucency and overlay them on top of each other for many years.
- Interface elements: taskbar, tray, network manager, system menu, program for setting desktop wallpaper
- Basic application software - file manager, terminal emulator (so that console commands can be written in a beautiful translucent window)
- Preset “sets” of selected elements of the graphical environment, programs from the list above, are called “Desktop Environment”, or DE. The most famous are DEs like Gnome and KDE, the heaviest and most fatty ones. There are also XFCE and LXDE. Installation is often implemented by installing the so-called meta-package - the package itself does not contain files, but as a dependency requires the installation of the entire set of programs that make up DE: WM, decorator / composite manager, file manager, and so on
- It is also possible (and often reasonable) to collect the environment from “pieces” to your liking - select WM separately, separately file manager, and so on
After a little self-education, getting from a text-console graphic system takes place in one command. In my case, I type:
pacman -S xf86-video-ati xorg-server openbox tint2 nitrogen lxterminal xcompmgr wicd-gtk volumeicon .
This is the command to install all the packages listed:
xf86-video-ati is the open-source driver for my video card
xorg-server is the “X”
openbox is the lightweight WM with the system menu (like “Start”)
tint2 is the taskbar with a tray where minimize application
nitrogen allows you to set the desktop background
lxterminal - my favorite terminal emulator
xcompmgrthis is the simplest composite manager, adds translucency and shadows
wicd-gtk is a network connection manager that hangs in the
volumeicon tray - volume control
After that, from the graphical environment, through lxterminal, I install everything else I need for life: browser (s) , file manager, video and audio codecs, player, libreoffice, gimp and more)