0% found this document useful (0 votes)
14 views

LINUX Module 1

The document provides information about the history and development of the Linux operating system in 3 paragraphs. It discusses how Linux originated from the MINIX operating system and notes that in 1991, Linus Torvalds began developing the Linux kernel while he was a student. It also describes Richard Stallman's GNU project and how the Linux kernel was created to complete the GNU operating system.

Uploaded by

Vignesh C M
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

LINUX Module 1

The document provides information about the history and development of the Linux operating system in 3 paragraphs. It discusses how Linux originated from the MINIX operating system and notes that in 1991, Linus Torvalds began developing the Linux kernel while he was a student. It also describes Richard Stallman's GNU project and how the Linux kernel was created to complete the GNU operating system.

Uploaded by

Vignesh C M
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

1

Unit I Linux OS: History, Features and benefits of Linux, basic concepts of multi user system,
open source, free Software concepts, Types of users in Linux, Types of files. BASICS : login,
password, creating an account, shell and commands, logout, changing password, files and
directories, relative and absolute pathnames, directory tree, current working directory, referring
home directory, creating new directories, copying files, moving files, deleting files and directories
, wild cards, hidden files, cat command

History of linux OS

MINIX. Os was written from scratch by Andrew S. Tanenbaum, a US-born Dutch professor
who wanted to teach his students the inner workings of a real operating system. It was designed to
run on the Intel 8086 microprocessors. s an operating system, MINIX was not a superb one. But
it had the advantage that the source code was available. Anyone who happened to get the book
'Operating Systems: Design and Implementation' by Tanenbaum could get hold of the 12,000 lines
of code, written in C and assembly language

In 1991, Linus Benedict Torvalds was a second year student of Computer Science at the
University of Helsinki and a self-taught hacker.

At that time, programmers worldwide were greatly inspired by the GNU project by Richard
Stallman, a software movement to provide free and quality software. His idea was that unlike
other products, software should be free from restrictions against copying or modification in order
to make better and efficient computer programs . With his famous 1983 manifesto that declared
the beginnings of the GNU project, GNU stands for GNU not Unix . His dream was to create a
free operating system . he needed to create the tools first. So, beginning in 1984, Stallman started
writing the GNU C Compiler(GCC),

By 1991, the GNU project created a lot of the tools. The much awaited Gnu C compiler was
available by then, but there was still no operating system. Even MINIX had to be licensed.(Later,
in April 2000, Tanenbaum released Minix under the BSD License.) Work was going the GNU
kernel HURD, , failed to attract enough development effort, leaving GNU incomplete.

the history of Linux began in 1991 with the commencement of a personal project
by Finnish student Linus Torvalds to create a new free operating system kernel

,while studying computer science at University of Helsinki, Linus Torvalds began a project that
later became the Linux kernel. He wrote the program specifically for the hardware he was using
and independent of an operating system

In August 25, 1991 Linus post the first release of linux in to newsgroup

Official mascot(logo of linux) --The TUX

Torvalds announced in 1996 that there would be a mascot for Linux, a penguin

Navajyothi College Cherupuzha


2

Free Software Foundation (FSF) is a non-profit organization founded by Richard Stallman on


4 October 1985 to support the free software movement, which promotes the universal freedom to
study, distribute, create, and modify computer software,[4] with the organization's preference for
software being distributed under copyleft..Free means not free of cost ,it’s a freedom to use

The GNU General Public License (GNU GPL or GPL) is a widely used free software license,
which guarantees end users the freedom to run, study, share and modify the software.[7] The license
was originally written by Richard Stallman of the Free Software Foundation (FSF) for the GNU
Project, and grants the recipients of a computer program the rights of the Free Software
Definition.[8] The GPL is a copyleft license

Components of Linux System


Linux Operating System has primarily three components

 Kernel − Kernel is the core part of Linux. It is responsible for all major activities of this
operating system. It consists of various modules and it interacts directly with the
underlying hardware. Kernel provides the required abstraction to hide low level hardware
details to system or application programs.

 System Library − System libraries are special functions or programs using which
application programs or system utilities accesses Kernel's features. These libraries
implement most of the functionalities of the operating system and do not requires kernel
module's code access rights.

 System Utility − System Utility programs are responsible to do specialized, individual


level tasks. It includes commands such as ls,cp,grep etc.these system utilities are designed
to powerful tools that do a single task extremely well.

