Identifying the basics of linux

Identifying the basics of Linux

Identifying the Linux file system:

Thousands of files can be stored on a single fixed disc. To organize data by grouping files on the disk, operating systems provide a file system.

When UNIX was developed, several features were introduced in it. One such feature was its file system. The UNIX file system has a hierarchical structure and files can be stored in directories. An analogy can be drawn between these directories and the drawers of a filing cabinet. Just as each drawer contains files, each of which contains documents of a similar nature, the directories on the disk can be created to store files containing data of a similar nature. Linux adheres to the UNIX file system standard.

The following figure depicts a sample Linux hierarchical file system structure.


All the files are stored on the disk in one main directory, / (root). The directory, I, has been further subdivided into directories, such as bin, boot, home, etc, us, and dev. In each directory, files containing related data can be stored. The administrator of the Linux system may place all the home directories of the users in the home directory. For example, the directory, tom, is the home directory for the user, tom. He will store all his files in his home directory, tom, or create new directories in it.

The directory, tom, contains two files, namely Program1 and Program2, and two directories, Desktop and Template. The Desktop directory contains two files, Default, and Start.

A file is identified in the file system hierarchy by its path name, which is composed of the file name followed by the name of the directory housing the file. Until the / directory is reached, the path name may contain a number of directories, each of which contains another. The / sign divides the path's file name and various directory names.

For instance, in the previous figure, the full path of the file, start, can be given as /home/tom/Desktop/start.

Similarly, the path for the file, Is, is /bin/Is. As you notice, the / is a special character, and therefore, it cannot be included in a file or a directory name.
in a hierarchical inverted tree-like structure, the operating system provides rapid access to cause.

Groups of files are isolated from each other. Only one directory (a smaller number of files) has to be searched to locate a file. On the other hand, if there were no subdirectories and all the files were stored in the files located.

directory, 1, then locating a file would have meant searching through the entire list of files until the required The hierarchical inverted tree file system of Linux is also found in MS-DOS. There is, however, a major difference between the MS-DOS and Linux file systems. Linux consists of hundreds of files that are provided along with a Linux-based system. Conversely, MS-DOS consists of only three files. When you install Linux, it creates a number of directories and subdirectories to store the operating system files. Thus, unlike MS-DOS, Linux enforces the hierarchical file system. MS-DOS is much smaller than Linux in terms of storage requirements.

Some of the directories in the / directory are:

  • The /bin directory: It stores many utilities of Linux. These utilities are the commands available in the Linux system. They are in the binary format, hence the name bin.

  • The /dev directory: It stores all the device-related files for the system.
  • The /etc directory: It stores the system-related data that the users and the system need to refer to, such as the passwd file. These are generally the essential miscellaneous system programs and configuration files.
  • The /lib directory: It contains libraries of data for the compilers installed on the system, such as the C language routines.
  • The /home directory: It contains all the home directories of users.
  • The /usr directory: It stores the operating systems files, which are not involved in the boot process Many utilities are available in the bin directory in the us directory. The /ust/bin directory is different from the /bin directory.
  • The /var directory: It has information specific to different utilities of Linux.
Each of these directories has been organized to store a specific type of file.

Type of files in Linux:

in Linux, all information is considered as a file. Therefore, besides a user's program files and data files, there. are special files that contain information about directory content or the various input/output devices connected to the system. In Linux, a device is also treated as a file and all the information going to Visual Display Unit is treated as if it were being sent to a file. Linux has the following three categories of files:

• Ordinary files

• Directory files

• Special files

Ordinary Files 

All the files created by a user come under the ordinary category of files. These include all the data files, program files, object files, and executable files. A user can make changes to such files.

Directory Files 

The directory file contains a list of all the files and directories that is present in a directory. A directory file is not modified by a user. Instead, it is modified automatically by the system when a new file or a subdirectory is added to the directory.

Special Files

The majority of Linux's system files are unique files. They can be found in the common Linux directories, such as /dev and /etc, and are often connected to I/O devices. Special files cannot be changed by users.

Linux supports the following types of special files:
  • Character Device files: Files called Character Devices read and write data one character at a time. A character device file is something like a modem. Sequentially accessed devices and character devices are synonyms.
  • Block Device files: Block Device files can access a block of data at a time. Generally, a block of data can be either 512 or 1,024 bytes. Here, the kernel reads or writes a minimum of one block of data at a time. The kernel collects the data in the memory for block memory and then makes it available to a user. Such devices allow random access. This makes I/O operations quick. An example of a block device is the hard disk.
