Introduction. Large letters, small letters


Any user may be interested in trying out the Linux operating system. That's what happened to me once. There is a lot of literature on the Internet, but the question always remains: “Where to start?” Some saw Linux from friends, some found a video or read articles on the Internet, but all this more often ready-made options. And if you yourself want to install such an OS on your computer, then you will have a lot of questions. The first question that worried me was the choice of distribution...

I rummaged through a bunch of literature, but opinions were divided, and still are. Some are for Debian, others are for Mandriva, RedHat, etc. Currently, there are more than 1,300 builds of the Linux OS, and choosing one specific one makes the hardcore Windows user think deeply. I tried to install different ones, but it was not always possible due to equipment conflicts and simply inexperience. The first successfully installed distribution was OpenSuse 11.1, then Debian. The catch is that these distributions have different file structure, programs and more. This confused me even more, but I continued experimenting until I decided on Ubuntu. This is what we will talk about.

I think it's worth noting that Ubuntu is based on the Debian distribution, which in turn is very popular among system administrators. What does "founded" mean? I'll try to draw a parallel with Windows OS. Imagine an ordinary licensed Windows disk. Introduced? Now imagine any assembly, even the notorious ZverDVD. So, Ubuntu is a “build” of Debian, which has an updated kernel, patches, own programs and repositories. Later I will talk about all this separately. I think it’s not worth going too deep into the differences between Ubuntu and Debian, I’ll just add that this distribution is very popular and new versions of Ubuntu are released every six months (in April and October). And yet, why Ubuntu? Yes, it simply meets the requirements that a novice user sets for a new OS.

  1. Simplicity and ease of installation. I want to insert the disc, install it, watch it, and not have any unnecessary dances with a tambourine (although in future work I won’t be able to do without dancing with a tambourine). I note that when working in Windows you can be simple user and don’t bother yourself with how and what works, and if infrequent problems or difficulties arise, simply turn to knowledgeable and understanding people who can help you. In the case of Linux, you will have to figure out a lot of things on your own and become a “knowledgeable” person yourself. But don’t be afraid, that’s not what you came here for. Be that as it may, you can always ask a question, and we, in turn, will try to help you.
  2. To make everything work. Installed? Here you have a desktop and all sorts of menus and many programs, and a browser, and a package office programs and a network configuration applet (however, we will learn to work without it and configure the network manually). There is even a player, but it cannot play many audio/video formats by default; I will explain later why this is so and how to solve it.
  3. I don't want to lose anything. There are a lot of applications and documents on the Windows OS partition that I don't want to lose when installing Linux. Ubuntu will offer you to divide your hard drive into parts, save Windows or any other OS and install its own bootloader that can boot both Windows and Linux. Modern Linux distributions, considering Ubuntu has a wonderful opportunity - launching from a disk or flash drive without installing it on the computer’s hard drive. Distributions that can do this are called LiveCD / LiveDVD (or “live disk”). I advise you to first try to start the OS with installation disk . This way you will know for sure that a particular distribution can handle your computer’s hardware and there will be no problems during installation. By the way, there is a high probability that when starting Ubuntu with LiveCD You can, by entering the network settings, use the Internet and the network. You will be able to work with text documents and tables. You can view pictures and so on. Just try booting from the disk. Do not forget that working with a LiveCD is still not working in a full-fledged operating system installed on a hard drive, so be prepared for “brakes” when reading from a CD in an attempt to open this or that program.

You can always leave your comments and suggestions for improving, changing or correcting the article in the comments. We work for you!

What's happened Ubuntu? Ubuntu is a modern, full-featured operating system based on the Linux kernel. Translated from the South African Zulu language, the word Ubuntu roughly means “humanity.”

Ubuntu is and will always be distributed absolutely free. But at the same time, installing Ubuntu on your computer you get full set all applications necessary for operation, and you can easily download everything missing from the standard package from the Internet. And there is no catch in this. You can use Ubuntu and all the software available on this system without any restrictions, absolutely free and completely legally. Not only that, you can even download source all components of the system and make your own product based on it.

