Operating systems: Fundamentals of the UNIX operating system. Linux Basics Basics of working in the unix operating system

UNIX operating system

Official date of birth of the operating system UNIX considered January 1, 1970. It is from this moment that any UNIX system counts its system time. This is a very long time for an operating system. Today, despite the emergence of many other operating systems built on different principles, UNIX firmly occupies its place among the leaders.

The main characteristics of UNIX, which allow us to understand the reasons for the longevity of this system, include the following.

The system code is written in high-level SI language, which makes it easy to understand, change and port to other hardware platforms.

Despite the variety of UNIX versions, the entire family is based on a fundamentally identical architecture and a number of standard interfaces.

UNIX has a simple but powerful set of standard user interfaces.

The UNIX Unified File System Interface provides access not only to data stored on disks, but also to terminals, printers, magnetic tapes, CDs, networks, and even memory.

A large number of different applications have been developed for the UNIX system - from the simplest text editors to powerful database management systems.

In general, the UNIX operating system can be represented by a two-level model, as shown in Fig. 8.1
.

In the center is system kernel. The kernel directly interacts with the computer hardware, isolating application programs from the features of its architecture. The core includes programs that implement a set of services provided by application programs. Kernel services include I/O operations, process creation and management, process synchronization, etc. The next level of the model is system services that provide the user interface of the UNIX OS. The scheme of interaction with the kernel of both applications and system tasks is the same.

UNIX Operating System Features

The UNIX operating system interacts with the computer's hardware and software resources to perform following functions:

    equipment management;

    resource management;

    system monitoring;

Equipment management

Application programs do not have the ability to control computer hardware directly. Only the operating system performs hardware management functions, allowing applications and other programs to access peripheral devices (while eliminating the need to know the specifics of managing such a device). The concept of program independence from a specific hardware implementation embedded in the OS is one of important elements ensuring the mobility of the UNIX operating system, which allows it to be widely used in a variety of hardware configurations.

Resource management

UNIX OS manages the distribution of computer resources among many users performing many tasks simultaneously, often working with different objects, supporting multitasking and multi-user operating modes. Multitasking allows one user to run multiple programs simultaneously, while the CPU and RAM are shared among multiple processes.

Multi-user mode allows multiple users to work simultaneously by sharing computer resources, including expensive peripherals such as printers or plotters. This mode of operation turns out to be more cost-effective than combining several machines with one user each.

User interface support

This is a means of providing interactive (providing dialogue) interaction between users and a computer system.

Modern versions of the UNIX operating system support several interface types: command line, menu and graphical user interface.

Command line usually convenient for users familiar with the functions and teams systems. When working with this type of interface, the user at the “prompt” (the default for the user is a dollar sign) enters each command from the keyboard. This interface does not provide an overview of the system, but allows you to execute any command on the system. Programs that provide such an interface are called command shells(shell). There are a lot of command shells: Bourne shell (sh), Bourne Again Shell (bash), Korn shell (ksh), C shell (csh), Debian Almquist shell (dash), Zsh, etc. The most common is bash.

Typically used by beginners or users who need to make some installations in operating system. Often such an interface functions as a guide: it allows the user to select a function from a list (menu) that will be performed by the system. Typically, menus are organized as layered text, offering the user multiple choices. An example of such an interface is the sysadm program, which helps system administrator Perform system configuration and setup work.

Graphical user interface aimed at both beginners and advanced users. It provides several ways to interact with the computer: overview of system objects depicted by icons, execution of commands by selecting a graphic image (icon) on the display screen using a “mouse” or a tracking ball device. UNIX OS provides X.desktop as a graphical user interface for working with special X terminals, or the X Window system for working with regular graphical terminals.

Providing remote access to computer network

UNIX OS provides users with access to resources of other computers running in computer network. The operating system contains a set of network applications that allow you to establish a connection with a remote computer, register in a remote system, transfer data between network computers, and use e-mail. UNIX supports networking NFS file system(Network File System), which allows you to use operating system commands to access the file system remote computer.

Components of the UNIX operating system

As mentioned above, an operating system is a set of programs that provides functions for managing processes in the system and implements the interface between users and system hardware. UNIX system contains three main components: command system, shell and kernel.

The UNIX operating system contains several hundred commands that perform tasks of organizing and processing data and managing the user's environment. The commands themselves are programs that perform specific functions, usually requiring minimal input, and are executed relatively quickly. Most of them are available to all users, but there are commands that are available only to the system administrator, who is a privileged user. Some commands that allow interactive input of information when executed are sometimes called utilities. Examples of utilities include the vi text editor and the mail command for managing e-mail.

Shells. Shells are commonly referred to as interactive programs that provide a user interface to the operating system kernel. The shell becomes the user's active process from the time he logs on to the system until he logs off. These programs are command interpreters (sometimes called command processors).

As noted above, the UNIX operating system usually uses several shells.

Restricted shells (rsh and ksh are subsets of the Bourne shell and Korn shell) are designed for users who need to restrict access to the system.

Core. The system kernel is the core of the operating system, which provides basic functions: creating and managing processes, allocating memory, and providing access to files and peripheral devices.

Interaction of application tasks with the kernel occurs through a standard system call interface. The system call interface defines the format of requests for basic services. A process requests a basic kernel function through a system call to a specific kernel procedure. The kernel executes the request and returns the necessary data to the process.

The core consists of three main subsystems:

    1) process and memory management subsystem;

    2) file subsystem;

    3) input/output subsystem.

Performs following functions:

    creating and deleting processes;

    distribution system resources between processes;

    process synchronization;

    interaction of processes.

A special kernel function performed by the process scheduler (scheduler) resolves conflicts between processes in competition for system resources.

Provides memory allocation between processes. If there is not enough memory for all processes, the kernel moves parts of the process or several processes (usually passive ones, waiting for some events in the system) to a special area of ​​​​the disk (the “swap” area), freeing up resources for running (active) processes.

File subsystem provides a unified interface for accessing data located on disk drives and peripheral devices. It performs file placement and deletion operations, performs file data write/read operations, and also controls file access rights.

Performs requests from the file subsystem and the process control subsystem to access peripheral devices. It interacts with device drivers - special kernel programs that serve external devices.

UNIX system access

To establish contact with a UNIX system, you must have:

    terminal;

Obtaining a registration name

Registration name is the name that the UNIX system uses to check whether you are an authorized user of the system when you request access to it.

You must enter your login name every time you want to log in.

There are several rules for choosing a registration name. Typically the name length is between 3 and 8 characters. It can consist of upper or lower case letters, numbers, and underscores, but cannot begin with a number.

However, your registration name may be specific to your application. Examples of valid names:

Communication with a UNIX system

If UNIX is installed on a personal computer, you can log in directly to it using a text-based virtual console. But other access options are also possible.

Let's assume that the terminal is connected directly or via a telephone line to a computer. Although this section describes a typical login procedure, these instructions may not apply to your system because... There are several ways to log into a UNIX system via a telephone line.

To communicate with the system, you must turn on the terminal.

If it is directly connected to the computer, a prompt will immediately appear in the upper left corner:

If a personal computer configured to operate on a network using the TCP/IP protocol family is used as a terminal, it is necessary to establish a connection with a computer on which UNIX OS is installed. This can be done in several ways, for example using the telnet network application found in Windows operating systems or using Internet access tools. Please note that this is an insecure protocol that is practically no longer used today. A modern alternative is Secure Shell (SSH).

Example.

A personal computer with Windows NT OS configured for network operation is used as a terminal. You must register in a UNIX system.

Required inputs and actions:

    to establish communication with UNIX OS you need to know network name remote computer or its IP address (for example, 192.168.2.19);

    find the telnet application on your personal computer and launch it;

    in the application window that opens, select the Connection menu item;

    enter the IP address of the remote UNIX system (for example, 192.168.2.19);

    set the terminal characteristics as desired.

Registration procedure

When the login: prompt appears, enter your login name and press . For example, if your login name is all30123 , then the login string would look like this:

    login: all30123

If you make a mistake when entering your login name, you can correct it by using the @ symbol or the key .

Remember that the case of the characters you enter is important. The names all30123 and ALL30123 belong to two different users.

The system now prompts you to enter your password. Enter your password and press the key . If you make a mistake while entering, you can correct it using the key or the @ symbol. UNIX does not display your password on the screen for security purposes.

If the login name and password are valid on a UNIX system, the system may display the current information and then a command prompt.

When you log in, your terminal screen will look like this:

    login: all30123

If you make a mistake while logging in, UNIX will display a message:

    login incorrect