Many of the devices can act as character devices or block devices depending on the command that is used to access the device.
  • Hard links: Special files called hard links enable a single file to have many names. A directory cannot have a hard link file; only a file can. Because they establish a direct link to an inode, these linkages are referred to as hard links. You can only build hard links between files when they are on the same file system since each file system has its own inode information database. A hard link can lead to security problems if it is created on files that are on the partition containing the system files. Users can use this to prevent administrators from fully upgrading a system by pinning possibly vulnerable setuid or setgid files.
The most recent version of the Fedora operating system only allows users to build hard links on files for which they are the owner or have read/write rights to prevent the creation of this type of hard link. In the most recent release of Fedora, this feature is turned on by default.
  • Symbolic links: Symbolic links, also known as soft links, are similar to hard links, except that they can work across different file systems.

    There are two more types of special files .sockets and named pipes .

    Sockets enable inter-process communication and use a network port to connect processes running on different computers. Named pipes transfer data between two processes running on the same computer where the output of one or more processes acts as input to another process. Hence, Named pipes are also referred to as First In First Out (FIFO) files.



Types of users in Linux:

Linux can restrict access to a file depending on the type of user accessing the files. the user's types supported by Linux are :

System administrator
  • File owner
  • Group owner
  • Other users
System administrator:

The system administrator is primarily responsible for the smooth operation of the system. It is the administrator's job to switch on the system console (the computer on which the operating system resides, also known as the server machine). The system administrator also creates users and groups of users for the system and makes backups to prevent loss of data due to system breakdown. In Linux, the system administrator is also known as the root user. The system administrator has all the rights to the Linux system.

File Owner

The user who creates a file is said to be the owner of that file. The owner can perform any operation on that file, such as copying, deleting, and editing.

Group Leader

Take into account a scenario where a project team from Dynasoft Consultants, Inc. consisting of five individuals is working on a software development project for a private detective service. A team analyst is in charge. Programmers make up the other four team members. The group is developing a Linux system. A few programs have been handed to each programmer to create. The data file has been created in the analyst's home directory because the information provided by the detective agency is of a highly private nature. To test software, one programmer might need to link (join) it to another programmer's program. Each programmer in this scenario is the file owner of their individual software files. Each software, however, also belongs to other programmers, allowing them to utilize it to directly access or link to the file. The five users on the project team are referred to as the file's group owner. You can specify which users will be a part of a group in Linux. Just like a user is given a name, a group of users is also given a name.

Other Users

In the example of Dynasoft Consultants, Inc., all the users of the system who are not members of the project group are referred to as other users for the files of that group. Other users are users who do not belong to the particular group. For example, the users belonging to the Finance department could be treated as other users for the Payroll department.

So that’s it for today guys if you want to learn more about Linux OS follow and stay tuned with guerillateck.com

Thanks for learning give us your feed back?

Identifying directory commands of Linux part 4 coming soon

SECURITY FOR THE LINUX USER | HOW TO SET PASSWORD IN LINUX

STARTING A LINUX SESSION

SECURITY FOR THE LINUX USER: PASSWORDS

The process used to launch a Linux session makes sure that only users with permissions can access the system.

Your login name is shown on the screen when input, making it simple for anyone to find out what it is. As a result, the login process is not a perfect system. Linux solves this issue by allowing you to link your login name and password together for an additional layer of security. When logging in using a password-protected username, you must enter both the password and the username. Linux examines the pair to see whether it is an authorized entry. If the username and password are both provided correctly, the Linux prompt will only show. Otherwise, you will be prompted to enter your login and password again. It is important to note that while entering them, passwords are not visible on the screen.

CHANGING THE USER PASSWORD

A user can also change the password with the passwd command. The following example demonstrates the process of changing the password by the user, cappi:

[cappi@localhost ~]$ passwd

Changing password for user cappi.

Changing password for cappi.

(current) UNIX password:                              [user enters old password here]

New password:                                               [user enters new password here]

Retype new password:                                 [user re-enters new password here]

passwd: all authentication tokens updated successfully

[cappi@localhost ~]$ _

To make sure that only the authorized user is attempting to change the password, the passwd command requests the previous password. Linux displays an error notice, 