Ubuntu is supported and sponsored by Canonical, but the community makes a huge contribution to the development of this great OS - ordinary people, who are looking to improve the applications and tools they use. Perhaps someday you will want to help make Ubuntu is the best operating system and take part in the community.

About the resource

The purpose of this resource is to help beginners install Ubuntu on their computer and get comfortable with this system. I will say right away that all articles are written on the assumption that the reader has some knowledge of computers and will be able to distinguish a file from a folder. Although you don’t need any specific knowledge - just general computer literacy.

This resource is a beginner's guide, so if you haven't used Ubuntu before, I recommend that you read each article in order. If you already know something about Ubuntu and Linux in general, perhaps something will seem familiar to you. In this case, you can read the articles at your own discretion; use the menu on the right to navigate. By the way, if you don't feel comfortable reading the manual online, you can download a PDF version.

This guide is by no means exhaustive, but is intended to help you ease into the world of Ubuntu. If you have any questions, please contact the official Russian-language forum, they will always help you there, in addition there is community-created in Russian, in it you can search for the missing information.

A short summary

So what can you learn from this guide? Well, first of all, I’ll tell you how to install Ubuntu on your computer - the only operating system or next to Windows. Next, I'll touch a little on the user interface and basic system controls. And then I’ll try to cover all the necessary basics step by step. using Ubuntu. By the way, many articles contain quite a lot of footnotes. They contain Additional Information or simply various comments on the main content. You may well skip them while reading. They are not necessary for understanding the main material of the manual, but are often useful as clarification of some specific questions that you may have.

I’ll say right away - there are practically no descriptions in the manual specific applications. There is one for Ubuntu great amount programs for every taste and color. And I would really like not to recommend anything specific, but to show you how to find and install exactly what you personally like and suits best.

In general, the purpose of this manual is to teach the reader how to use all the main tools of the system with ease and effectively. I really hope that after reading it, you will be able to work calmly in Ubuntu and easily perform all the actions you need.

The guide describes the long term support version of Ubuntu - Ubuntu 10.04 LTS "Lucid Lynx".

Modern versions of Ubuntu are very different from "Lucid Lynx" user interface and pre-installed programs, so this guide is practically irrelevant for them.

For older versions there may also be slight differences from what is described in the articles, but the general provisions will remain the same. However, I recommend that you always use latest version Ubuntu. In the first article I will tell you where you can get your copy of the distribution.

This article does not cover Linux installation. I assume that the reader has already installed one of the distributions of this OS. However, after successful installation, the user usually has many questions, some of which are answered in this article. In preparing this material, Black Cat Linux 6.02 was used, but everything stated below applies almost unchanged to other Linux distributions (for example, Red Hat or Mandrake).

As you know, you can work in Linux in graphics system X Window or in a text console. Most users prefer to work exclusively with the window manager after installation, but there are a wide range of tasks that can be performed (or are much easier) by working in the console. Therefore, this is where I would like to start this article.
First, a little about setup.

Working with the linuxconf program.
If at Linux installations you have configured automatic start X-ov, then you need to first go to the console. To do this, click Ctrl+Alt+F1. You will be taken to a virtual text console and after entering your username and password you will be able to issue commands shell. To return to the X Window, click Alt+F7. Generally speaking, by default you can work in 6 virtual consoles at once, which is often very convenient (switching between them is Alt+F1...Alt+F6).
In the console, enter the command linuxconf. The system management program will start. Here you can manage users, network connections, file systems, boot and other Linux settings. The program is organized as a drop-down menu. Navigation is carried out using the arrow keys, Enter And Tab. As an example, we will show how to create a new user and define its rights. Let's go to Config>User accounts>Normal>User accounts
A list of users is shown here. Click twice Tab to go to the button Add, then Enter. In the column Login name In the window that appears, enter the name of the new user. The remaining fields can be left untouched for now. After pressing the button Accept you will be asked for your password twice - and a new user has been created! I advise working as root as little as possible, since his mistake can cause the most fatal consequences for the system, while regular user can usually damage only its own files.