It will then give you a second chance to log in with a login: prompt. The screen will look like this:

    login: all30123

If you have never logged into a UNIX system, your login procedure may differ from the one described above. This can happen if the system administrator has a procedure for assigning temporary passwords to new users. If you have a temporary password, the system will force you to choose a new password before allowing you to register.

By forcing you to choose a new password solely for your use, the system provides greater security.

Login procedure:

    You make contact; UNIX systems display the login: prompt. Enter your login name and press the key .

    UNIX systems display a password: prompt. Enter your temporary password and press the key .

    The system will inform you that your temporary password is no longer valid and prompt you to select a new password.

    The system will prompt you to enter your Old Password. Enter a temporary password.

    The system will prompt you to enter your new password. Enter your chosen password.

The password must match following requirements:

    each password must consist of at least 6 characters;

    Each password must contain at least 2 alphabetic characters and one number or special character. An alphabetic character can be typed in either large or small case;

    Each password must be different from your login name. Capital letters and their corresponding small letters are equivalent;

    The new password must differ from the old one by at least three characters.

Examples of valid passwords:

To check, the system asks you to re-enter your password. Enter your password again.

If you enter a new password a second time differently than the first time, the system will inform you that the passwords do not match and will prompt you to repeat the registration procedure again. When the passwords match, the system will display a hint.

The following screen displays the described procedure:

    login: dko30123

    password:

    Your password has expired

    Choose a new one

    Old password:

    New password:

    Re-enter new password:

User identification

When a system administrator registers a user on the system, two components of identification are associated with the login name: user ID(user ID - UID) and group id to which it belongs (group ID - GID).

The username is associated with a unique number. The system uses it as a tool in various UNIX security mechanisms, such as protecting files or executing privileged commands.

Any UNIX OS has one special superuser with UID = 0, which is usually associated with the name root. This means that the user has all system privileges.

The group name is also associated with a number, which usually refers to a group of users united by common tasks, for example, department employees, students of the same stream, etc. This number is also used by security mechanisms in the system. If the user must work with data from other groups, this identifier is associated with the names of the other groups.

All registration information about system users is stored in the /etc/passwd file.

In modern versions of UNIX OS, encrypted passwords and related system information are stored in the /etc/shadow file, the structure and purpose of the fields of which are presented in Fig. 8.2
.

Data records for each established group are contained in the /etc/group file, the structure and purpose of the fields of which are presented in Fig. 8.3 .

The structure and purpose of the fields in the /etc/passwd file are shown in Fig. 8.4
.

Input conventions

When interacting with a UNIX system, you must be aware of input conventions. The UNIX system requires you to enter commands in small letters (with the exception of some commands that have capital letters). Other conventions allow you to perform tasks, such as erasing letters or deleting a line, by pressing one or two keys.

Table 8.1.
Input agreements

Key

Function

System command prompt (prompts you to enter your command)

or<^h>

Erase character

Stop execution of a program or command

Delete the current command line

When used with another symbol, it means to perform a special function (called a code switch sequence). When used in vi editor edit mode, means end of text entry mode and return to command mode

Signifies the end of the input line and places the cursor on new line

Stop logging in or logging out (shut down)

Go back one character (for terminals that do not have a key )

Temporarily stop screen output

Continue displaying information that was stopped using<^s>

Note. In table 2.1 ^ symbol means control character . That is, in this case you must press two keys at the same time: the control character key and the specified letter.

Command hint

The standard command line prompt for a user on a UNIX system is the dollar sign $. For the root user - #. When a prompt appears on your terminal screen, it means that the UNIX system is waiting for instructions from you. The appropriate response to a prompt on your part is to issue a command followed by a key press .

Correcting input errors

There are several ways to correct input errors. The @ symbol erases the current line, and the keys And<^h>erases the last character entered. These keys and characters are the default values. The functions they perform can be reassigned to other keys.

Stopping command execution

To stop most commands from running, simply press the keyboard shortcut . The UNIX system will stop the program and display a prompt on the screen. This prompt serves as a signal that the last command running has stopped and the system is ready to receive the next command.

When a prompt appears on the screen, the UNIX system has recognized you as an authorized user and is waiting for you to enter a command.

In general command line has the following structure:

    name [options] [arguments]

The command name, options, and arguments must be separated by a space or tab. Processing of the command line by the interpreter begins only after pressing a key .

In the following description of the functions of the commands it is assumed:

Options (parameters):

    are a sign of command modification and, as a rule, consist of one character; large and small letters mean different modifications;

    as a rule, they begin with a “-” (“minus”) symbol, which is not separated by a space from other characters;

    can be combined in any way, but the minus sign can only be used once.

The arguments specify the objects that should be processed by the command, for example:

    file name;

    process number;

If you know what the called program should do, but are not sure about the correct syntax, you can specify the --help option on the command line after the command name:

    $cal --help

In order to be able to receive detailed information, UNIX OS has a built-in manual (on-line), access to which is provided by the man and apropos commands.

In the simplest case, to obtain information about any command, you need to specify its name as an argument to the man command:

    man command_name

apropos displays a list of commands according to keyword(pattern) specified as a command argument:

    apropos template

Examples.

If you run the date command and press the key , the UNIX system will call a program called date , execute it, and display the result on the screen:

    $date

    Tues Sep 18 14:49:07 2000

The date command displays the date and time.

If you run the who command and press the key , then the screen will look like this:

    $ who

    dko30024

    Oct18 8:30

    dko30001

    Oct18 8:34

    dko30020

    Oct18 8:32

    Oct18 8:00

who lists the login names of the users currently running on your system. The tty designation (second column) refers to special files that correspond to each user terminal. The third and fourth columns indicate the date and time of registration of each user. .

This means that you have successfully completed your work with the system and it is ready to register a new user.

If you logged in from a remote terminal, the connection will be disconnected, which will be notified to you, for example, by the telnet application.

Note. Before you disconnect the terminal, be sure to shut down the system.

Main conclusions

    UNIX is a multitasking, multi-user system. One powerful server can serve the requests of a large number of users. The system can perform a variety of functions: work as a computing server serving hundreds of users, as a database server, as a network server or network router.

    In general, the UNIX operating system can be represented as a two-tier model. In the center is the system core (kernel). The kernel directly interacts with the computer hardware, isolating application programs from the features of its architecture. The kernel includes programs that implement a set of services provided to application programs. Kernel services include I/O operations, process creation and management, process synchronization, etc. The next level of the model is system services that provide the user interface of the UNIX OS. The scheme of interaction with the kernel of both applications and system tasks is the same.

    The UNIX operating system interacts with the computer's hardware and software resources to perform the following functions:

    • equipment management;

      resource management;

      user interface support;

      performing information input and output;

      system monitoring;

      providing remote access to a computer network.

    A UNIX system contains three main components: the command system, the shell, and the kernel.

    The UNIX operating system contains several hundred commands that perform tasks of organizing and processing data and managing the user's environment. The commands themselves are small programs that perform specific functions, usually requiring minimal input, and are executed relatively quickly.

    Shells are commonly referred to as interactive programs that provide a user interface to the operating system kernel. The shell becomes the user's active process from the time he logs on to the system until he logs off. These programs are command interpreters (sometimes called command processors).

    The system kernel is the core of the operating system, which provides basic functions: creating and managing processes, allocating memory, and providing access to files and peripheral devices.

    The kernel consists of three main subsystems:

    • process and memory management subsystem;

      file subsystem;

      input/output subsystem.

    To establish contact with a UNIX system, you need to have:

    • terminal;

      a login name that identifies you as an authorized user;

      a password that verifies your identity;

      instructions for dialogue and access to the UNIX system if your terminal is not directly connected to the computer.

Control questions

    What problems is the UNIX operating system class designed to solve?

    What capabilities should a UNIX-class operating system provide?

    What are the tasks of the UNIX OS kernel?

    What are the functions of the UNIX OS kernel?

    What is the purpose of the Command System component of the operating system?

    Can we say that the shell provides the user with an interactive interface for interacting with the operating system?

    How is user authentication performed in UNIX?

A good place to start is to have a basic understanding of what Linux is and how it works.

And you can start with Introductions to Linux(sxw). Although there are other introductions. For example this. Here is the document by R.S. Klochkov and N.A. Korshenin Fundamentals of UNIX and Linux (SXW), (PDF).