Navajyothi College Cherupuzha


3

Architecture
The following illustration shows the architecture of a Linux system −

Navajyothi College Cherupuzha


4

The architecture of a Linux System consists of the following layers −

 Hardware layer − Hardware consists of all peripheral devices (RAM/ HDD/ CPU etc).

 Kernel − It is the core component of Operating System, interacts directly with hardware,
provides low level services to upper layer components.

 Shell − An interface to kernel, hiding complexity of kernel's functions from users. The
shell takes commands from the user and executes kernel's functions.

 Utilities − Utility programs that provide the user most of the functionalities of an operating
systems.

Important parts of the kernel

The Linux kernel consists of several important parts: process management, memory management,
hardware device drivers, filesystem drivers, network management, and various other bits and
pieces. Figure 2-1 shows some of them.

Figure 2-1. Some of the more important parts of the Linux kernel

Navajyothi College Cherupuzha


5

Probably the most important parts of the kernel (nothing else works without them) are memory
management and process management. Memory management takes care of assigning memory
areas and swap space areas to processes, parts of the kernel, and for the buffer cache. Process
management creates processes, and implements multitasking by switching the active process on
the processor.

At the lowest level, the kernel contains a hardware device driver for each kind of hardware it
supports. Since the world is full of different kinds of hardware, the number of hardware device
drivers is large. There are often many otherwise similar pieces of hardware that differ in how they
are controlled by software. The similarities make it possible to have general classes of drivers that
support similar operations; each member of the class has the same interface to the rest of the kernel
but differs in what it needs to do to implement them.

Linux file system(Directory tree)


Linux accesses every object as file. Files are systematically organized in directories. Linux file
system has a tree structure.
the tree of the file system starts at the slash, indicated by a forward slash (/). This directory,
containing all underlying directories and files, is also called the root directory or "the root" of the
file system. All files and directories are created and managed under the root directory. Since root
directory stands on the top in file system, it has no parent directory. Besides root directory, every
directory in Linux has a parent directory. The following are the common system directories under
the file system

/sbin - This directory contains all the binaries that are essential to the
working of the system. These include system administration as well as
maintenance and hardware configuration programs. Find, lilo, fdisk, init,
ifconfig etc here. These are the essential programs that are required by
all the users. Another directory that contains system binaries is /usr/sbin.
This directory contains other binaries of user to the system administrator.
This directory contains system administration commands files. Commands stored in this directory
are available only for root user and usually requires special privilege to run.
Navajyothi College Cherupuzha
6

/bin
This directory contains standard commands files. Commands stored in this directory are available
for all users and usually do not require any special permission to run. Eg: mv,cp,cat

/boot - This directory contains Linux boot loader file.


/dev - This directory contains device files. Usually files in this directory are dynamically
generated and should be never edited. IT contains hda1, hda2 etc, which represent the various
partitions on the first master drive of the
system. /dev/cdrom and /dev/fd0 represent your CDROM drive and your floppy drive. /dev/dsp
file represents your speaker device.
/etc - This directory contains all the configuration files for your system.
Your lilo.conf file lies in this directory as does hosts, resolv.conf and
fstab. More importantly, the /etc/rc.d directory
contains the system startup scripts. This is a good directory to backup
often
/home - Linux is a multi-user environment so each user is also assigned a
specific directory which is accessible only to them and the system
administrator. These are the user home directories, which can be found
under /home/username. This directory also contains the user specific
settings..
/usr
This directory contains user application software files, third party software and scripts, document
files and libraries for programming languages.
/lib - This contains all the shared libraries that are required by system
programs. Windows equivalent to a shared library would be a DLL file.
/lost+found - Linux should always go through a proper shutdown. Sometimes
your system might crash or a power failure might take the machine down.
Either way, at the next boot, a lengthy filesystem check using fsck will
be done. Fsck will go through the system and try to recover any corrupt
files that it finds. The result of this recovery operation will be placed
in this directory. The files recovered are not likely to be complete or
make much sense but there always is a chance that something worthwhile is
recovered.
/mnt
This directory is used to mount remote file system and temporary devices such as CD, DVD and
USB.
/opt - This directory contains all the software and add-on packages that
are not part of the default installation.
/root - this one is the home directory of the user root. This is not to be confused with the system
root, which is directory at the highest level in the filesystem.
Navajyothi College Cherupuzha
7