Linuxconf is also convenient for describing file systems. For example, let's look at how to "teach" Linux to see the Windows partition. Let's go to Config>File systems>Access local drive. A list of file systems described in the file appears /etc/fstab. To add to it new entry, click Add. In the column Partition we write /dev/hda1 for 1st section hard drive, /dev/hda2- for the second, etc. If you want to add the first section second hard disk - write /dev/hdb1, second - /dev/hdb2. In the column Type click Ctrl+x and select the type from the list file system (vfat for Windows). In the column Mount point dialing /mnt/win. After clicking Accept answer positively to the question about creation new point mounting Now in the catalog /mnt you will have a catalog win, which should contain the contents of the Windows partition, but if you go into it, you will find that it is empty. In order to see your Windows partition in it, you need to give the command in the console mount/mnt/win. Among other Linux OS configuration programs, I would also like to note setup, which easily allows you to configure your keyboard, mouse, sound card and X Window.
Working in the console is quite convenient, but to navigate through directories it is much more pleasant to use Midnight Commander.After calling the command mc Norton-like appears on the screen file manager, which is almost as powerful as DN or FAR. Personally, I also use mc to set access rights to files and directories, since it is much more convenient for me to use than the utility chown.

Installing applications under Linux.
For Linux, applications are delivered primarily in the form rpm-packages or .tar.gz-archives. Installed rpm-package by command rpm -i package name
Program rpm It will create all the directories necessary for the application to work and put the files there. If you already have a previous version of the application installed, then you need to provide the key on the command line --force to replace the old version. rpm-packages are available on the CD of most Linux distributions, as well as on many ftp servers on the Internet. If the extension rpm-file looks like .src.rpm, then this is the source code of the application, and before running it you need to compile it yourself (usually such packages contain instructions on how to do this). To remove a package from the system, issue the command rpm -e package name.
If you received the application as a packaged file with the extension .tar.gz, then to unpack it you need to give the command tar xzvf archive name. Next, you need to find a file with instructions for installing the application, which may vary in each specific case.
By the way, to view the contents of archives without unpacking them manually, it is convenient to use Midnight Commander. When you press Enter on the archive name, you enter it like a regular directory.
I would also like to mention one useful program - fsck. If, for example, while working in Linux you had a power cut or accidentally pressed reset :-), then when you boot the OS will ask for the root password and you will be in single-user mode. In it, the file system is mounted for read and execution only. To repair a damaged file system, issue the command fsck-Aa. After it's finished, give the command reboot, and after a reboot everything should work as before.
To view documentation for any Linux command on the command line you need to specify: man command_name. The standard documentation viewer will launch and tell you about the usage, switches and configuration files of this command. If the information is not enough, then in the catalog /usr/doc you will find complete manuals to most Linux programs.
Finish review useful programs, launched from the console, I would like document processing utilities. If you have ever tried to read text files created in DOS or Windows in Linux, you must have encountered the problem of transcoding. The fact is that Linux uses KOI-8 encoding, which is different from DOS or Windows. A utility is used to convert text recode. For example, we will show how to convert a file myfile.txt(Windows encoding) in KOI-8:
recode -wk myfile.txt myfile.koi
After executing this command, a file will be created in the current directory myfile.koi, which can be viewed with any text editor under Linux. Key -wk specifies conversion options (Windows - KOI8). There are 14 more possible keys. A list of them with a description can be obtained by issuing the command recode without parameters.
We are also interested in the program mswordview. It is designed to transform doc- files ( Microsoft Word) V HTML- a format that is supported by many editors on Linux. Now you won't need to keep Windows and MS Office on your hard drive just because you need to work with doc-files. By the way, the famous free office suite StarOffice, which runs on Linux, also works great with Microsoft Office files.
Now let's move on to working with X Window. If you don’t have X running by default, then run the command in the console xinit. If everything is configured normally, you will be taken to the graphical console. Next you need to give a command to start the window manager (for example, kde For KDE, or icewm For IceWM). These two operations can be replaced by one - a script startx. If none of the methods discussed above works, it means that your Xs are most likely configured incorrectly, and then you can try to fix it with the program setup discussed above.