Fundamentals of UNIX OS. Training course. (SXW) (PDF)
Copyleft (no c) — Fuck copyright! 1999-2003 V. Kravchuk, OpenXS Initiative
This short (estimated to be 16 hours, 6 of which are hands-on) introductory course is designed to introduce you to the architecture, features, and core features of the UNIX operating system. If successfully completed, the course will allow you to work freely and productively in the UNIX OS as a user and continue studying the administration or programming of this operating system.
The presentation is carried out, basically, without reference to the features of any version of UNIX, but if specific details are necessary, it is done for SVR4 systems, in particular, Solaris 8 OS.
I also suggest a book Andrey Robachevsky"UNIX operating system"
Here is what the author writes: “This book is not a replacement for reference books and various manuals on the UNIX operating system. Moreover, the information presented in the book is sometimes difficult to find in the documentation supplied with the operating system. These publications are full of practical recommendations, scrupulous descriptions of the settings of certain subsystems, formats for calling commands, etc. At the same time, issues such as the internal architecture of individual system components, their interaction and operating principles often remain behind the scenes. Without knowledge of this “anatomy,” working in the operating system turns into using memorized commands, and inevitable errors lead to inexplicable consequences. On the other hand, in this book, much less attention is paid to the issues of administering UNIX, configuring specific subsystems and the commands used. The purpose of this book is to outline the basic organization of the UNIX operating system. It should be borne in mind that the name UNIX denotes a significant family of operating systems, each of which has its own name and features unique to it. This book attempts to highlight what is common to the UNIX "genotype", namely: the basic user and program interfaces, the purpose of the main components, their architecture and interaction, and based on this present the system as a whole. At the same time, where relevant, references are made to a specific version of UNIX."

Personally, reading the wonderful book by Viktor Alekseevich Kostromin helps me a lot Linux for the user” which I can offer you (kos1, kos2, kos3, kos4, kos5, kos6, kos7, kos8, kos9, kos10, kos11, kos12, kos13, kos14, kos15, kos16, kos17, kos18).
And here is the same book, but in PDF (kos1, kos2, kos3, kos4, kos5, kos6, kos7, kos8, kos9, kos10, kos11, kos12, kos13, kos14, kos15, kos16, kos17, kos18).
And now also in SXW (kos1, kos2, kos3, kos4, kos5, kos6, kos7, kos8, kos9, kos10, kos11, kos12, kos13, kos14, kos15, kos16, kos17, kos18).
If you prefer documents in HTML format, then using the links above you can get to a page where you can download archives of book chapters in this format.

Among the fundamental books, I can also recommend the excellent guide by Karl Schroeder "Linux. Collection of recipes". I warn you right away that this link contains the book in .pdf format, and it weighs 50 MB. But an alternative option is also possible - the same book, only in

FORMAT.TXT The abstract for the book is as follows: “The proposed edition contains a unique collection of tips, tools and scenarios; you will find a number of ready-made, streamlined solutions to complex problems that any administrator faces when setting up a Linux server; these solutions will also be useful when setting up small networks, and when creating powerful distributed data warehouses. The book is written in the already popular form of recipe books published by O’Reilly in the “Problem-Solution-Discussion” format. For experienced users, programmers, system administrators, university students, graduate students and teachers." If suddenly the link ceases to exist, please let me know - perhaps I will post the .pdf file on my website.

I really like the series of articles and notes by Alexey Fedorchuk, Vladimir Popov and a number of other authors, which I take from here: http://unix.ginras.ru/. Here are the most interesting materials about Linux in general and its individual components in particular(Linux-all.zip, Linux-all2.zip, Linux-all3.zip, Linux-all4.zip).
SXW - (Linux-all.zip, Linux-all2.zip, Linux-all3.zip, Linux-all4.zip),
And also a book by Alexey Fedorchuk" The POSIX Saga or Introduction to POSIXism» which covers general issues of a number of systems, primarily UNIX-like ones. The name speaks for itself. According to the authors, the book is intended for users (including beginners). Here are the files - Part 1, Part 2, Part 3, Part 4.
AND SXW— Part1, Part2, Part3, Part4.

And if you are interested in the history of FREE SYSTEMS, you can read the Selection of articles under the general title A road open to everyone"(sxw) and, according to the author, covers general issues of Open Sources, POSIX systems, the history of UNIX, BSD, Linux

Also, to understand the operating principles of the OS, the concept of a process, along with the concept of a file, is, of course, one of the most important concepts. This is the subject of the article by V.A. Kostromina » Processes and Daemons in Linux"(SXW.

Text-Terminal-HOWTO(SXW)v 0.05, June 1998
This document explains what text terminals are, how they work, how to install and configure them, and gives some information about repairing them. It can be somewhat used even if you don't have a terminal manual. Although this work is written for real terminals on a Linux system, parts of it are also applicable to terminal emulators and/or other Unix-like systems.

It is also very useful to read the beautifully illustrated manual for faster and easier mastering of the console - Working with command history(SXW).

Here are materials devoted to command shells, or command interpreters, also called simply shells. First of all, a selection of articles that are united under the title Shell and utilities(SXW), (PDF).

The most popular shell today is Bash, which is short for Bourne Again SHell. I advise you to read BASH notes, (SXW), (PDF)
Creation date: 12/16/97.

And Features of the bash shell(SXW), (PDF).
The document briefly summarizes what Bash inherited from the Bourne shell: shell control structures, built-ins, variables, and other features. It also lists the most significant differences between Bash and the Bourne shell.

Shell command language interpreter(SXW), (PDF) - a command language that can execute both commands entered from the terminal and commands stored in a file.

Shell Programming(UNIX) (SXW), (PDF)

If Windows freezes, the user makes certain gestures, and then, convinced of the “futility and vanity of this world,” presses RESET with a calm heart. Things are different in Linux. About this article - Hanging? Let's film it!(SXW)

Questions and answers about kppp(SXW)

Article by V.A. Kostromin “ Hierarchy of directories and file systems in Linux» (SXW), which talks about the standard developed within the Open Source project for the directory structure of UNIX-like operating systems (meaning Linux and BSD systems).

The manual talks about files (which in Linux are essentially directories and even devices), but from a slightly different perspective Files and access rights to them(SXW).
Highly recommend. Chewed wonderfully.

Linux Commands and Abbreviations(SXW).
This is a practical selection of programs that we use most often, find useful, and that are present in our Linux distributions (RedHat or Mandrake).

UNIX consoles(SXW) – notes on various consoles.

Here's a bad guide Mandrake Linux 9.0 Command Line Guide(SXW).

Mounting file systems from devices and files(SXW) (PDF)
Document creation date: 07/26/2004
date last change: 20.08.2004
Author: Knyazev Alexey.

In 1965, Bell Telephone Laboratories (a division of AT&T), together with penal operator and the Massachusetts Institute of Technology (rIT), began to develop a new operating system called rULTIqS (rULTipleoed Information and Computing Service). The project participants had the goal of creating a multitasking time-sharing operating system capable of supporting the work of several hundred users. From Bell Labs, two participants took part in the project: Ken Thompson and Dennis Ritchie. Although the rULTIqS system was never completed (Bell Labs withdrew from the project in 1969), it became the forerunner of the operating system that later became known as Unio.

However, Thompson, Ritchie and a number of other employees continued to work on creating a convenient programming system. Using ideas and developments that emerged from work on rULTIqS, they created a small operating system in 1969 that included a file system, a process management subsystem, and a small set of utilities. The system was written in assembler and used on the nDn-7 computer. This operating system was named UNIX, a name similar to rULTIqS and coined by another member of the development team, Brian Kernigan.

Although the early version of UNIX promised a lot, it would not have realized its full potential without application to some real project. And such a project was found. When Bell Labs' patent department needed a word processing system in 1971, UNIX was chosen as the operating system. By that time, it had been transferred to the more powerful nDn-11, and it had grown a little. 16K was occupied by the system itself, 8K was allocated to application programs, the maximum file size was set at 64K with 512K of disk space.

Shortly after the first assembly versions were created, Thomson began working on a compiler for the FxuTuAN language, and as a result he developed Language B. This was an interpreter with all the limitations of an interpreter, and Ritchie developed it into another language, called q, which allowed the generation of machine code. In 1973, the operating system kernel was rewritten in the high-level language C, a previously unheard of move that had a huge impact on the popularity of UNIX. This meant that a UNIX system could now be ported to other hardware platforms in a matter of months and making changes was not particularly difficult. The number of running UNIX systems at Bell Labs exceeded 25, and the UNIX Sgstem Proup (USp) group was formed to maintain UNIX.

Research versions (AT&T Bell Labs)

In accordance with US federal law, AT&T did not have the right to commercially distribute UNIX and used it for its own needs, but starting in 1974, the operating system began to be transferred to universities for educational purposes.