Passwd: Authentication token manipulation error, and the Linux prompt appears on the screen if it is unable to recognize the old password, as demonstrated in the following example:

[cappi@localhost ~]$ passwd

Changing password for user cappi.

Changing password for cappi.

(current) UNIX password:                           [user enters the wrong password]

passwd: Authentication token manipulation error


[cappi@localhost ~] $

UNIX asks for retyping a new password. If the passwords do not match, UNIX displays an error message, Sorry, passwords do not match and asks to retype the new password. This is shown in the following example:

[cappi@localhost ~]$ passwd

Changing password for user cappi.

Changing password for cappi.

(current) UNIX password:

New password:                                             [user enters a new password]

Retype new password:                               [user enters the old password]

Sorry, passwords do not match.               [user enters the wrong new password]

New password: _


[root@localhost ~]# passwd cappi

Changing password for user cappi.

New password:                                             [the root user enters a new password]

Retype new password:                                [the root user re-enters the new password]

passwd: all authentication tokens updated successfully.

VIEWING THE SYSTEM DATE AND TIME

Users can display the current date and time by using the date command. The following example demonstrates the date command:

[cappi@localhost ~]$ date

Thu OCT 24 15:56:21 IST 2013

 [cappi@localhost ~] $ _

The options of the date command can be used to format the date and time before displaying them.

The options are specified within double quotes and they must begin with a + symbol.

the month, day, and time in hours and seconds can be referred, to as shown in the following table.

OPTION

DESCRIPTION

%m

Displays month of the year (in digits)

%d

Displays day of the month (in digits)

%y

Displays year (last two digits)

%D

Displays date as mm/dd/yy

%H

Displays hour (00 to 23)

%M

Displays minutes (00 to 59)

%S

Displays seconds (00 to 59)

%T

Displays time as HH.MM.SS

%a

Displays abbreviated weekdays (Sun to Sat)

%h

Displays abbreviated month (Jan to Dec)

%r

Displays time in the AM/PM notation













The following example demonstrates the date command along with its options:

[cappi@localhost ~]$ date "+%T"

11:22:45

[cappi@client1 ~]$ date "+%y"

13

The following example demonstrates messages included within the date command:

[cappi@localhost ~]$ date "+DATE : %D"

DATE: 10/24/13


MODIFYING THE SCREEN

The terminal window screen can be modified by using the following commands:

clear: It is used to clear the terminal screen.

tput clear: It clears the standard output device, and the screen, and positions the cursor at the top left corner of the screen.

tput cup: It is followed by the screen coordinates and positions the cursor at the specified row and column. The following example will position the cursor at row 15 and column 20:

tput cup 15 20

tput smso: It sets the screen to reverse video.

tput rmso: It sets the screen back to normal.

tput blink: It displays a blinking output. Note that this option may not work on a Telnet session.

tput reset: It resets the screen back to the default settings.


IDENTIFYING THE CURRENT USERS WORKING ON THE SYSTEM

The who command is used to display the names of all users who are currently logged in the following example demonstrates the who command:

  • Login name
  • Terminal type and number
  • Date and time when logged in
  • The remote hostname of the terminal from where the user has logged in. Note that this is shown only for users who have not logged in from the server.
The output of the who command also consists of the terminal file name and the date and time the user logged in. The first three users in the example above have terminal types of ttyN, where N is a number between 1 and 12. The ty terminal type is given for users who have logged in from the server. many virtual consoles, also called as terminals, can be used to log on from the server at the same time by many users. Linux allows up to six users to log on to the operating system from the server. Virtual consoles can be invoked by pressing the CtrI+Alt+Ex keys, where x is the number from 1 to 6 of the respective function keys. Switching between consoles is made easier by pressing the Alt key or any of the function keys. Keep in mind that a virtual console can only be accessed from the server.

In the preceding output, pts denotes a remote terminal, which is a computer connected to a computer other than the server.

The Who am I command displays the name of the current user logged in. The following example demonstrates the who am I command:


The options available with the who command are shown below:
  • -m = displays the name of the current user logged in. It is the same as who am i.
  • -q = prints only the login names and the numbers of users logged in.

So that’s it for today guys if you want to learn more about Linux OS follow and stay tuned with guerillateck.com

Thanks for learning give us your feed back?

Identifying the basics of linux part 3 coming soon

SQL JOINS | LEARN SQL