There are quite a few window managers for Linux. Some of them claim to be similar to Windows 95 or MacOS, but most still have the original interface. In this article I will talk about KDE- in my opinion, this is the best environment for work. I don’t want to offend amateurs Gnome, but on my machine it runs much slower, which doesn't suit me.
After launching KDE, you are presented with an environment that at first glance looks like Windows. There is a button in the lower left corner TO, similar to a button Start in a well-known OS. At the bottom of the screen there is a taskbar, a clock, and a keyboard indicator. Well, in general, everything is like THERE. But this apparent similarity between the KDE and Windows interfaces will wear off pretty soon. You will see how much more convenient it is to work with the first one.
To begin with, I would advise running the script KAppFinder(its shortcut is on the desktop), which will add to the menu Personal those applications that are not included in KDE (for example, utilities Gnome, Netscape Navigator).
In order to configure appearance KDE, right-click on an empty space on the desktop and select Display properties. Here you can change the background, screen saver, fonts and display styles of KDE applications.
Shortcuts on the desktop are created similarly to Windows 98, i.e. via menu item New in the pop-up menu. This article looked at how to use the command mount need to mount others sections of hard disk, previously described in the file /etc/fstab using the program linuxconf. In KDE, you can create shortcuts on your desktop that correspond to these sections. To do this, click right button mouse on an empty desktop field to call up a pop-up menu. Choose New>System Device File. Give it a name (for example, "Windows"). Go to the tab Device. Here in the column Device set the section (for example, /dev/hda1), and in the graph Mount point- the directory that was specified in linuxconf (in this article - /mnt/win). Count File system leave unchanged. After clicking OK, a “Windows” shortcut will appear on the desktop. Now, in order to get to this partition, you will no longer need to issue the mount command every time. At double click on the shortcut, mounting will occur automatically and you will see the contents of your Windows partition. By the way, I would like to dwell separately on the program that allows you to view catalogs. It's called kfm and launched from the menu System>File Manager. With this application you can not only manage files (like Microsoft Explorer), but also view html-files (which is very convenient when reading documentation), as well as “climbing” through ftp- archives, as if on your own hard drive. The fact is that kfm has a built-in quite powerful browser that supports different encodings text, working through proxies, cookies and a lot of other stuff.

We are also interested in the application kpackage- Package Manager. It allows you to install and uninstall Linux applications without resorting to a console utility rpm described above. On the left side of the screen there is a list of installed packages, divided by category. When you select one of them, its description is shown on the right side of the screen.
Now a few words about typing. There are “numerous” editors for this noble occupation in Linux. Some (for example, ed, vi) have remained from THOSE times when people worked at “stupid” terminals and could only dream of X-s. Additionally, Linux comes with a very powerful text editor Emacs, however, more than one article can be written about it. Now I will talk about two editors for KDE - kedit("Simple text editor") and kwrite("Advanced Editor"). I use the kedit editor all the time. It is small, fast and convenient. Allows you to check spelling, align text, open pages directly from the Internet and write them back. Your message can be sent immediately by mail. By the way, a little advice: in order to view the contents of a file in Windows encoding without using the utility recode described above, open this file in kedit and then to the menu Settings>Font select any font whose name ends with "1251". After this, you will be able to see the contents of the file, but you are unlikely to be able to change it.

Editor kwrite intended for typing program code rather than text. It allows you to mark up syntax, make bookmarks and much more that you cannot do kedit. In my opinion, one of its main advantages is the ability to rollback (similar to Undo on Windows).
Finally, I would like to note the program console. This is a graphical terminal emulator. Launched from X and functions as a virtual console. IN console you can enter commands shell or run Midnight Commander. Personally I use console For quick launch in KDE of the required applications. I don’t know about you, but I find it much more convenient to type on the keyboard kmmail, kedit or netscape than clicking on drop-down menus or shortcuts. Just don’t forget to put a sign after the application name "&" , otherwise the console will be locked until you exit it.