The operating system has been modernized, each a new version was supplied with the corresponding edition of the Programmer's Guide, from which the versions themselves received the name editions (jdition). A total of 10 editions were released from 1971 to 1989. The most important editions are listed below.

Revision 1 (1971)

The first version of UNIX written in assembly language for nDn-11. Included the B language and many well-known commands and utilities, including cat, chdir, chmod, cp, ed, find, mail, mkdir, mkfs, mount, mv, rm, rmdir, wc, who. Mainly used as tool word processing for the Bell Labs patent department.

Revision 3 (1973)

The ss command appeared in the system, launching the C language compiler. Number installed systems reached 16.

Revision 4 (1973)

The first system in which the kernel is written in the high-level language C.

Revision 6 (1975)

First version of UNIX available outside of Bell Labs. The system was completely rewritten in C. Since that time, new versions began to appear that were not developed at Bell Labs and the popularity of UNIX began to grow. This version of the system was installed at the University of California at Berkeley, and the first version of BSD (Berheleg Softkare Distributuion) UNIX was soon released on its basis.

Revision 7 (1979)

Included the Bourne Shell command interpreter and a C compiler from Kernighan and Ritchie. The core of the system has been rewritten for portability to other platforms. The license for this version was purchased by ricrosoft, which developed the XjNIX operating system based on it.

UNIX grew in popularity, and by 1977 the number of operating systems exceeded 500. That same year, the system was ported to a non-nDn computer for the first time.

UNIX genealogy

There is no standard UNIX system; all UNIX-like systems have features and capabilities that are unique to them. But behind the different names and features, it is still easy to notice the architecture, user interface and programming environment of UNIX. The explanation is quite simple: all these operating systems are close or distant relatives. The most prominent representatives of this family are described below.

System III (1982)

Not wanting to lose the initiative to develop UNIX, AT&T in 1982 merged several existing versions of the OS and created a version called Sgstem III.

This version was intended for distribution outside of Bell Labs and AT&T, and marked the beginning of a powerful branch of UNIX that is still alive and growing today.

System V (1983)

In 1983, System V was released, and later several more releases for it:

  • SVR2 (1984): InterProcess Communication (IPC) shared memory, semaphores
  • SVR3 (1987): I/O Streams System, File System Switch, shared libraries
  • SVR4 (1989): NFS, FFS, BSD sockets. SVR4 combines the capabilities of several well-known versions of UNIX - SunOS, BSD UNIX and previous releases of System V.

Many components of this system were supported by ANSI, POSIX, X/Open and SVID standards.

UNIX BSD (1978) (Based on UNIX 6th edition)

  • 1981, by order of DAunA, the Tqn/In stack was built into BSD UNIX (in 4.2BSD)
  • 1983 actively used network technologies and could connect to the ARPANET network
  • 1986 version 4.3BSD released
  • 1993 4.4BSD and BSD Lite (last released versions) released.

OSF/1 (1988) (Open Software Foundation)

In 1988, IBM, DEC, HP teamed up to create a version of UNIX independent of AT&T and SUN and created an organization called OSF. The result of the activities of this organization was the OSF/1 operating system.

Standards

The more different variants of UNIX appeared, the more obvious the need to standardize the system became. Having standards makes applications easier to port and protects both users and manufacturers. As a result, several standardization organizations emerged and a number of standards were developed that influenced the development of UNIX.

IEEE POSIX (Institute of Electrical and Electronics Engineers Portable Operating System Interface)

  • 1003.1 (1988) API (Application Programming Interface) OC standardization
  • 1003.2 (1992) definition of shell and utilities
  • 1003.1b (1993) Real-time Application API
  • 1003.1c (1995) definitions of “threads”

ANSI (American National Standards Institute)

  • Standard X3.159 (1989)
  • Syntax and semantics of the C language
  • Contents of the libc standard library

X/Open

  • 1992 Xwindow standard
  • 1996 creation, together with OSF, of the CDE (Common Desktop Environment) user interface and its interface with the Motiff graphical shell

SVID (System V Interface Definition)

Describes external interfaces UNIX versions of System V. In addition to SVID, SVVS (System V Verification Suite) was released - a set of text programs that allows you to determine whether a system complies with the SVID standard and whether it is worthy of bearing the proud name System V.

Known versions of UNIX

  • IBM AIX based on SVR2 with many features of SVR4, BSD, OSF/1
  • HP-UX version of HP
  • IRIX version of Silicon Graphics, similar to SVR4
  • Digital UNIX version of DEC based on OSF/1
  • SCO UNIX (1988) one of the first UNIX systems for PC developed based on SVR3.2
  • Solaris version of UNIX SVR4 from Sun Microsystems

Before you can master , you must be fluent in the basic concepts of the Linux system. Knowing how to work with Linux will be a very useful skill because Linux servers run a large number of websites, Email and other Internet services.

In this section, we are going to explain the basic concepts associated with Linux. In carrying out the task assigned to us, we believe that you already have an idea of computer systems ah in general, including components such as the central processing unit (CPU), random access memory (RAM), motherboard, HDD, as well as other controllers and devices associated with them.

3.1

The term "Linux" is often used to refer to the entire operating system, but Linux is actually the operating system kernel that is launched by the boot loader launched by the BIOS/UEFI. The kernel takes on a role similar to that of a conductor in an orchestra, ensuring that hardware and software operate in harmony. This role involves managing equipment, users and file systems. The kernel is a common base for other programs running on a given system, and most often runs ring zero also known as kernel space.

User space

We use the term "user space" to encompass everything that happens outside the kernel.

Among the programs that run in user space are many of the core utilities from the GNU project, most of which are designed to be run from the command line. You can use them in scripts to automate various tasks. For more information about the most important commands, see section 3.4 " ".

Let's take a quick look at the various tasks performed by the Linux kernel.

3.1.1 Equipment startup

The purpose of the kernel is, first of all, to manage and control the main components of the computer. It detects and configures them when the computer is turned on and when a device is mounted or removed (for example, USB device). It also makes them accessible to higher-level software through a simplified software interface, so applications can take advantage of the devices without having to deal with details like the expansion slot into which the card is inserted. The programming interface also provides a certain level of abstraction; this allows you to use equipment for video conferencing, for example, use a webcam, regardless of its model and manufacturer. The software can use the interface Video for Linux(V4L) and the kernel will translate interface calls into actual hardware commands needed to operate a specific webcam.