/tmp - This directory contains mostly files that are required temporarily.
Many programs use this to create lock files and for temporary storage of
data. On some systems, this directory is cleared out at boot or at
shutdown.
/var - This directory contains spooling data like mail and also the output
from the printer daemon.

/proc

/proc is very special in that it is also a virtual filesystem. It's sometimes referred to as a process
information pseudo-file system. It doesn't contain 'real' files but runtime system information (e.g.
system memory, devices mounted, hardware configuration, etc). For this reason it can be regarded
as a control and information centre for the kernel. In fact, quite a lot of system utilities are simply
calls to files in this directory.

Linux User Types

There are different types of accessibility options provided by Linux, from which one can choose
respective access as per requirement. Linux provides 5 different alternatives to choose the
accessibility.
They are as listed below.

1. Super User or Root User : A special kind of user account which holds all kind’s of
permissions to do any alteration to a programs or services of Linux. Especially this kind of user
account is used for system administration. He can control and limit the access of other User’s.
As all the powers is vested for Root User, care has to be taken before performing each and
every modifications, if anything goes wrong, no option left other than crash of Kernel. It is so
sensitive with unlimited accessibility. Take care while logged in as Root
2. System User: It is created by default by the OS. This type of user is similar to normal user but
got more privileges and access to secure programs which normal user doesn’t
got authentication.
3. Normal User : These are the users which have been created by the Root and has limited access
to the resources and need permission from Root to access any secure resources and services.
4. Network User : Users opt this type of user account to check network activity and to manage
them. Especially system administrator‘s and network engineer‘s uses this account
for various networkactivities and to connect to different systems on the network using various
services like NFS,SAMBA, APACHE, NTP etc.

Navajyothi College Cherupuzha


8

5. Pseudo User: It’s a replica of Root User, is used when a user needs the
permissions similar to Root User. Only Root User can give the access to this user account for
others.

Every Users got their own identity and authenticity. , UID (User identifier) is a unique
identity, simply a number given to the user.

Every kind of User type as discussed above are given a particular range of UID’s.