As the reader response shows, interest in Linux-based solutions is very, very high, at the same time, the level of training of administrators in this area leaves much to be desired. Evidence of this is the endlessly repeated simple questions in the comments. In many ways, this is a consequence of the fact that our instructions can be followed “verbatim” and get a working result. But there is also back side medals, this approach does not provide for the emergence of systemic knowledge, leaving knowledge of the subject at a fragmented level.

Yes, in addition to practical materials, we always try to publish reviews devoted to any technology in general, or make extensive theoretical digressions, so that the reader has minimum required knowledge. However, they all assume that the reader has basic knowledge system in which it works.

But what about those who are just taking their first steps? Unfortunately, there is some snobbery in the IT community, they say, why talk about it, everyone already knows it, or “Google to the rescue,” forgetting that each of us was once a beginner and looked at a black screen with mystical horror Linux consoles, absolutely not understanding where he ended up and what to do.

As a result, a beginner, faced with the first difficulties, is forced to go look for knowledge elsewhere, and it’s good if such a place can be quickly found. Therefore, we decided to release a short series of materials in which accessible level outline the basics of administering Linux systems, literally explaining “well-known things” on your fingers, experienced users may miss this cycle, or they can read it, at the same time updating their knowledge.

So you've decided to become a Linux administrator...

Let’s paraphrase Mayakovsky a little “I would go to Linux admins, let them teach me”, this is exactly how things are in most cases. There is a need, there is a desire, there is basic set knowledge of working with Windows systems - all this will be useful when working with Linux systems. It’s much worse if any component is missing, then it’s probably worth thinking about wrong choice professions.

Immediately about what you need to forget once and for all. These are "religious wars" and "religious fanaticism." It is equally bad to deny the capabilities of Linux systems, as it is to extol them, trying to transfer everything that is needed and not needed to Linux. Remember - the operating system is a tool, a good specialist takes the most suitable one for each task, a fanatic will hammer nails with a microscope, because “religion does not allow him” to pick up a hammer.

Even more, the operating system itself has no value; it is just an environment for launching and executing some services. Without software, the system is dead. Let's take the BeOS clone Haiku as an example, well, we installed it, we looked at it - it's cool... And then what?

So, you have decided to become... First of all, be ready to accept new things, in particular a new approach to administration, trying to forget about existing habits for a while. For a long time, your main tool will be the console.

For a Windows administrator accustomed to graphical tools, this may seem difficult. But one truth should be firmly understood - the console is the only full-fledged Linux administration tool and does not at all mean that the system is limited in capabilities or inferior. On the contrary, the command line allows you to perform many tasks much faster and easier than graphical administration tools.

But there are graphical administration tools, another reader will say, there are different panels, or you can install a graphical shell. It's possible, but not necessary. Why? Take a close look at the diagram below:

Linux, created in the image and likeness of UNIX systems, is a full-fledged system without a graphical shell; moreover, we can start, close or even change the graphical shell without any impact on the performance of the system and even without rebooting it. We ended the Gnome session, launched KDE, and then went out to the console. Therefore, all system management tools are designed to be used in command line mode. And all panels and graphical tools are just an add-on over them.

Windows was developed for a long time using a fundamentally different technology; the graphical shell was placed at the core of the system and for a long time even ran at the kernel level (Win 9x family). Therefore, all administration tools were originally graphical, and command line tools complemented them rather than replaced them. Anyone who has been involved Windows recovery, knows that the capabilities of command line tools there are significantly limited and are intended primarily for system recovery, and not for its administration.

The situation began to change with the release of PowerShell and Core versions Windows Server. Despite the fact that today the graphical shell continues to play a significant role in Windows systems, administrators now have an alternative tool in their hands - the PowerShell console, which allows you to fully administer Windows in command line mode. At the same time, the capabilities of PowerShell immediately gained popularity among specialists, as they allow you to perform many tasks faster and easier than graphical tools.

And the command line mode gives unlimited possibilities in creating your own scripts and scenarios that allow you to perform complex sequences of actions in automatic mode or according to schedule.