The kernel exports data about detected hardware via virtual systems/proc/ and /sys/ . Applications often access devices using files created in /dev/ . Special files representing disks (for example /dev/sda), partitions (/dev/sdal), mice (/dev/input/mouse0), keyboards (/dev/input/event0), sound cards(/dev/snd/*), serial ports (/dev/ttyS*) and other components.

There are two types of device files: block and character. The former have the characteristics of a data block: they are finite in size and you can access bytes at any position in the block. The latter behave like a stream of characters. You can read and write characters, but you cannot search for a given position and modify arbitrary bytes. To find out the device file type, check the first letter of the Is -1 command output. This can be either b, for block devices, or c, for character devices:

As you may have guessed, disks and partitions use block device files, while the mouse, keyboard, and serial ports use character device files. In both cases, the programming interface includes special commands that can be activated via a system call ioctl.

3.1.2 Merging file systems

File systems are an important aspect of the kernel. Unix-based systems combine all file stores into a single hierarchy, allowing users and applications to access data by knowing its location within that hierarchy.

The starting point of this hierarchical tree is called root, represented by the symbol “/”. This directory may contain named sub-directories. For example, the home sub-directory "/" is called /home/. This sub-directory, in turn, may contain other sub-directories, etc. Each directory can also contain files in which files will be stored. So home/buxy/Desktop/hello.txt refers to a file called hello.txt which is stored in the Desktop sub-directory, which is in the buxy sub-directory of the home directory, which is present in root. The kernel compiles between a given naming system and a disk storage location.

Unlike other systems, Linux has only one such hierarchy and can integrate data from multiple disks. One of these disks becomes root, and the others are mounted on a directory in the hierarchy (this command in Linux is called mount). These other drives are then made available under mount points ( mount points ) This allows the user's home directories (which are usually stored in /home/ ) to be stored on a separate hard drive, which will contain the buxy directory (along with other users' home directories). Once you have mounted the drive to /home/ , these directories become accessible in their normal location, and various paths such as /home/buxy/Desktop/hello.txt continue to work.

There are many file system formats to match the many ways data can be physically stored on disks. The most widely known are ext2, ext3 and ext4, but there are others. For example, VFAT is a file system that was historically used by DOS and Windows operating systems. VFAT support by the Linux operating system allows hard drives be available on both Kali and Windows. In any case, you must prepare the filesystem on the disk before you mount it, and this operation is called formatting.

Commands such as mkfs.ext3 (where mkfs stands for MaKe FileSystem) handles formatting. These commands require as a parameter a device file representing the partition to be formatted (for example, /dev/sdal, the first partition on the first disk). This operation destroys all data and should only be run once, unless you want to wipe the file system and start over.

There are also network file systems such as NFS, which do not store data on a local disk. Instead, the data is transmitted over the network to a server, which stores it and makes it available on demand. With file system abstraction, you don't have to worry about how that drive is mapped, since the files remain accessible in their normal hierarchical path.

3.1.3 Process management

A process is an executable instance of a program that requires memory storage for both the program itself and its working data. The kernel is responsible for creating and tracking processes. When a program runs, the kernel first allocates some memory, loads executable code from the file system into that memory, and then runs the code. It contains information about this process, the most prominent of which is an identification number known as process id (process identifier(PID)).

Most modern operating systems, namely those that run on the Unix kernel, including Linux, are capable of performing many tasks. In other words, they allow the system to run many processes at the same time.

There is actually only one running process at any given time, but the kernel divides the CPU time into small chunks and runs each process in turn. Because these time slices are very short (in milliseconds), they create appearance processes running in parallel, although they are active only during their time slot and inactive the rest of the time. The main goal of the kernel is to tune the scheduling mechanisms in a way that maintains this appearance while increasing system performance. If the period of time is too long, it may stop responding properly. Well, if they are too short, the system will waste too much time switching between them.

Such decisions can be controlled using process priorities, where high-priority processes will run for longer periods of time and at more frequent time slices than low-priority processes.

Multiprocessor Systems (and other variants)

The restrictions described above that only one process can be running at a time do not apply in all situations. It would be more correct to say that one core can only work with one process. Multiprocessor, multicore, or hyperthreaded systems allow multiple processes to run in parallel. However, the same time reduction system is used to handle situations where there are more active processes than available processor cores. This is not unusual: a basic system, even completely idle, almost always has dozens of processes running.

The kernel allows multiple independent instances of the same program to run, but each is only allowed access to its own time slices and memory. This way, their data remains independent.

3.1.4 Rights management

Unix systems support multiple users and groups and allow you to control access rights. In most cases, a process is defined by the user who runs it. This process can perform only those actions that are permitted to its owner. For example, opening a file requires the kernel to check the process for the necessary rights (for more information on this example specifically, see Section 3.4.4, “Permission Management”)

3.2 Linux Command Line

By “command line,” we mean a text-based interface that allows you to enter commands, execute them, and view the results. You can run a terminal (a text screen inside a graphical desktop, or a text console outside any GUI) and a command interpreter inside it ( shell).

3.2.1

When your system is working correctly, the most in a simple way To gain access to the command line is to launch a terminal in a graphical desktop session.


Figure 3.1 Launching GNOME Terminal

For example, in the system Kali Linux By default, GNOME Terminal can be launched from the list of favorite applications. You can also enter “terminal” in the Activities window (the window that is activated when you move the mouse to the upper left corner) and click on the application icon you need that appears (Figure 3.1, ““).

In case of any disruptions or incorrect functioning of your GUI, you can still launch the command line on virtual consoles (up to six of them can be accessed through six key combinations, starting with CTRL + ALT + F1 and ending with CTRL + ALT + F6 – You don't have to press the CTRL key if you're already in text mode outside of the GUI Xorg or Wayland).

You get the usual login screen where you enter your username and password before accessing the command prompt with its shell:

The program that processes the data you enter and executes your commands is called shell(shell or command line interpreter). The default shell provided in Kali Linux is Bash(it means Bourne Again Shell). A trailing "$" or "#" character indicates that the shell is waiting for your input. These symbols also indicate how Bash treats you as a regular user (the first case with the dollar sign) or as a superuser (the last case with the hash).

3.2.2

This section provides only a brief overview of some of the commands, each of which has many different options and capabilities not covered here, so please refer to the extensive documentation available in their respective man pages. In penetration testing, most often you will access the system through the shell, after a successful exploit, rather than through a GUI user interface. Knowing how to use the command line competently is essential if you want to succeed as a security professional.

Once the session is started, the pwd command (which stands for print working directory) will display your current location in the file system. Your current location can be changed using the cd command directory name(where cd means (change directory)). In the event that you have not specified the directory where you want to go, you will automatically return to your home directory. If you enter cd -, you will be returned to the previous working directory (the one you were in before you entered the last cd command). The parent directory is always called .. (two dots), while the current directory is called .. (two dots). (one point). The ls command allows you transfer directory contents. If you do not specify any additional parameters, the ls command will display the contents of the current directory.

You can create a new directory using the mkdir command directory name, and also delete an existing (empty) directory using the rmdir command directory name. The mv command will allow you move and rename files and directories; delete file can be done using rm file name, and copying the file is done using cp source-file target-file.

The shell executes each command by running the first program with the given name that it finds in the directory specified by the environment variable PATH. Most often these programs are located in /bin,/sbin, /usr/bin or /usr/sbin. For example, the ls command is in /bin/ls; Sometimes a command is directly processed by the shell, in which case it is called a shell builtin (among them are cd and pwd ); The type command allows you to query the type of each command.

Note the use of the echo command, which simply displays the line in the terminal. In this case, it is used to display the contents of the environment variable, because The shell automatically replaces variables with their values ​​when the command line is executed.

Environment Variables

Environment variables allow you to store global settings for the shell or other programs. They are contextual but inheritable. For example, each process has its own set of environment variables (they are contextual). Shells, such as login shells, can declare variables that will be passed to other executable programs (they are inherited).

These variables can be defined both for the system in /etc/profile and for the user in ~/.profile, but variables that are not specific to command line interpreters are better placed in /etc/environment, since these variables will be introduced into all user sessions thanks to the Pluggable Authentication Module (PAM) – even if no shell is running.

3.3 Linux file system

3.3.1 File system hierarchy standard

Like other Linux distributions, Kali Linux is organized according to the standard FilesystemHierarchy Standard(FHS), allowing users of other Linux distributions to easily navigate Kali. FHS defines the purpose of each directory. Top level directories are described as follows.

  • /bin/: main programs
  • /boot/: The Kali Linux kernel and other files required for its early boot process
  • /dev/: device files
  • /etc/: configuration files
  • /home/: personal user files
  • /lib/: main libraries
  • /media/*: mount points for removable devices (CD-ROM, USB drives, etc.)
  • /mnt/: temporary mount points
  • /opt/: Optional applications provided by third parties
  • /root/: administrator's personal files (root files)
  • /run/: non-persistent workflow files that do not persist after reboot (not yet included in FHS)
  • /sbin/: system programs
  • /srv/: data used by servers located on this system
  • /tmp/: temporary files (this directory is often emptied after reboot)
  • /usr/: applications (this directory is further divided into bin, sbin, lib according to the same logic as in the root directory). In addition, /usr/share/ contains data with independent architecture. The /usr/local/ directory is intended to be used by an administrator to install applications manually without overwriting files handled by the packaging system (dpkg).
  • /var/: Variable data processed by the daemon. This includes log files, queues, buffers and caches.
  • /proc/ and /sys/ are specific to the Linux kernel (and are not part of FHS). They are used by the kernel to export data to user space.

3.3.2 User's home directory

The contents of the user directory are not standardized, but there are several conventions worth noting. One is that the user's home directory is often indicated by a tilde (“~”). This is very useful to know because command interpreters automatically replace the tilde with the correct directory (which is in the environment variable HOME and whose normal value is /home/user/ ).

Traditionally, application configuration files are often stored directly in your home directory, but their file names usually start with a dot (for example, email client mutt stores the configuration in ~/.muttrc ). Note that filenames starting with a dot are hidden by default; ls will only list them if the -a option is specified, and graphical file managers must be explicitly configured to show hidden files.

Some programs also use multiple configuration files organized in a single directory (such as ~/.ssh/). Some applications (such as the Firefox web browser) also use their directory to store a cache of downloaded data. This means that these directories can end up consuming a lot of disk space.

These configuration files, which are stored directly in your home directory, are often collectively called dotfiles for a long time expand to such an extent that these directories can become cluttered with them. Fortunately, collaboration under the auspices of FreeDesktop.org led to the creation of the XDG Base Directory Specification, a convention whose purpose is to clean up these files and directories. This specification states that configuration files should be stored in ~/.config , cache files in -/.cache , and application data files in -/.local (or their sub-directories). This convention is gradually gaining momentum.

A graphical desktop most often uses shortcuts to display the contents of the /Desktop/ directory (or any other word that is an exact translation of this, on systems that do not use English language). Finally, an email system sometimes stores incoming messages in a directory - /Mail/.

This is interesting:

Transcript

1 Introduction The course “UNIX OS Fundamentals” is intended for students of initial courses of faculties interested in training software developers of one level or another. A mandatory preliminary course for the UNIX OS is an introductory course in programming in the C language, as a basic course, as well as a course in the basics of computer architecture. The course structure offers 13 lectures and related laboratory work to help you understand the general principles of operation of an operating system such as UNIX. The lecture material is presented in abstract form, which leaves a greater degree of freedom for the depth of presentation of topics in the lecture material. In addition, the duration of some lectures can vary from 2 to 6 hours if necessary. Laboratory exercises do not require the use of a specialized laboratory or a specific UNIX/Linux clone and can be performed on personal computers students using any available UNIX, Solaris, Linux, FreeBSD, Mac OS X, etc. software, provided that the appropriate packages are installed from the developer repositories. In practice, usually, remote access to a Linux server via the SSH protocol was used to Windows workers stations and PuTTY 1 as an SSH client. Finally, note that all tasks are performed in the shell (bash) and the various existing X Window (X11) interfaces (CDE, GNOME, KDE, Xfwm, Xfce or wmii, etc.) are not discussed here, which allows the use of minimal kernel configurations and concentrate on learning the OS kernel from the very beginning of the course. Why, after all, is Linux chosen to represent the basics of operating systems, and, for example, not Microsoft Windows,? There are several reasons: open source Linux, the UNIX ideology embedded in it, the main OS ideas implemented in UNIX/Linux are also used in Microsoft Windows: multitasking, hierarchical file system, multi-user system, virtual memory, built-in network stack, multithreading, and, most importantly, the Linux kernel is increasingly being chosen for building computer systems at various levels, from distributed and cloud servers in a corporate system to mobile ones and systems embedded in control chips. 1 Vlasov S.V Faculty of Computer Science VSU, Voronezh 1

2 Lecture 1. Basic concepts. An operating system is a software product designed to manage computer resources: hardware, data, programs and processes. A mandatory component of the OS is the kernel; all other components are applications added to the OS if necessary. For example, when they say: “Linux versions...” they mean the kernel, but by GNU/Linux they mean some clone with a specific kernel and set of applications (Debian, Red Hat, Susse, etc.) The OS kernel is required an OS component that provides the data structures, programs and processes, and hardware-specific code needed to manage the computer's resources. There are different principles for constructing a kernel: a monolithic kernel (Linux) or a microkernel (eg Minix). The kernel can be customized by adding or removing some components (modules, drivers). A file is a specific sequence of bytes. In UNIX, almost everything is represented as a file. In this case, only 7 types of files are distinguished (the corresponding symbol is indicated in parentheses: in the output of the ls -l command) regular files (-) special files: directory, (d) symbolic link, (l) named pipe, (p) character device, ( c) block device, (b) UNIX socket. (s) Recognizing and processing the internal structure of a file is the responsibility of the application for which the file was intended or created. A hierarchical file system is an abstraction for representing the ordering of files as a tree of directories. The root of the tree is a directory named "/", which is called the root file system (not to be confused with /root). The peculiarity of the Linux hierarchical file system is that it is virtual, in the sense that any node in a single hierarchy can be associated with its own file system of a certain type (ext2fs, ext3fs, riserfs, vfat, etc.), located on a separate device, partition, or directly in memory. The default directory in the hierarchy at any given moment is called the current working directory. You can use absolute file names starting from the root /, or relative names from the current working directory (the "." - dot character) when the parent directory is indicated by ".." characters (two dots horizontally without spaces). A program is a file containing executable instructions. A file containing the printed text of a program in a programming language is called a program source module. Source code written in a script language (shell, perl, python, ruby, etc. ) is executed directly by the language interpreter. Sources in other languages ​​(C, Fortran, etc.) must be compiled to convert the source text into executable software module, containing processor instructions in binary format (evolving from a.out and COFF to ELF). A process is a program at runtime. Processes are also organized into a hierarchy with parent-child relationships. All processes in UNIX have a unique integer identifier (PID). The root process of the hierarchy is process number 1, this is the init process, spawned when the operating system kernel boots and spawns other descendant processes. When the OS is running, any process except init can be stopped. There is also a hidden process 0 - swap, which is responsible for paging virtual memory. Logon process is the parent process for all processes generated by the user Vlasov S.V Faculty of Computer Science VSU, Voronezh 2

3 systems running in multi-user mode. The task of this process is to check the security attributes (login name and password) of the user and start the process that provides the interface for interaction between the OS and the user, usually a shell command language interpreter. A shell interpreter is a program that is part of a specific OS to ensure user interaction with the OS. UNIX/Linux systems use various interpreters: bash, csh, tcsh, ksh, zsh and many others. Bash is usually the default interpreter on GNU/Linux systems. The interpreter provides a command line for launching standard commands and user programs. Vlasov S.V Faculty of Computer Science VSU, Voronezh 3

4 Practical examples. Login via SSH client (PuTTY) In MS Windows, select Start->Run and enter: X:/Putty/Putty.exe In the Putty Configuration window that opens, enter in the Host Name (or IP address) field: www2 Clicking on Open will lead to connection to the www2 server and a logon window appears in which, when you first try to connect to a Linux server, a PuTTY Security Alert message appears about the absence of a new RSA key in the registry cache; agree to include the key in the cache for a trusted connection with the server now and in the future. Click Yes. An invitation will appear in the DOS window Vlasov S.V FCS VSU, Voronezh 4

5 Logon as: name password: where you enter your login name (instead of name) and password. Be careful when entering your password, since the keys you press are not displayed in any way when entering, not even asterisks. If everything is done correctly, then you will see the command line prompt of the shell 2 interpreter in the same window: ~$ _ Now you can interact with the Linux OS through the command line interface. 3 In what follows, we will only use the $ symbol to indicate the command line, although you may have it preceded by the path to the current working directory. Where are we? (home directory) When registering in the system, each user is assigned a secure home directory for storing personal files. When you log in, the Logon process automatically mounts your home directory as the current working directory. The three following commands should show the same result, the full path to your home directory. $ pwd $ echo ~ $ echo $HOME What do we have? (automatically generated files) The contents of the current working directory can be displayed with the command: $ ls When logging in for the first time, this list is usually empty. 4 However, when a user registers, some hidden service files are created in his home directory, which can be modified by the user himself to configure the required environment. The -a switch of the ls command allows you to see in the list of contents of the current directory all hidden files named with the prefix “.” (dot) $ ls -a By the way, this list also includes the anonymous names of the current directory "." and the parent directory "..". By giving your own file a name prefixed with "." (dot) you make it hidden. What system is used? Operations and system configuration options depend on the OS version you are using. To get information about this, use the command $ uname -a Brief information about the parameters and keys of the command can be obtained using the help key, for example, 2 If you have problems connecting to the server or entering your name and password, you have only one option, contact the server system administrator . 3 The $ symbol before the cursor is a command line sign and is the default for a normal user in the bash command interpreter. (The # symbol is used for the root superuser) 4 You may have a public_html directory that can be used to exchange files between Linux and MS Windows systems thanks to the corresponding service. Vlasov S.V Faculty of Computer Science VSU, Voronezh 5

6 $ uname --help Detailed descriptions of UNIX commands and functions can be obtained from documentation called man pages (“manual pages”): $ man pwd $ man ls $ man echo $ man uname Manual pages are presented in a special format nroff /troff/groff and are formatted when output by the appropriate utility, depending on the type of output device. To finish viewing the manual pages, press the Q key $ man man Manual files are usually stored in packaged form (suffix.gz or .bz2) and are organized into sections: 1. General commands 2. System calls 3. C library functions 4. Special files 5. File formats and conversion 6. Games and screen savers 7. Additional 8. Commands and daemons for system administration The section number is used when referring to the command or function being used, for example, printf/3 and is indicated by the first parameter of the command $ man 1 printf $ man 3 printf The directory in which the manual page for the command is located can define using the -w switch $ man -w command Hierarchical file system The ls command can be used to list the contents of any directory in the file system hierarchy (regardless of physical device and the type of file system on the partition or in memory). For example, the root file system is displayed with the command $ ls / However, in order to display the structure of the entire tree, a fair amount of ingenuity is required, for example, $ ls -R grep ":$" sed -e "s/:$//" -e "s/[^-][^\/]*\//--/g" -e "s/^/ /" -e "s/-/ /" where the regular expression filter grep, the stream editor sed and unnamed pipes, indicated by the symbol (pipe). In your home directory, you can create a new (empty) directory node in the hierarchy, for example, lab1 Vlasov S.V Faculty of Computer Science VSU, Voronezh 6

7 $ mkdir lab1 Any node in the hierarchy can be selected as the current one $ cd lab1 $ pwd To return to your home directory (defined by the HOME environment variable), use the cd command without parameters $ cd $ pwd You can delete an empty directory with the rmdir command, for example, $ rmdir lab1 If the directory is not empty, then the last command (if lab1 contains some files) will display the messages rmdir: lab1: Directory not empty and the deletion will not be performed. In the current directory you can create, for example, a text (regular) file. To do this, you can use the redirected output of the command echo $ echo "echo Print directory tree " > tree A tree file is created, the contents of which can be output with the command $ cat tree or in page formatted form $ pr tree You can even add a new line to the end of the existing file, for example, $ echo using grep and sed >> tree $ cat tree You can use a line text editor ed standard editor, designed for editing texts from a typewriter-type console. $ ed tree a ls -R grep ":$" sed -e "s/:$//" -e "s/[^-][^\/]*\//--/g" -e "s /^/ /" -e "s/-/ /". wq $ cat tree In fact, we have created a file with commands here, which can be executed as a new command if you declare it “executable”: $ chmod +x tree $./tree Vlasov S.V Faculty of Computer Science VSU, Voronezh 7

8 Note that an attempt to execute a file without specifying the current directory, i.e. just tree rather than ./tree as shown above will not result in the file being found in the current directory. This is because, for security reasons, the anonymous current directory is not included in the PATH environment variable, which is used to find a program to run by name. $ echo $PATH Full list The user can get environment variables and their values ​​with the command: $ env To create text files you can also use the cat command to redirect the output to a file $ cat > file text Ctrl-D Here, pressing Ctrl-D sends the end of file (EOF) character END OF TRANSMISSION to the input stream. You can also append text to the end of the file $ cat >> file appended text Ctrl-D To create large text files, for example with C sources, use powerful on-screen text editors such as vi/vim, nano or emacs. Deleting a file is done with the command $ rm file. Among other things, the -r or -R switch allows you to recursively delete a subtree of directories. For safe removal files, it is recommended to use the -i switch, which generates a request to confirm deletion. Moving and renaming a file is carried out with the command Date and time $ mv old new The current system time and date can be determined with the command $ date To change the time and/or date, use a parameter in the MMDDhhmmYY format. For example, for a job on January 24 8:36 PM 2011, you would enter $ date. Note also that the time command found on UNIX systems shows the time used by the following process ( real time, user-mode execution time, and kernel-mode time), rather than the current system time. Try Vlasov S.V FCS VSU, Voronezh 8

9 $ time date you should get something like the following output real user sys 0m0.040s 0m0.000s 0m0.040s Who else is on the system? UNIX OS is a multi-user system that allows you to simultaneously execute a logon process and allow several users to work in the system independently of each other. To determine who is currently logged in, use the $who command, which displays the user's login name, terminal, and the time the logon process was initiated. In a multi-user system, the same user can use several different terminals at the same time (for example, several parallel SSH sessions). To determine who is using the current terminal, you can use the command $ whoami Registered users So, to use the system you need to be a registered user. Registration is carried out by the system administrator with superuser rights, which has a standard name in UNIX/Linux systems - root. 5 Typically, all registration records about users are stored in a single file /etc/passwd, which is readable by everyone $ cat /etc/passwd In earlier versions of the system, the encrypted password (hash) of the user was also stored in the same file (the second field after the user name , separated by a colon). But in the latest systems It is customary to store password hashes in another file /etc/shadow, which is not readable by anyone other than root. The password field in the /etc/passwd file stores only a hidden link to the entry in /etc/shadow, so only the “*” character is displayed. To change the current password on UNIX systems, use the command $ passwd Changing password for name. (current) UNIX password: current user password new UNIX zfyytsshchkv: new password retype new UNIX password: new password (again exactly the same as in the previous line) passwd: password updated successfully If there is an error or the password is too simple, messages appear, for example, or passwd: Authentication token manipulation error BAD PASSWORD: it is too simple simplistic/systematic 5 Typically, the root name is not used to log in; instead, the administrator creates a normal login for himself, but uses the su command to perform operations that require superuser privileges. In Linux systems, a popular group of privileged users is sudoers, who receive the right to perform operations with root rights via the sudo command Vlasov S.V FCS VSU, Voronezh 9

10 In this case, you must enter a different password. Note that the passwd process runs in special superuser mode and ignores the SIGINT signal sent by pressing Ctrl-C and thus cannot be interrupted. A simple way of communication Users simultaneously working in the system can send short messages to each other using the command $ write name The user with the specified name/terminal will immediately receive a notification Message from your_name on tty0 at 10:30.. and if you continue to type on your terminal (here on tty0), the message will immediately appear line by line on the terminal of the user with the name specified in the command. To end the message you must enter Ctrl-D. However, if your opponent does not want to receive any messages, then he uses the $ mesg n command to disable the ability to send/receive write messages. To enable this feature, the user must run the command $ mesg y If you need to send a message to all users on the system at once (who have messages enabled), you can use the command $ wall message up to 20 lines Ctrl-D Log off the session $ logout You can also use Ctrl-D or $ exit The logout command may not terminate the session, but will display one of two messages or There are stopped jobs not login shell: use "exit" The first message is a warning that your session has been started and paused (by the SIGSTOP signal or Ctrl- Z) tasks. You have the opportunity to continue executing jobs (with the jobs and fg commands) until they complete normally. However, if you do not do this, suspended jobs will be terminated (with a SIGTERM signal) when the logout or Ctrl-D command is executed again. The second message means that you have spawned child processes from the shell launched by the logon process that are executing the current shell session that is not associated with the logon process. Vlasov S.V Faculty of Computer Science VSU, Voronezh 10

11 You must execute the exit or Ctrl-D command in the current shell to return to the shell process spawned by logon. Conclusions The OS is complex software system, consisting of subsystems for managing various resources. The purpose of the course is to study the main features of the functioning of the UNIX/Linux OS kernel subsystems through the system call interface. Vlasov S.V Faculty of Computer Science VSU, Voronezh 11


MINISTRY OF EDUCATION AND SCIENCE OF THE RF FEDERAL STATE BUDGET EDUCATIONAL INSTITUTION OF HIGHER PROFESSIONAL EDUCATION “Kama State Engineering and Economic Academy” MANAGEMENT

6.31. Cycles. Shift parameters. for variable in values ​​do statements done for var1 in value1 value2 value3 do echo $var1 done for File1 in $(ls *.sh); do echo $File1 >> All.txt done while do condition

Information Technology Lecture 3 1 Bash shell 2 Basic information Shell or shell working in text mode (command line interface) Graphical user interface (GUI) working in graphical mode

SHELL Definition: Shell [shell] interpreter of operating system commands. Shells are divided into two types, depending on the organization of work with the user: - command line interpreter; - graphic

2 Navigation The first thing we will try to learn (after trial keystrokes) is navigation in the Linux file system. In this chapter, we will introduce the following commands into everyday use: pwd displays the name of the current worker

SibGUTI Department of High-Level Language Programming (HLL), semester 1 2009 2010 academic year Polyakov A.Yu. Laboratory work 1. Linux OS programming environment. Purpose of work: To get acquainted with the software

Lecture 2. Process control subsystem. Process management in a multitasking system consists of allocating kernel resources for each running process and switching the context of processes

MOSCOW STATE TECHNICAL UNIVERSITY named after. N.E. BAUMAN Faculty of “Informatics and Control Systems” Department “ Automated systems information processing and management" Syomkin P.S., Syomkin

Working with the GNU/Linux OS in terminal classes of the Department of Armed Forces Purpose of the work: to get acquainted with the GNU/Linux OS software to write the simplest program in C language. Operating system (OS) GNU/Linux

BOINC system. The lesson is conducted by: Khrapov Nikolay Pavlovich Institute of Information Transmission Problems RAS Practical lesson Basics of working with Linux OS Installing a BOINC server Practical lesson Basics of work

OS Components Main OS Components 1. Process Management 2. Main Memory Management 3. File Management 4. I/O System Management 5. Management external memory 6. Networking support

Introduction to the Linux command line How to stop worrying and love the shell Alexey Sergushichev Practical school in bioinformatics MNL " Computer techologies» 02/19/2014 Command line Command line

Linux operating system Lecture 6 The command shell (shell, bash) is a command line interface in Unix-like operating systems, that is, it executes commands that the user issues or that are read

Laboratory work 4 INTRODUCTION TO PROCESSES Purpose of the work To become familiar with the concept of process. Learn to get a list of processes available in the system and manage their state. 1. Theoretical information

Filename patterns, file search and other UNIX features Registering in Linux Run putty.exe Enter the IP address Click Open Username studentx Password studentx 2 Create a directory

Contents Preface 6 Lecture 1. Working session in Linux 8 1.1 System users................................ 8 1.2 Registration in the system..... .................. 13 1.3 Simultaneous access to the system..................

The basics of the vast world of the UNIX system are outlined in an accessible way for the non-professional user. The user gradually learns to log into the system, use various commands, ask for help, find

Working with standard document templates Cognitive Technologies User's Guide Moscow, 2015 2 ABSTRACT This document provides information about the use of the E1 Euphrates software package

Computer science Information technology Lecture 1. Introduction to the Linux OS Main characteristics of Linux Real multitasking Multi-user access Swaping random access memory to disk Page

Other languages: English Russian iridium Server for Raspberry Pi Installing and configuring the server in the i3 lite project iridium Sever for Raspberry Pi is a software implementation of iridium Server that runs

FEDERAL AGENCY FOR EDUCATION Tomsk Polytechnic University APPROVED by: Dean of AVTF Gaivoronsky S.A. 2009 SIMPLE SHELL TOOLS Guidelines for performing laboratory work

Lesson 3. Topic: Accounts in Linux. Type of lesson: lecture, practical lesson. Study questions: 1. Concept of account and authentication. The files /etc/passwd and /etc/group, /etc/shadow and /etc/gshadow.

Abstract of the program of the discipline "Operating Systems" 1. Goals of mastering the discipline The goals of mastering the discipline "Operating Systems" are: developing in students basic knowledge, skills and abilities in

Laboratory work 2. Navigation through the file structure and its maintenance using the Xubuntu OS terminal Practical part II. Navigation through the file structure and its maintenance using the OS terminal

Page 1 of 7 News Technical equipment of a Linux cluster Resource usage statistics Registration on a Linux cluster Registration on SPP-2000 AFS file system Network security issues Libraries

Basic concepts and definitions Operating system (hereinafter referred to as OS) software package, which controls the functioning of the computer and ensures the interaction of the devices included in it

Chapter 1 Choosing an Operating System The fact that you are reading this book means that you want to learn Linux. Before you start this journey, you must understand what an operating system is

Practical work 10 Working with files in LINUX Purpose of the work: to study the features of working with files in the Linux operating system. Work plan: 1. Familiarize yourself with brief theoretical information.

APPROVED BY -LU INFORMATION PROTECTION SYSTEM AGAINST UNAUTHORIZED ACCESS Dallas Lock Linux Operator (User) Manual Sheets 11 2016 2 Abstract This operator manual is distributed

Information technology Lecture 2 Linux commands 2 Linux commands Linux console commands - interaction between the user and the OS Executed through the command line by manual input Behind each command

Software and hardware complex of trusted download "Blokhost-MDZ" Installation guide for the software package "Blokhost-MDZ". Installation Guide. Page 2 Abstract The document describes the installation

Multifunctional hardware and software complex for the provision of communication services "IS RINO" Basic software Management server CONTENTS 1 INTRODUCTION... 3 2 COMPOSITION OF THE SOFTWARE... 3 3 INSTALLING THE SERVER...

Rutoken Logon. Administrator's Guide 2018 Aktiv Company In this document This document contains answers to the following questions: What is the Rutoken Logon software product used for? (see page

Contents of the lesson Terminology Remote access tools Login 1 User (user) user, Account(account). An object for recording system actions. Login 1. Username/account

Tasks Part 1: Running FTP from the Command Line Part 2: Uploading an FTP File Using the WS_FTP LE Client Part 3: Running FTP in a Browser Input/Script FTP (File Transfer Protocol) included in the kit

The general principles of organization, composition, structure of operating systems and their shells, as well as a number of specific systems are considered. Considerable attention is paid to the problems of information and process management

And setting up a network operating system FreeBSD FreeBSD FreeBSD is a modern operating system for servers, desktops and embedded computer platforms. FreeBSD provides modern networking

LLC "Company "ALS and TEK" Software of the ALS-24000 switch family, ver. 6.01 Installation guide Sheets 13 2017 2 1. GENERAL INFORMATION 3 1.1. Purpose and scope 3 2. COMPUTER REQUIREMENTS

IV. METHODOLOGICAL INSTRUCTIONS FOR ORGANIZING INDEPENDENT WORK OF STUDENTS WHILE STUDYING THE DISCIPLINE “OPERATING SYSTEMS” Name of the discipline section 1. Evolution of operating systems. Purpose

Operating system The operating system is the most important program. The operating system is a set of programs that ensure the interaction of all hardware and software parts of the computer with each other and

4 Laboratory work 1. Installation and configuration of the operating system on virtual machine 1.1. Purpose of the work The purpose of this work is to acquire practical skills in installing an operating system

Federal State Budgetary Educational Institution of Higher Professional Education "National Research Tomsk Polytechnic University" APPROVED by: Head of Education

Laboratory work 1. Navigation through the file structure and its maintenance using the Windows command line interpreter Theoretical part. Directory is a special kind of file containing the names of subdirectories

Operating system Software The operating system is the most important program The operating system is a set of programs that ensure the interaction of all hardware and software parts

Licensing and protection system for platform configurations 1C:Enterprise 8, version 3.0 Administrator's Guide Supported operating systems... 1 System composition... 1 SLK Server... 1 External component...

Introduction Working with the GNU/Linux operating system Currently, the main interface between the user and the desktop operating system is the Graphical User Interface (Graphic User Interface).

PRACTICAL WORK 2 Command line OS Windows Purpose of work: to study the command line interface of Windows OS, acquire skills in solving typical tasks of administering the Windows operating system using

Laboratory work 2 Managing files in the operating system Goals and objectives of laboratory work: obtaining skills in working with an operating system such as Linux; learning the basics of operating room management

CONNECTION MANAGER FOR VIRTUAL WORKSTATIONS TERMIDESK ADMINISTRATOR'S MANUAL (preparing a basic workstation) 23811505.6200.001.I5.01-2 Sheets 17 MOSCOW 2018 1 CONTENTS 1 INTRODUCTION...4 1.1

Federal State Budgetary Institution of Higher Professional Education "SibGUTI" Department of Computer Systems Disciplines "PROGRAMMING LANGUAGES" "PROGRAMMING" Practical lesson 55 OS GNU/Linux Teacher: Associate Professor of the Department of Computer Science, Ph.D. Polyakov Artem Yurievich

Appendix WORKING PROGRAM OF THE ACADEMIC DISCIPLINE OPERATING SYSTEMS AND ENVIRONMENTS Working programm academic discipline Operating systems and environments developed on the basis of the Federal State Educational

2.1. Files. Requirements for information storage: the ability to store large volumes of data; information must be retained after the process is terminated; several processes must have simultaneous

Programming languages ​​and translation methods Presentation for laboratory work 2 Operating system Windows Contents 2 Contents 3 Concept of operating system Operating system (OS) basic software

Installing IBM DB2 v11.1 server on Linux Installing IBM DB2 using the installation wizard requires that you have the graphical interface installed and running, including the X-Window base packages,

1.1 History of the OS The first (1945-1955) computers worked without operating systems; as a rule, they ran one program. When the speed of program execution and their number began to increase, downtime

Managing Rutoken drivers using group policies 2017 Aktiv Company In this document This document describes how to use group policies to automatically distribute the kit

Topic: Purpose: Practical work 23. Basics of working in Ubuntu. Get acquainted with the Ubuntu OS interface, learn how to work with files and directories, launch programs, view text and graphics

Secret Net information security tool Instructions for local updating of the Secret Net client This document contains a detailed description of the sequence of actions for local updating of the client

About the Authors 15 Introduction 17 Structure of the Book 18 From the Publisher 20 Chapter 1. A Brief Review of the Basics 21 Some Basic Commands 21 Displaying Date and Time: The Date Command 21 Identifying Registered Users

HV Manager User Guide 2017 AprilTech, llc. All rights reserved 1 CONTENTS Introduction... 3 Installation and configuration... 4 System requirements... 4 Installation... 5 Configuration... 6 Settings

1 Lab 3 “DATA STREAM REDIRECTION” Streams and Files Logically, all files in a Linux system are organized into a continuous stream of bytes. Any file can be freely copied and added to another