Root User got the UID ‘0‘ . {As root user is prime and supreme authoritative, so he got the UID
” 0 “,

UID for System User lies with in the range of 1 to 499. {Don’t come to a conclusion that Linux
OS can only provide 500 System Users. It’s just a default range provided by the OS, it can be
altered and can add system users greater than 500 but less than a saturation value which depends
on a type Linux OS}
UID for Normal User lies with in the range of > 500 <6000.
UID for Network User lies with in the range of >6000.
If you want to verify yourself just simply type the following command.
[root@localhost~]# whoami
Or else you can also try
[root@localhost~]#id

uid=0( root ) gid=0( root ) groups=0( root )

If you want to switch from one user account to other user account, we use a command called
” su “.
Syntax: su username
Ex:
[root@localhost~] # su John
Password: ********* { Enter the password of John}
The Linux command 'su' is used to switch from one account to another. User will be prompted
for the password of the user switching to. Users can also use it to switch to root account. If user
types only 'su' without any option then It will be considered as root and user will be prompted to
enter root user password.

Navajyothi College Cherupuzha


9

[Jhon@localhost~]$

We can find the type of user as logged in easily by observing above commands. Root User
is accompanied by the symbol ‘ # ‘, where as normal user is accompanied with ‘ $ .

File Types in Linux

Linux will consider everything as files. there are 7 file types in Linux. you can see the file type
indication at leftmost part of “ls -l” command
1. Regular file(-)
2. Directory files(d)
3. Special files
4. Block file(b)
5. Character device file(c)
6. Named pipe file or just a pipe file(p)
7. Symbolic link file(l)
8. Socket file(s

1. Regular files
These are the files are indicated with "-" in ls -l output. We can create the files using commands
like touch,vi,cat etc. these files can be
 Readable files or
 A binary files or
 Image files or
 Compressed files etc.

2.Directory files
These contains the name and location of files/folders/special files stored on a physical device.
And this type of files will be in blue in color. Use mkdir command to create them. The special
entries “.” and “..” refer to the directory itself and to its parent directory;

3.Block files
These files are hardware files most are present in /dev.A block file is a hardware file which
read/write data in blocks instead of character by character. This type of files are very much
useful when we want to write/read data in bulk fashion. All our disks such are HDD, USB and
CDROMs are block devices
Character devices files
4.character file: A character file is a hardware file which reads/write data in character by
character fashion. Some classic examples are keyboard, mouse, serial printer. Character files
uses synchronize Technique to write data

5.Links

A link is a tool used for having multiple filenames that reference a single file on a physical disk.
They appear in a file system just like an ordinary file or a directory.
Navajyothi College Cherupuzha
10

There are two types of links , they are hard links and symbolic links.

Hard links do not actually link to the original file. Instead they maintain their own copy of the
original file's attributes (i.e. location on disk, file access permissions, etc.). If the original file is
deleted, its data can still be accessed using the hard link.

On the other hand, symbolic links contain a pointer, or pathname, to the original file. If the
original file is deleted, its data can no longer be accessed using the symbolic link, and the link is
then considered to be a stale link. use ln command to create them

6.Named Pipes

Named pipes are tools that allow two or more system processes to communicate with each other
using a file that acts as a pipe between them. This type of communication is known as
interprocess communication, or IPC for short. Pipe is is sometimes called a FIFO

7.Sockets

Sockets are also tools used for interprocess communication. The difference between sockets and
pipes is that sockets will facilitate communication between processes running on different
systems, or over the network . A socket file is used to pass information between applications for
communication purpose. Youcan create a socket file using socket() system call. You can refer to
this socket file using the sockfd. This is same as the file descriptor, and you can
use read(), write() system calls to read and write from the socket.

The X Windows system -Linux GUI


GUI (Graphical User Interface) and CLI (Command Line Interface), are the two modes for users
to interact with the computer. GUI makes it easy for the user, therefore makes the OS user friendly.
CLI gives the user more control and options. Xwindows is progress compared to the CLI.
Linux offers a wide variety of flashing window and desktop managers for use under X , the
graphical environment . The X window system (commonly X Window System or X11) is a
computer software system and network protocol that provides a basis for graphical user interfaces
(GUI) for networked computers.
provides the basic framework, or primitives, for building such GUI environments: drawing and
moving windows on the screenand interacting with a mouse and keyboard
Some of the program provide in the core distribution include.
 Xterm:a terminal emulator
 Twm:a minimalistic window manager
 Xdm: a display manager
 Xconsol: a console redirect program
 Bitmap: a bitmap editor
 Xault, xhost and iceauth: access control programs
 Xset,xmodmap and many others : User preference setting program
 Xclock: a clock
Navajyothi College Cherupuzha
11

 Xlsfonts and others: a font displayer, utilities for listing information about fonts,
windows and displays
Xfs: a font server

Starting XWindows automatically

To load Xwindow we can use the command startx.

Linux Commands
 pwd Command
Linux pwd (print working directory) command displays your location currently you are working
on. It will give the whole path starting from the root ending to the directory.
 cd Command
The "cd" stands for 'change directory' and this command is used to change the current directory
i.e; the directory in which the user is currently working.
Syntax cd <dirname>
cd Options
option Description
cd ~ Brings you to your home directory.
cd - Brings you to your previous directory of the current directory.
cd .. Brings you to the parent directory of current directory.
cd / It takes you to the entire system's root directory.
 Linux mkdir | Linux Create Directory
The mkdir stands for 'make directory'. With the help of mkdir command, you can create a new
directory wherever you want in your system. Just type"mkdir <dir name> , in place of <dir
name> type the name of new directory, you want to create and then press enter.
Syntax
Mkdir <dirname>
 Linux rmdir Command
This command is used to delete a directory. But will not be able to delete a directory including a
sub-directory. It means, a directory has to be empty to be deleted.
Syntax:
Rmdir <dirname>

TOUCH COMMAND
The touch command is used to create empty files. We can create multiple empty files by
executing it once.
Syntax:
touch <file name>

Navajyothi College Cherupuzha


12

touch <file1> <file2> ....

cat Command

The cat command is a multi-purpose utility in the Linux system. It can be used to create a file,
display content of the file, copy the content of one file to another file, and more.
Syntax:

1. cat [OPTION]... [FILE]..


To create a file, execute it as follows:

1. cat > <file name>


2. // Enter file content
Press "CTRL+ D" keys to save the file. To display the content of the file, execute it as follows:

cat <file name>

su Command

The su command provides administrative access to another user. In other words, it allows access
of the Linux shell to another user.
Syntax:

su <user name>
Linux ls command
The ls is the list command in Linux. It will show the full list or content of your directory. Just type
ls and press enter key. The whole content will be shown.
Syntax
ls
Linux ls command options
ls option Description

ls -a In Linux, hidden files start with . (dot) symbol and they are not visible
in the regular directory. The (ls -a) command will enlist the whole list
of the current directory including the hidden files.
ls -l It will show the list in a long list format.
ls -lh This command will show you the file sizes in human readable format.
Size of the file is very difficult to read when displayed in terms of byte.
The (ls -lh)command will give you the data in terms of Mb, Gb, Tb, etc.

ls -lhS If you want to display your files in descending order (highest at the top)
according to their size, then you can use (ls -lhS) command.

Navajyothi College Cherupuzha


13

ls -n It is used to print group ID and owner ID instead of their names.


ls -r It is used to print the list in reverse order.
ls -R It will display the content of the sub-directories also.
ls ~ It gives the contents of home directory.
ls ../ It give the contents of parent directory.
ls --version It checks the version of ls command.

who
The who command gives the information about the users logged on to the system.
whoami
It tells you about the system's username.
Metacharacters or wildcards
These symbols are special characters used in linux commands and it has a special meaning
eg
Symbol meaning
> Output redirection
>> Output redirection(append)
* Zero or more characters
| Pipe
[] Any characters between the bracket
# Comment
& Run command in the back ground
$ Expand the value of the variable
. Any character

Managing User Accounts


Adding a New User Account
Adding a new user to the system involves the following tasks:

Assign the user a username, a user ID number, and a primary group, and decide which other
groups she should be a member of(if any). Enter this data into the system user accounts
configuration files.
 Assign a password to the new account.
 Create a home directory for the user.
 Place initialization files in the user’s home directory.
 Use chown and/or chgrp to give the new user ownership of his home directory and
initialization files.
 Set other user account parameters appropriate for your system(possibly including
password aging, account expiration date, resource limits, and system privileges).

USER ID AND GROUP ID

Navajyothi College Cherupuzha


14

All Linux users have a user ID and a group ID and a unique numerical identification
number called a userid (UID) and a group id (GID) respectively. Groups can be assigned
to logically tie users together for a common security, privilege and access purpose. It is
the foundation of Linux security and access. Files and devices may be granted access
based on a users ID or group ID.
useradd command
useradd command is a low-level utility that is used for adding/creating user accounts in Linux .
The ‘adduser‘ is much similar to useradd command, because it is just a symbolic link to it.
When we run ‘useradd‘ command in Linux terminal, it performs following major things:
1. It edits /etc/passwd, /etc/shadow, /etc/group and /etc/gshadow files for the newly created
User account.
2. Creates and populate a home directory for the new user.
3. Sets permissions and ownerships to home directory.
Syntax
Useradd username
Once a new user created, it’s entry automatically added to the ‘/etc/passwd‘ file.
Create a User with Account Expiry Date
By default, when we add user’s with ‘useradd‘ command user account never get expires i.e their
expiry date is set to 0 (means never expired).
However, we can set the expiry date using ‘-e‘ option, that sets date in YYYY-MM-DD format.
This is helpful for creating temporary accounts for a specific period of time.
Passwd command
The passwd command is used to change the password of a user account. A normal user can
run passwd to change their own password, and a system administrator (the superuser) can
use passwd to change another user's password, or define how that account's password can be
used or changed.
Syntax
Passwd newpassword
Removing a user
To remove a user we can use the command userdel. The userdel command modifies the system
account files, deleting all entries that refer to the user name
Userdel username

Hidden files
Hidden files are mainly used for storing configuration files or user settings. Usually, these files
are used by your system services, scripts, or other programs. Hidden files are usually system or
application files, concealed to prevent accidental changes. For example, the .bash_logout script is
executed whenever you log out of your Bash sessions. Hidden files are start with a (.)dot symbol
Viewing hidden files
ls –a

mv command

mv stands for move. mv is used to move one or more files or directories from one place to
another in a file system like UNIX. It has two distinct functions:
(i)It renames a file or folder.
(ii) It moves a group of files to a different directory.
Navajyothi College Cherupuzha
15

Logout command
Logout of a login shell. This command can be used by normal users to end their own session.
cp command
You use the cp command for copying files from one location to another. This command can also
copy directories (folders).
The syntax of this command is:
cp [...file/directory-sources] [destination]
rm command
The 'rm' means remove. This command is used to remove a file.
Syntax
Rm <filename>

Navajyothi College Cherupuzha

You might also like