After this, it seems to us, you will have to look at the Linux console from a completely different perspective. As for panels and graphical tools, there are significant differences from Windows systems. IN Windows graphic tools are a complete alternative to PowerShell. IN Linux graphic the instruments are an add-on over the console, in fact using the same instruments, but through an additional layer. Therefore, we categorically do not recommend using various types of panels and other graphic tools, at least until you master the console. After this, you can decide for yourself whether you need a panel or whether you can do everything easier and faster through the console.

Infatuation with panels at an early stage of getting to know the system leads to the fact that system administration skills will be replaced by skills in working with the panel, which is fraught with problems when the panel for some reason turns out to be inaccessible, but you need to work with the system. This can be compared to the fact that a person who has learned to drive a car with a manual transmission will switch to an automatic without any problems, but a person who initially only knows how to drive an automatic is unlikely to be able to drive a car with a manual without additional training.

If you haven’t changed your mind about becoming a Linux administrator, then let’s move on and look at the differences in the system architecture.

Kernel and drivers

The basis of any operating system makes up the core. There are several different kernel architectures, Linux, like the vast majority UNIX systems, uses a monolithic kernel, Windows, on the contrary, uses the concept of a microkernel, although the Windows architecture is not truly microkernel, it is generally accepted that Windows uses a hybrid kernel.

A feature of a monolithic kernel is that all hardware drivers are also part of the kernel. Previously, when the hardware was changed, the kernel had to be rebuilt; today, monolithic kernels use a modular design, i.e. dynamically allow you to load the necessary modules responsible for this or that functionality. Those. Having added a new device to the system, we must dynamically load the corresponding kernel module, and if there is no such module, then working with the device will be impossible. As a solution, we can build the module ourselves, but in this case the module will be compiled under current version kernel and when changing it, the module will need to be recompiled.

In microkernel and hybrid architectures, drivers, although they can work at the kernel level, are not part of it and do not depend on the kernel version. Therefore, we can update the kernel without problems or use the same driver for all versions of systems with general structure kernels. For example, in Windows for the entire family of modern operating systems, from Windows Vista before Windows 8.1, the same driver is often used.

This does not mean that Linux is worse in this regard; a different architecture provides for different approaches. In practice, this means only one thing - you need to be more careful when choosing equipment for servers, trying to ensure that all major devices are supported by the kernel of your distribution. This is especially true for network cards. It will be very unpleasant if after each kernel update you have to run to the server room, connect a monitor and keyboard to the server, and reassemble the kernel module.

In fact, there is no such thing as a driver in Linux systems. The hardware is either supported by the kernel or it is not. The undoubted advantage of a monolithic kernel is that it is self-sufficient. If all equipment is supported - you set it and forget it, now is the time to remember the situation when there is no driver for Windows network card and the disk is lost.

File system

We will not touch upon specific file systems; there should be no problems here; if the administrator worked with Windows systems, then he knows what a file system is and how FAT differs from NTFS, so to understand the difference between ext3, ext4 and, say, ReiserFS for him it won't be much of a problem. Let's talk about the fundamental differences. Unlike Windows, the Linux file system is hierarchical. It starts from the root, which is indicated by the sign / (slash), and has a tree-like structure. In this case, it does not matter at all that individual parts of the file system may be located on other partitions or even physical disks.

Let's look at another diagram.

In Windows, each partition has its own file system and its own letter. All paths to files and folders begin with a letter, i.e. from the root of the section. So if we had a DATA folder on the first physical disk, on the second logical partition, then the path to it will accordingly be like D:\DATA, if we want to move it to second hard disk, then let it change to E:\DATA. In some cases, this is terribly inconvenient, since the path must be changed in all places where it is used, and there are even corresponding utilities.

In Linux the approach is radically different. It's time to get acquainted with the term mount point, which means the file system location where the storage device is mounted. For example, we want to move user home directories to separate section, as in the diagram above, for this we need to mount the second logical partition of the first physical disk sda2 V /home. Then transfer all user data there. This will happen absolutely transparently for the system and programs, as they used absolute path, let's say /home/andrey/data, so they will use it. We added another disk and want to move the directory there /var? No problem, stop the services using the directory, mount sdb1 V /var and transfer the data, start the services.