HEY GIRUILLIANS WELCOME BACK TO OUR SQL SERIES WE HAVE POSTED 4 BLOGS ABOUT AND THIS IS 6TH IF YOU ARE NEW PLEASE READ PREVIOUS BLOGS TO LEARN WITH FLOW LET’S START

IN THE PREVIOUS CLASS WE HAD LEARNT ABOUT

A. SQL ORDER BY FUNCTIONS:
  • ORDER BY CLAUSE
  • ORDER BY ASC
  • ORDER BY DESC
  • ORDER BY RANDOM
  • ORDER BY MULTIPLE COLUMNS

TODAY WE WILL LEARN ABOUT

A. SQL JOINS
  • SQL Outer Join
    • LEFT OUTER JOIN (or LEFT JOIN)
    • RIGHT OUTER JOIN (or RIGHT JOIN)
    • FULL OUTER JOIN
    • LEFT JOIN (IF NULL)
  • SQL Cross Join
  • SQL KEYS
    • PRIMARY KEY
    • FOREIGN KEY
    • COMPOSITE KEY
    • UNIQUE KEY
    • ALTERNATE KEY
TABLES IN USE

TABLE 1 : GUERILLATECK



TABLE 2: GUERILLA CARS


1. SQL JOINS

In SQL, joins are used to combine rows from two or more tables based on related columns. Joins allow you to retrieve data from multiple tables in a single query, enabling you to establish relationships and extract meaningful information from your database.

2. SQL OUTER JOIN

In SQL, an OUTER JOIN is a type of join that includes unmatched rows from one or both tables involved in the join. It allows you to retrieve records even when there is no match between the joining columns in the tables.

There are three types of OUTER JOIN in SQL:

  • LEFT OUTER JOIN (or LEFT JOIN):
Returns all the rows from the left table and the matching rows from the right table. If there is no match, NULL values are returned for the right table columns.  

 

SYNTAX IS AS FOLLOWS:-

SELECT column1, column2, ...
FROM table1
LEFT JOIN table2 ON table1.column = table2.column;
STRUCTURE FOR LEFT OUTER JOIN


FOR EXAMPLE


OUTPUT:

  • RIGHT OUTER JOIN:-
Returns all the rows from the right table and the matching rows from the left table. If there is no match, NULL values are returned for the left table columns.

 

SYNTAX IS AS FOLLOWS:-

SELECT column1, column2, ...
FROM table1
RIGHT JOIN table2 ON table1.column = table2.column;
STRUCTURE FOR RIGHT OUTER JOIN


For example


Output


NOTE*- Outer joins are useful when you want to include all records from one table, regardless of whether there is a match in the other table. They are typically used when you need to join tables based on non-matching or optional relationships. By including unmatched rows, you can still retrieve relevant data and perform analysis or reporting.

  • LEFT JOIN (IF NULL)
In SQL, you can use a LEFT JOIN and the IS NULL condition to retrieve records from the left table that do not have a matching record in the right table. This allows you to handle situations where you want to perform specific actions or display certain values when there is no match in the joined table.

 

SYNTAX IS AS FOLLOWS:-

SELECT column1, column2, ...
FROM table1
LEFT JOIN table2 ON table1.column = table2.column
WHERE table2.column IS NULL;

Structure of LEFT JOIN (IF NULL)


For example


Output


There are no null values so no entries are displayed

  • RIGHT JOIN (IF NULL)

In SQL, you can use a RIGHT JOIN and the IS NULL condition to retrieve records from the right table that do not have a matching record in the left table. This allows you to handle situations where you want to perform specific actions or display certain values when there is no match in the joined table.

The syntax is as follows:-

SELECT column1, column2, ...
FROM table1
RIGHT JOIN table2 ON table1.column = table2.column
WHERE table1.column IS NULL;

Structure of Right JOIN (IF NULL)


For example:


Output


There are no null values so no entries are displayed

  • SQL CROSS JOIN 
In SQL, a CROSS JOIN, also known as a Cartesian join, is used to combine every row from the first table with every row from the second table. It does not rely on any matching condition between the tables.

 

The syntax for a CROSS JOIN is as follows:

SELECT column1, column2, ...
FROM table1
CROSS JOIN table2;
THE STRUCTURE IS AS FOLLOWS



Output:-


  • SQL KEYS:
In SQL, keys are used to identify and establish relationships between tables in a database. They help ensure data integrity, enforce uniqueness, and facilitate efficient data retrieval. There are several types of keys commonly used in SQL:

