Introduction to Linux In this chapter, we will provide an overview of what Linux is and discuss its purpose. We will also explore the different levels of knowledge in Linux and explain the structure of the course.
Course Structure and Target Audience "Linux Introduction" course consists of 8 sessions, each lasting for 2 hours. The course is designed for beginners who have little or no experience with Linux. It covers a wide range of topics from basic concepts to practical exercises.
Troubles with Virtual Machine Installation Andrei encountered difficulties in installing a virtual machine on his computer. He suggests using an operating system and mentions that he can be contacted via email for further assistance.
"Why Did You Come to This Course?" "What do you hope to gain from this course?" Andrei believes that the course will provide practical and theoretical knowledge about Linux, which is advantageous for future employment opportunities.
Advantages of Linux as a Design Tool Andrei explains why employers prefer designers who are proficient in Linux. He also highlights the benefits of using Linux, such as its cost-effectiveness and versatility compared to other tools like Windows or DOS.
Understanding Server Operations Learn how to analyze server operations and identify the reasons behind their functionality. Explore the importance of system administrators and developers in DevOps.
The Significance of Linux "Linux is what everyone needs," as it provides high-demand skills for Windows administrators, making them highly sought after. Discover the benefits of learning Linux for future career prospects.
Managing Personal Tasks Many people have personal tasks and responsibilities outside of work, such as family obligations. It is important to communicate if you are unable to complete a task or assignment on time. Providing comments in the homework submission can be helpful for explaining any difficulties faced.
Difficulties with Homework Submission "Failing" to submit homework may simply mean that it was not completed on time. If technical issues prevent submitting files, providing written comments about the inability to submit can suffice temporarily until resolved. The goal is ultimately successful completion of assignments.
Introduction to Linux Linux is the operating system used on routers at TsSKA. It is a kernel that provides an environment for running applications. Linux is widely used but not suitable for everyone, as it requires specific tools and knowledge.
Working with Linux Servers "Secure Shell" (SSH) allows remote access to servers using a special program client like SSH Secure Shell or PuTTY. VirtualBox is recommended for virtualization purposes, allowing the installation of Linux as a virtual machine on your workstation.
File Transfer and Server Configuration in Linux To transfer files between Windows and Linux servers, you can use WinSCP or SCP command if working in console mode. Additionally, graphical applications can be run remotely using Xming software through SSH protocol.
Linux Network Configuration Setting up a Linux network can be challenging, but it is not more difficult than setting up a Windows workstation. Both have their own IP address and the ability to obtain it through DHCP. Console tasks, such as text-based configuration, may seem complex for beginners who are unfamiliar with them.
Working with Linux on Desktop Environment "I find it easier to modify text configurations rather than clicking around with the mouse," says Andrei. For new users of Linux, there might be some initial difficulties in getting used to the operating system compared to Windows. However, once you get familiarized with Ubuntu or any other distribution installed on your machine as the primary OS, everything should work fine.
The Birth of Unix In the curious year of 1970, Unix was born and became a popular system for programming. It marked the beginning of the computer era and introduced concepts like time calculation. The development of Unix split into different branches, with BSD becoming its own operating system.
The Rise of Linux "Linux" is an independent operating system that originated from Unix. It gained popularity due to its simplicity and reliability, especially in server environments. Commercial versions like AX HP X Solaris were also developed by vendors.
Unix in Commercial Environments Unix systems found their place in commercial settings such as banks' processing centers or stock exchanges where reliability is crucial. However, these systems are not commonly used on personal computers due to differences in architecture.
GNU Project: A Free Operating System Richard Stallman created GNU (GNU's Not UNIX) project aiming to develop a free and open-source operating system after conflicts with Xerox over proprietary software limitations.The project contributed significantly to the concept of free software.
The Evolution of Operating Systems - The evolution of operating systems has led to the development of modern and complex systems. - Linux is a popular operating system that combines the GNU project with its own kernel. - Windows NT introduced advanced protection mechanisms for processes.
Understanding Kernel and Environment - In modern operating systems, there are two main components: the kernel and the environment or user space. - Programs in MS-DOS could directly access hardware, but this is not possible in contemporary systems. - The kernel acts as a barrier between programs and hardware resources.
Hardware-Level Protection Rings - Hardware-level protection rings were introduced with processors like 286 and fully implemented in 386 processors. The rings provide access control to hardware resources at different privilege levels. The kernel operates at ring zero, which grants maximum privileges.
Operating System Structure - An operating system consists of both the kernel (core) functionality as well as other software components such as libraries. The interaction between programs occurs through system calls handled by the OS's core/kernel.
Understanding the Language of Operating Systems The language of communication between software and the core of an operating system is different for each OS. In Windows, it's called win32p, while in Linux, it's called POSIX. These languages allow programs to interact with the kernel through system calls.
"Standardizing" Programming Languages "Richard Stallman created a free and open-source container collection that allowed programs written in Unix to work on other systems." This standardized programming language enabled compatibility across different operating systems.
Benefits of Open Source Software Open source software allows developers to access and modify its source code freely. It also enables cross-platform functionality by providing compatibility with various operating systems.
Customizability and Flexibility in Linux Linux offers users the ability to customize their own version of an operating system according to their specific needs. Users can add or remove components such as graphics drivers or network services based on personal preferences.
The Importance of Custom Linux Distributions Custom Linux distributions are valuable because they allow users to create their own distribution with specific software and kernel versions. Official Linux distributions may not have the desired software or kernel, so custom distributions fill this gap.
Differentiating Factors Between Distributions 'Vanilla' kernels refer to the original, unmodified version of a kernel that can be downloaded from sites like kernel.org. Some companies modify these kernels to create their own customized distributions. The difference between different distributions lies in the selection of included software and modifications made to the vanilla kernel.
Financial Support for Distributors Large companies like Oracle and Red Hat provide financial support for free and open-source distributives. This funding helps cover development costs since creating a distribution requires time and resources.
Variety in Software Selection Differences between distros lie primarily in their selection of pre-installed software packages.
Network Communication Basics Network communication is based on the Open System Interconnection (OSI) model, which consists of different layers. The physical layer involves physically connecting computers, while the data link layer identifies and establishes connections between them. To transmit information in a network, we need protocols like TCP/IP that define how data is delivered from one address to another.
Understanding IP Addresses and Protocols "IP addresses" are used to identify computers in a network. They are part of the networking protocol called TCP/IP. This protocol ensures reliable delivery of information by confirming its receipt at the destination address. Other protocols like UDP also exist for delivering data between IP addresses.
UDP vs TCP UDP is a protocol that allows for faster transmission of data, while TCP ensures reliable delivery with some delay. The choice between the two depends on the need for speed or accuracy.
Understanding Ports 'Port' is a number used to identify applications in network communication. Different ports are reserved for specific applications, such as port 22 for SSH and port 80 for HTTP.
Linux Distribution and Homework Linux distributions provide ready-to-use packages of software. Completing homework assignments may require installing programs using package managers.
Introduction to Linux and Command Line Linux is an operating system that uses the command line interface. The command line allows users to interact with the system by sending commands. The 'ls' command displays the contents of the current directory.
'ls' Command and File Types 'ls' is a command used in Linux to list files and directories in the current directory. It provides information about file types, such as directories (denoted by 'd') or regular files (denoted by '-').
Understanding File Permissions 'ls -l' shows detailed information about files, including permissions. Each file has three sets of permissions: read ('r'), write ('w'), and execute ('x'). These permissions determine what actions can be performed on a file.
Changing Home Directory In Linux, the home directory of each user can be changed. By default, it is located in the /home directory. The command 'ls -l' shows the contents of a specific directory.
/etc and Configuration Files /etc is a standardized directory where configuration files are stored in Linux systems. It contains important system settings and configurations for various programs.
Root User and Root Directory The root user has its own home directory called '/root'. This is different from other users' home directories which are usually located in the '/home' directory.
Directory Structure Overview '/' (root) is the top-level or parent folder that contains all other directories on a Linux system. Some common directories include: /bin (binary files), /usr/bin (user binaries), /var/log (log files).
Understanding File Extensions File extensions are used to indicate the type of file or its purpose. They can be helpful for users and programs that filter files based on their extension.
Working with Current and Parent Directories 'ls' command lists the contents of a directory. 'ls -a' shows hidden files, which start with a dot in Linux. The current directory is represented by '.', while '..' represents the parent directory.
Deleting Files To delete a file, use the command 'rm' followed by the filename. If there are multiple files starting with the same letter, press Tab to autocomplete. You can also use 'Tab' to see all available options for autocompletion.
Creating Directories 'mkdir' is used to create directories. To view the contents of a directory, you can use 'ls'. Use 'ls -a' to show hidden files as well.
Recursive Removal of Directories
The command 'rm -r
Standard Output and Error Streams The standard output stream (std out) is used to display the result of a command's correct execution. The standard error stream (std err) is used to display any errors that occur during the execution. By default, both streams are directed to the terminal or device file.
Redirecting Standard Output "ls -l > file" redirects the standard output of "ls" command to a file named "file". This allows us to save or redirect the output as desired.
Redirecting Standard Error To redirect only error messages, we can use ">>", for example: "command >> error.log 2>&1", this will append all errors from 'command' into 'error.log'.
Understanding Command Structure Commands in Bash can be structured from left to right, with each command interpreting symbols and executing accordingly. For example, when a symbol is encountered, it is expanded or executed based on the interpretation of the command. This allows for redirection of standard output streams and creation of new files if they don't exist.
'ls' Command Output Redirection 'ls -l' command lists files in a directory along with their sizes. By redirecting the output stream to a file using '>', we can create or overwrite an existing file with this information. The size of the redirected file will reflect any changes made after executing commands like 'ls'.
Redirecting Input/Output Streams '>' redirects standard output stream to write data into a specified file. '<', on other hand ,redirects input from given filename instead reading it directly '|'(pipe) takes stdout (standard out) as stdin(standard input)
Expanding Team Capabilities The video discusses the ability to expand team capabilities by using a command that allows for extensive growth. This is demonstrated through creating directories and files, as well as moving and renaming them. The speaker encourages experimentation with these commands.
'Cat' Command for File Manipulation 'Cat' command is introduced as a way to combine multiple files into one output file. The speaker explains how this can be useful in various scenarios, such as concatenating text or extracting specific lines from files.
Using Filters: 'Head', 'Tail', and Word Counter The usage of filters like 'head', 'tail', and word counter are discussed in this chapter. These filters allow users to manipulate the content of files by displaying certain number of lines at the beginning or end, counting words or lines within a file.
Filtering and Searching You can filter out unwanted content by using the 'grep' command. It allows you to search for specific patterns in a file or output. The 'grep' command is very useful for finding and manipulating text.
'Grep': A Powerful Text Editor 'Grep' is a powerful text editor that originated from earlier editors like Visual, but with additional features. Unlike traditional editors, it doesn't display the entire file; instead, it displays only the lines matching your specified pattern.
Global Search with Regular Expressions 'Grep' also supports global searches using regular expressions (regex). This feature was so popular that it became its own separate program called 'greb'. You can use regex patterns to find specific information within files or outputs.
Filtering File Content In this chapter, we learn how to filter the content of a file using the 'grep' command. We can specify a pattern of characters that we want to search for in each line of the file. By providing the file as an argument, we can filter out only those lines that contain our desired pattern.
'cd' Command and Changing Directories 'cd' is used to change directories in Linux. If no arguments are provided, it takes us to our home directory. We can also navigate up or down through directories by specifying relative paths with 'cd'. It's important to note that if we enter 'cd ..', it will take us one level up from our current directory.
Working with Hidden Files and Directories Hidden files in Linux start with a dot (.) symbol. There are various ways to view hidden files: using commands like 'ls -a', redirecting output from commands into another command ('|'), or directly accessing them by specifying their names starting with '.'
Removing Unnecessary Files To remove unnecessary files, we can use the command 'grep -v Total'. This will exclude any lines that contain the word 'Total' from our output. By doing this, we can filter out unwanted information and focus on what is needed.
'-v' Option for Filtering '-v' option in grep allows us to invert the matching pattern. In this case, it excludes lines containing a specific pattern ('Total'). We can also combine multiple options like '-iv', which ignores case sensitivity as well.
Filtering with Regular Expressions We can further refine our filtering using regular expressions. For example, using '^.*.[a-zA-Z]+$' will only display lines ending with a file extension (e.g., '.txt', '.jpg'). This helps us narrow down our results even more effectively.
Understanding File Masks A file mask is a pattern that specifies the files or directories to include or exclude. It can contain any number of characters, including wildcards (*), which represent any character(s). The command 'ls' with a file mask as an argument displays the contents of the specified directory matching the pattern.
'ls' Command and Hidden Files 'ls' command lists files and directories in a given location. By default, it does not display hidden files (files starting with dot). However, using specific options like '-a', all files including hidden ones can be shown.
Filtering Files with 'grep'
'grep' is a powerful tool for filtering text based on patterns. It searches for lines containing specific words or expressions in one or more input files. For example, you can use 'grep -r
Classification of Operating Systems There are three classifications of operating systems: single-user, single-tasking; multi-user, single-tasking; and multi-user, multitasking. Each classification has its own characteristics and limitations.
Examples of Operating Systems "Windows" is an example of a single-user, single-tasking operating system where only one user can use the computer at a time. "Windows 95" is an example of a multi-user, multitasking operating system that allows multiple programs to run simultaneously. "Linux" is another example which supports multiple users and tasks.
Root User in Linux There are two types of users: Root user and all other users. The root user is the unique user in the Linux operating system with unlimited power. It can access any information, create directories or files without restrictions.
Limitations on Other Users "All other" users refer to regular users who have limitations imposed by the Windows operating system. However, the root user has no such limitations and can do anything on the server.
Working as Root User Working under the root user is not recommended unless necessary for making changes to our operating system like adding new files, installing software, modifying configuration files, etc.
User Identification and Access Control Each user has a unique identification number (UID). The UID of "root" is always 0 while other regular users have UIDs greater than 1000. Identifiers below 1000 are classified as service accounts used by various programs or services running on servers.
User Identification and Authentication - Linux identifies users by their username and assigns them a unique identifier called UID. - The root user, with UID 0, has unrestricted access to the entire system. - Other users have limited privileges based on their assigned UIDs.
File Ownership and Permissions - Each file in Linux has an owner who created it and belongs to a primary group. - File permissions are divided into three types: read (r), write (w), execute (x). - Owners can set different permission levels for themselves, their group members, or others.
Access Control for Users and Groups - Files can be accessed based on the user's ownership or membership in specific groups. - Access rights include read-only access or both read-write access. n - Strict rules determine which permissions apply to each category of users.
Understanding File Permissions File permissions in Linux determine the access rights for different users. The executable permission allows accessing a directory, while the CD command is used to navigate through directories. Default permissions in Linux are less convenient than Windows as they restrict certain actions like editing files. To modify file permissions, the sudo command can be used.
User Information and User Groups "/etc/passwd" stores user information such as username and UID, "/etc/group" contains group information of users, and "/etc/shadow" holds password-related data. These three files together identify each user on the system. Changing home directory ownership or default shell can be done by modifying these files.
Authentication vs Authorization Authentication verifies if a user exists on the server by checking their login credentials (username/password). Authorization determines whether a user has permission to access specific resources or perform certain actions within an authenticated session. In summary: Authentication checks who you are; authorization checks what you're allowed to do.
Understanding System Access System access is granted based on user permissions and group settings. The SVD file has unrestricted access, while the Shadow file has limited access to only read by Root or a specific special group. CentOS does not allow any modifications to its files, making it secure. Passwords are stored as hashes in the system's cache.
Introduction to Hash Functions 'Hash' refers to a function that converts one set of data into another and produces a unique result. It lacks reverse transformation capabilities, meaning we can't determine the original input from just knowing the output value. Hash functions always produce results of fixed size regardless of input size.
Importance of Securely Storing Passwords Storing passwords securely is crucial for system security because if someone gains unauthorized access to your password, they can bypass authentication mechanisms.
Changing User Permissions To change user permissions, the 'chmod' command is used. There are different types of permissions: owner, group, and others. You can remove or add specific permissions using the '-' and '+' symbols respectively.
'chmod' Command for Adding Permissions 'Chmod +rwx' adds read, write, and execute permissions to a user. These changes will apply to all users in the specified group as well.
Inheritance of File Permissions File permission inheritance does not exist by default in Unix-like systems. However,it is possible to assign additional rights through special commands like symbolic links ('symlink').
Binary System and Computer Convenience Computers find binary system most convenient because it is the most stable. Understanding what each digit represents allows for easy calculations.
'644' - Numeric Representation of File Permissions '644' represents file permissions where '6' indicates read and write access for the owner, '4' indicates read-only access for group members and others.
Understanding File Storage: Blocks, Index Descriptors, and Names File storage involves three main components: saving data physically on a disk, informing the file system about its location through index descriptors, and naming files or directories separately from their actual content.
Understanding File Systems A file with a specific parameter and attribute is called a directory, like libraries in a library. When you want to find a book in the library, you go to the catalog, look for the title of the book, and see where it is stored on the shelf. Similarly, files are organized into directories within your home directory. Directories store names of other files or directories as special files known as catalogs.
Hard Links vs Soft Links "Katalog" (catalog) is just another name for "fail" (file). Each file has its own unique number within one disk. Hard links are additional names given to existing files or directories without affecting their content or properties. They allow multiple names referring to one file.
Understanding Hard Links Hard links are simply file names that point to the same data. They can exist on the same disk or different disks, but cannot cross between them. Soft links, also known as symbolic links, are more like shortcuts and contain information about where to look for the actual file.
Advantages of Soft Links "Soft Link" is a new file that contains information about where to find another file. It allows us to have multiple names for the same data without duplicating it. Soft links always have permission 777 and provide an alternative path to access files with different permissions.
Limitations of File Deletion When we delete a file, we remove its entry from the current directory but not necessarily its content from storage until all hard link references are removed.
File Management and Optimization - File management involves creating, deleting, and optimizing files. - Hard links are simply file names that point to the same data on disk. - Symbolic links are shortcuts or aliases to other files or directories.
Understanding Directories - Directories store information about files in a filesystem. - They can be identified by their own unique attributes. - Comments in code can help clarify the purpose of directories.
Regular Expressions for Pattern Matching - Regular expressions (regex) solve complex pattern matching problems that cannot be solved with simple string operations. - Regex is used for tasks like validating MAC addresses and IP addresses. n - It requires understanding regex syntax and using it effectively in programming languages.
Introduction to Linux Linux is a complex operating system, especially for beginners. It has a large volume of information that can be overwhelming for someone who has never worked with it before.
Understanding File Ownership and Permissions "Sticky bit" is an important concept in Linux file systems. Each process in the operating system has its own owner, and only the root user can modify certain files like /etc/shadow.
Changing User Passwords using Sudo Command To change a user's password when you don't have permission to edit the file directly, you need to run a special binary program called "pswd" as the root user. This program allows users with access rights to modify specific files owned by them.
Running the Program To run the program, you need to enter the owner's name. Once entered, it automatically launches a file with specific criteria. Only the owner can change permissions for files and directories.
Changing Passwords "pswd" is used to change passwords in Linux systems. It requires root privileges and can only be changed by either Root or by oneself if logged in as Root.
Understanding the Execute Attribute The execute attribute allows or restricts access to a directory. If execute permission is removed from a directory, accessing it will be denied. However, if execute permission is granted, the contents of the directory can be viewed.
"X" Permission for Beginners and Advanced Users "X" permissions determine whether executing files within a directory is allowed or not. It affects reading information from individual files in that directory as well.
Opening and Closing Files with LS Command To open a file for reading, you can use various methods like using an editor or command line tools such as 'less'. The LS command only shows the content of current or specified directories but does not open them entirely.
Creating and Managing Directories - To create a directory, use the command 'mkdir' followed by the desired directory name. - You can navigate into a directory using the 'cd' command. - Use 'ls' to list all files and directories in your current location.
File Permissions and Ownership - File permissions determine who can read, write, or execute a file. They are represented by three sets of characters: owner, group, and others. - The commands 'chmod', 'chown', and 'chgrp' are used to change file permissions or ownership. - Only the owner of a file has permission to delete it.
Working with Users and Groups - Users can be created using the command ‘useradd’ followed by their username. The user's password is set with ‘passwd’. The primary group for each user is specified during creation but additional groups may also be assigned later on.
Switching Users with Sudo To switch to another user using sudo, you need the password for that user. If you run the 'su' command without specifying a username, it will prompt for the password of the current user. However, if you run 'sudo su', it will not ask for a password and switch to root shell.
'.' and '..' in Directory Names '.' represents the current directory while '..' represents one level up in directory hierarchy. These are hardlinks pointing to specific directories. For example, if we create a new folder named 'test', its '.' link points to itself and its '..' link points to its parent directory.
Regular Expressions Basics Regular expressions provide patterns used for matching text sequences based on certain rules or templates. Special characters like '*', '?', '+' are commonly used along with symbols like '.', '[ ]'. Regular expressions originated from Perl language but have been adopted by many other programming languages as well.
Understanding MAC Addresses MAC addresses are physical addresses of network devices, unique to each device. They are used to assign IP addresses and identify computers on a network.
Creating Regular Expressions for MAC Addresses "grep -p" command can be used with regular expressions to extract specific information from a stream of text. By specifying the pattern for MAC address, we can filter out other irrelevant data.
Constructing Regular Expression Patterns Regular expression patterns consist of character ranges enclosed in square brackets [ ], allowing us to specify any digit or letter within that range. The syntax is concise and flexible.
Simplifying Regular Expressions Using regular expressions to simplify IP addresses by removing repetitive segments and specifying the number of characters in curly brackets.
"Set -OVI" Command Line Usage "Set -OVI" command line usage for copying and duplicating blocks of code, with examples.
Regular Expression Patterns for IP Addresses Explaining how to create regular expression patterns for IP addresses using character ranges and breaking down the address into octets.
Understanding Diapasons There are two identical diapasons that we can experiment with. They describe a range of values, such as 109 or 10. We can combine them by saying 'one, comma, two' to represent either one diapason or two.
Approaches in Programming 'Programming involves writing things compactly and clearly.' There are at least two approaches: writing code concisely or making it easily understandable. The structure is determined by the task at hand.
Working with Regular Expressions 'Regular expressions provide templates for specific purposes.' For example, they can be used to filter quantities like ranges or symbols in programming tasks. By using regular expressions effectively, you can simplify complex patterns and achieve desired results efficiently.
The Complexity of Ranges Working with ranges requires constant practice and memorization. Different ranges are written differently, such as kilometers being represented numerically. However, some ranges like MAC addresses have a fixed length while IP addresses have a variable length due to the need for character splitting.
Understanding Regular Expressions "\d" represents numbers from 0 to 9 in regular expressions. The symbol "$" denotes the end of a line or string. By using square brackets [], we can specify multiple characters that are allowed within certain limits, such as [0-9] representing digits from 0 to 9.
Applications and Limitations of Regular Expressions Regular expressions can be used compactly in scripts for various purposes but may not be suitable for all scenarios, especially when dealing with complex filters or specific patterns that cannot be easily expressed using regular expressions alone.