Everything is a file

Another fundamental principle that is inherited from UNIX systems. In Linux, everything is a file: devices, disks, sockets, etc., for example, opening /var/run we will see pid files corresponding to each running service in the system, and in /dev files for each device connected to the system:

What does this give? We won’t go into details, but let’s look at a few simple examples. Let's say you need to create an image optical disk. In Windows we need specialized software for this, in Linux everything is simpler, a CD-ROM is a block device, but at the same time it is a file, a block device file. We take the appropriate tool and copy the contents of the device file to ISO file image:

Dd if=/dev/cdrom of=/home/andrey/image.iso

We want to replace HDD? There is nothing simpler, we copy the contents of one block device file to the file of another block device:

Dd if=/dev/sda of=/dev/sdb

And you don't need any Partition Magic.

Another situation is that some software is urgently looking for the library lib-2-0-1.so, and we have a compatible but newer library, lib-2-1-5.so, what should we do? Create a symbolic link to lib-2-1-5.so with the name lib-2-0-1.so and everything will work. Because everything is a file and a symbolic link is also a file type. Now try to slip Windows application lib-2-0-1.lnk instead of lib-2-1-5.dll...

Ifconfig

will display information about network adapters systems:

Now let’s remember that everything is a file, including the display device (screen), so we’ll simply redirect the standard output stream instead of the screen to the file we need:

Ifconfig > ~/123.txt

After which the command output will be saved to file 123.txt in the user’s root directory:

Threads and conveyor

In the previous example we touched on the standard output stream. Linux has standard I/O streams for all processes. stdin, stdout and error output stream stderr. What does it mean? At a minimum, the process of data exchange between various processes standardized. This allows you to create pipelines where the standard output of one command is passed to the standard input of another. For example, we want to see a list installed packages in the system, in particular squid packages. There is a command for this purpose:

Uh... What is this and how can I understand something here? Information about all the packages installed on the system quickly flashed on the screen and all we can see is the “tail” of this output:

But we don’t need the entire output of this command, we are only interested in squid packages. Therefore, we will direct the output of this command to the input of another, which will already select and show what we need:

Dpkg -l | grep squid

This is a completely different matter!

Moreover, the pipeline can be as long as desired; the result of one command can be transferred to a second, from the second to the third, etc. Another example from life. You need to get all the lines of your configuration file squid, but without comments and empty lines, so that, for example, you can post it on the forum or send it to a friend. You can, of course, copy everything, but it’s unlikely that anyone will want to help you by scrolling through the canvas standard file squid.conf, most of which is comments and examples. Let's make it simpler:

Cat /etc/squid3/squid.conf | grep -v "^#" | sed "/^$/d" > ~/mysquid.conf

And this is what we got:

Simple and clear, all options are at your fingertips. This became possible as a result of using a pipeline of three commands, the first outputted the contents of the file into the stream, the second selected all lines except comments, and the third deleted empty ones; we sent the result to a file.

Large letters, small letters

Linux, like UNIX, is a case-sensitive system. And we must remember this! Because, unlike Windows, myfile.txt, Myfile.txt And myfile.TXT- that's three different files. For the sake of compatibility with other systems, you should not abuse this and store files whose name differs only in case, and in good form The use of only lowercase letters in names is considered.

Extensions and file types

IN Windows systems the file type is determined by its extension, if we rename exe file V jpg, then it will not start, and the system will try to process it as a picture. In Linux, a file type is determined by its content and the extension is used solely for compatibility with other systems or for user convenience. The ability to execute a file is ensured by setting the appropriate attribute. So on Windows, to make the script executable, you had to change the extension from txt on bat, in Linux, to do this you need to make the file executable. Misunderstanding of this point leads to situations where a novice administrator does not understand why his script myscript.sh is not executed. Actually an extension .sh it is necessary only for convenience, so that it is immediately clear that this bash script Shell, but for it to work, it needs to be given the executable attribute, and it can be called anything, even myscript.pupkin-vasya.