a. SQL PRIMARY KEYS

A primary key is a unique identifier for each record in a table. It ensures that each row in the table is uniquely identified and allows for quick and efficient retrieval of specific records. A primary key cannot contain duplicate or NULL values.


b. SQL FOREIGN KEY

A foreign key establishes a relationship between two tables by referring to the primary key of another table. It ensures referential integrity, meaning that the values in the foreign key column must match the values in the primary key column of the referenced table or be NULL. Foreign keys are used to enforce data integrity and maintain relationships between related tables.

 

c. SQL FOREIGN KEY  

A foreign key establishes a relationship between two tables by referring to the primary key of another table. It ensures referential integrity, meaning that the values in the foreign key column must match the values in the primary key column of the referenced table or be NULL. Foreign keys are used to enforce data integrity and maintain relationships between related tables.

 

d. SQL UNIQUE KEY 
  
A unique key enforces uniqueness on one or more columns in a table, similar to a primary key. However, unlike a primary key, a unique key can allow NULL values. Each unique key constraint ensures that the values in the specified column(s) are unique across the table.


e. SQL ALTERNATE KEY

In SQL, an alternate key refers to a candidate key that is not selected as the primary key for a table. It is a unique identifier for each record, just like a primary key, but it is not designated as the primary means of identification. 
  
While a primary key is chosen as the primary identifier for a table, an alternate key provides an additional unique identifier. This can be useful in scenarios where multiple unique identifiers are required or when there are multiple columns or combinations of columns that can uniquely identify a record.

COMPUTER NETWORKING FOR CCNA BEGINERESS | PART - 4

             ( decimal – binary ) (binary – decimal)

There are 5 classes of IP

Classes                               Ranges             
A                                                 1-126 / 127  (loopback)     
B                                                 128-191
C                                                 192-223
D                                                 224-239 { RESERVED }
E                                                 240-254 { RESERVED }


  • A, B, and C classes are for user only
  • Class ‘D’ is for multicasting
  • Class ‘C’ is for Research & Development
  • Class ‘E & D’ is reserved ips
Converting Decimal ip into binary numbers

Ex:- 

192.168.0.1 

192 = 

  • for converting decimal to binary divide by ‘2’
  • binary value (bottom to top)
convert binary to decimal:-
( how to check binary value is correct )

  • Base 2
  • Ex:-

192
1 1 0 0 0 0 0 0
27 26 25 24 23 22 21 20
= 128 + 64 + 0 + 0 + 0+ 0
= 192 
 
  • In the above example, we put base 2
  • Like this


  • Then base multiply with binary
  • Binary with zero will be zero
  • Binary will 1 got a value
  • And the sum of all binary is a decimal number
  • By this, we can check whether the binary number we found is correct or not
  • And also used for converting binary numbers to decimal

HERE ARE A FEW MORE EXAMPLES:-




So you must have understood this much, I am giving you some more examples, you people try and tell the binary in the comments below.

SUBNET MASK OF ANY CLASS OF IP

Classes                               Ranges             

A                                        1-126 / 127 

B                                        128-191

C                                        192-223

D                                        224-239 

E                                         240-254


IPV4 –

1. NETWORK = 1

2. HOST = 0

Subnet mask:- divide IP into network and host part
  • Network is 1
  • Host is 0 
  • Each octave is of 8 bits
For example:-

N.H.H.H
11111111,00000000,00000000,00000000

CLASS A:-

11111111,00000000,00000000,00000000 
255.0.0.0

CLASS B:-

11111111, 11111111,00000000,00000000 
255.255.0.0

CLASS C:-

11111111, 11111111, 11111111,00000000
255.255.255.0



HOW TO FIND THE NUMBER OF HOST IN CLASSES AS GIVEN BELOW

CLASS A:-

Number of hosts
 
N = 8 bits
 
H = 24
 
No of host = 2 ( host bits ) -2
 
= 2 24
 
= 16,777,216 – 2

= 16,777,214 total number of host


CLASS B:-

N.N.H.H
 
N = 16 bits
 
H = 16 bits
 
No of host = 2 ( host bits ) -2
 
= 216 -2
 
= 65,534 -2 = 65,534


CLASS C:-

N.N.H.H

N = 24 bits

H = 8 bits

No of host = 2 ( host bits ) -2

= 28 -2

= 256-2 =254