Too shy to ask...

Excuse me, another reader will say, there is so much to remember: command syntax, keys, options, etc., etc. Here you need to buy a reference book or always keep the Internet at hand... Not at all, it’s enough to remember the names of the commands, it’s just not difficult, according to the traditions established in UNIX, commands are given short and convenient names. And everything else can be asked from the system. Contrary to popular belief, Linux systems are well documented. You can view the syntax and keys of any command by running it with the key --help, and since descriptions usually do not fit on one screen, you should redirect the help output to the utility more, which will display information screen by screen. Let's say we are interested in the team grep:

Grep --help | more

More detailed information can be obtained using the command man:

Man grep

Unfortunately, the information is in English, but knowledge of technical English is at least at the level of “reading with a dictionary” necessary requirement to the system administrator. Does the last screenshot remind you of anything? That's right, OpenNET.

Without in any way belittling the importance of this resource, we can say that by adopting a team man and basic knowledge of English, you will visit OpenNET much less often.

Conclusion

We hope that after reading this article, novice administrators will have a better understanding of the structure of Linux systems and their fundamental differences from the Windows they are used to. This will make it possible in the future to correctly interpret the information received and put together a holistic picture of the functioning of the system, which will no longer be a “black box” and commands “a Chinese letter.”

We would also like to point out that in our examples we only used standard tools, which once again shows the wealth of administration tools, despite the fact that they only work on the command line. Let's return to the last example - the output of the squid config, and now think about how this could be done using graphical tools and how long would it take?

There is no need to be afraid of the command line; Linux puts in the hands of the administrator a very powerful set of tools that allows you to successfully solve all emerging problems without involving third party tools. When you master at least some of these capabilities, then Linux will no longer seem complicated to you, and the console will no longer seem gloomy; on the contrary, even with a graphical shell, you will launch the terminal, plunging into a familiar and understandable environment, realizing that it is you who control the system and are doing exactly what you want, and not what the developers of the next panel had in mind.

  • Tags:

Please enable JavaScript to view the

We have collected for you the 10 best video courses, the study of which will help you get started with Linux and understand the features of this system.

1. Linux for beginners

Let's start with a video tutorial on Linux, which talks about the system as a whole and how to get started with it. This video course is more suitable for those who are just starting their acquaintance with Linux.

2. Series of lessons “Learn Linux”

This video course is designed to get you started with Linux. It will help you install this system on your PC. The audience of this video course is people who have heard a little about Linux.

3. Course of lectures on Linux administration

Detailed video course on Linux administration. He examines various issues: from the purpose of this system to the administration of MySQL. Suitable for both beginners and experienced Linux users.

4. Bash Programming

An excellent English-language tutorial on learning Bash programming. Will help you understand a very important aspect of working with Linux, but it is best to start studying this course after watching one of the previous ones.

5. Linux administration

This course will provide you with basic knowledge of Linux and help you obtain the LPIC-1 certificate. If you want to reinforce your knowledge with the LPIC-1 certificate, then this course is definitely for you.

6. Linux Basics

A short video course on the basics of working with Linux. If you want to start with this video course, I recommend that you familiarize yourself with installing Linux, since this video course covers aspects of working directly in the system itself.

7. Command Line Basics

A small but very useful English-language tutorial on working with command line Linux. In this video course you will learn such simple operations as creating and deleting files or directories. Suitable for anyone who wants to expand their knowledge of working in Linux.

8. Video course on GNU/Linux by Vladimir Mozhenkov

Video course on the basics of working with GNU/Linux, simple and clear. This video course is aimed at both beginners and experienced Linux users.

9. Series of lessons “Your path to the world of Linux!”

This video course talks about working with things like the Cron system scheduler and the path variable. I advise you not to start with this course until you have read one of the previous ones.

10. Linux Administration

Last on our list is a video course that explains in detail all aspects of working with Linux. This video course will expand the knowledge of experienced users; the course is designed for those who are already somewhat familiar with Linux, but want to know more about it.







2024 gtavrl.ru.