0% found this document useful (0 votes)
17 views45 pages

Ost Unit II Material

Uploaded by

Vasi Karan R
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views45 pages

Ost Unit II Material

Uploaded by

Vasi Karan R
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

UNIT – II

Linux operating system


Linux Introduction: Linux Essential Commands – File system
Concept – Standard Files – Vi Editor – Partitions creation – Shell
Introduction – String Processing – Installing Application.

2. LINUX OPERATING SYSTEM

2.1 INTRODUCTION

The Linux Operating System is a type of operating system that is similar


to Unix, and it is built upon the Linux Kernel. The Linux Kernel is like
the brain of the operating system because it manages how the computer
interacts with its hardware and resources. It makes sure everything works
smoothly and efficiently. But the Linux Kernel alone is not enough to
make a complete operating system. To create a full and functional
system, the Linux Kernel is combined with a collection of software
packages and utilities, which are together called Linux distributions.
These distributions make the Linux Operating System ready for users to
run their applications and perform tasks on their computers securely and
effectively. Linux distributions come in different flavors, each tailored to
suit the specific needs and preferences of users.

What is Linux

Linux is a powerful and flexible family of operating systems that are free
to use and share. It was created by a person named Linus Torvalds in
1991. What’s cool is that anyone can see how the system works because
its source code is open for everyone to explore and modify. This
openness encourages people from all over the world to work together and
make Linux better and better. Since its beginning, Linux has grown into
a stable and safe system used in many different things, like computers,
smartphones, and big supercomputers. It’s known for being efficient,
meaning it can do a lot of tasks quickly, and it’s also cost-effective,
which means it doesn’t cost a lot to use. Lots of people love Linux, and
they’re part of a big community where they share ideas and help each
other out. As technology keeps moving forward, Linux will keep
evolving and staying important in the world of computers.
Linux Distribution

Linux distribution is an operating system that is made up of a collection


of software based on Linux kernel or you can say distribution contains
the Linux kernel and supporting libraries and software. And you can get
Linux based operating system by downloading one of the Linux
distributions and these distributions are available for different types of
devices like embedded devices, personal computers, etc. Around 600 +
Linux Distributions are available and some of the popular Linux
distributions are:
 MX Linux
 Manjaro
 Linux Mint
 elementary
 Ubuntu
 Debian
 Solus
 Fedora
 openSUSE
 Deepin

2.2 Linux Essential Commands


a. File Administration
S.N Commmands with Explanation
o
1. ls [option(s)] [file(s)] If you run ls without any additional
parameters, the program will list the contents of the current directory
in short form.
-l detailed list
-a displays hidden files
2. p [option(s)] sourcefile targetfile Copies sourcefile to targetfile.
-i Waits for confirmation, if necessary, before an existing
targetfile is overwritten
-r Copies recursively (includes subdirectories)
3. mv [option(s)] sourcefile targetfile Copies sourcefile to targetfile
then deletes the original sourcefile.
-b Creates a backup copy of the sourcefile before moving
-i Waits for confirmation, if necessary, before an existing
targetfile is overwritten
4. rm [option(s)] file(s) Removes the specified files from the file
system. Directories are not removed by rm unless the option -r is
used.
-r Deletes any existing subdirectories
-i Waits for confirmation before deleting each file.
5. ln [option(s)] sourcefile targetfile Creates an internal link from the
sourcefile to the targetfile, under a different name.
-s Creates a symbolic link
6. cd [options(s)] [directory] Changes the current directory.
cd without any parameters changes to the user's home directory.
7. mkdir [option(s)] directoryname Creates a new directory.
8. rmdir [option(s)] directoryname Deletes the specified directory,
provided it is already empty.
9. chown [option(s)] username.group file(s) Transfers the ownership of
a file to the user with the specified user name.
-R Changes files and directories in all subdirectories.
10. chgrp [option(s)] groupname file(s) Transfers the group ownership
of a given file to the group with the specified group name. The file
owner can only change group ownership if a member of both the
existing and the new group.
11. chmod [options] mode file(s) Changes the access permissions.The
mode parameter has three parts: group, access, and access type.
group accepts the following characters:
u user
g group
o others
For access, access is granted by the + symbol and denied by the -
symbol.
The access type is controlled by the following options:
r read
w write
x eXecute — executing files or changing to the directory.
s Set uid bit — the application or program is started as if it
were started by the owner of the file.
12. gzip [parameters] file(s) This program compresses the contents of
files, using complex mathematical algorithms. Files compressed in
this way are given the extension .gz and need to be uncompressed
before they can be used. To compress several files or even entire
directories, use the tar command.
-d decompresses the packed gzip files so they return to their
original size and can be processed normally (like the command
gunzip).
13. tar options archive file(s) The tar puts one file or (usually) several
files into an archive. Compression is optional.
tar is a quite complex command with a number of options available.
The most frequently used options are:
-f Writes the output to a file and not to the screen as is usually
the case
-c Creates a new tar archive
-r Adds files to an existing archive
-t Outputs the contents of an archive
-u Adds files, but only if they are newer than the files already
contained in the archive
-x Unpacks files from an archive (extraction)
-z Packs the resulting archive with gzip
-j Compresses the resulting archive with bzip2
-v Lists files processed
The archive files created by tar end with .tar. If the tar archive
was also compressed using gzip, the ending is .tgz or .tar.gz. If
it was compressed using bzip2, .tar.bz2.
14. locate pattern(s) The locate command can find in which directory
a specified file is located. If desired, use wild cards to specify file
names. The program is very speedy, as it uses a database specifically
created for the purpose (rather than searching through the entire file
system). The database can be generated by root with updatedb.
15. find [option(s)] The find command allows you to search
for a file in a given directory. The first argument specifies the
directory in which to start the search. The option -name must be
followed by a search string, which may also include wild cards.
Unlike locate, which uses a database, find scans the actual directory.
b.Commands to Access File Contents

S.N Commands with explanation


o.
1. cat [option(s)] file(s) The cat command displays the contents of a
file, printing the entire contents to the screen without interruption.
-n Numbers the output on the left margin
2. less [option(s)] file(s) This command can be used to browse the
contents of the specified file. Scroll half a screen page up or down
with PgUp and PgDn or a full screen page down with Space. Jump
to the beginning or end of a file using Home and End. Press Q to
exit the program.
3. grep [option(s)] searchstring filenames
The grep command finds a specific searchstring in the specified
file(s). If the search string is found, the command displays the line in
which the searchstring was found along with the file name.
-i Ignores case
-l Only displays the names of the respective files, but not the text
lines
-n Additionally displays the numbers of the lines in which it found a
hit
-l Only lists the files in which searchstring does not occur
4. diff [option(s)] file1 file2
The diff command compares the contents of any two files. The
output produced by the program lists all lines that do not match.This
is frequently used by programmers who need only send their
program alterations and not the entire source code.
-q Only reports whether the two given files differ

c. File Systems
1. mount [option(s)] [<device>] mountpoint
This command can be used to mount any data media, such as hard
disks, CD-ROM drives, and other drives, to a directory of the Linux
file system.
-r mount read-only
-t filesystem
Specifies the file system. The most common are ext2 for Linux hard
disks, msdos for MS-DOS media, vfat for the Windows file system,
and iso9660 for CDs.
2. umount [option(s)] mountpoint
This command unmounts a mounted drive from the file system. To
prevent data loss, run this command before taking a removable data
medium from its drive. Normally, only root is allowed to run the
commands mount and umount. To enable other users to run these
commands, edit the /etc/fstab file to specify the option user for the
respective drive.
d. System Commands

System Information
df [option(s)] [directory]
The df (disk free) command, when used without any options,
displays information about the total disk space, the disk space
currently in use, and the free space on all the mounted drives. If a
directory is specified, the information is limited to the drive on which
that directory is located.
-H : shows the number of occupied blocks in gigabytes, megabytes,
or kilobytes — in human-readable format
-t : Type of file system (ext2, nfs, etc.)
du [option(s)] [path]
This command, when executed without any parameters, shows the
total disk space occupied by files and subdirectories in the current
directory.
-a : Displays the size of each individual file
-h : Output in human-readable form
-s : Displays only the calculated total size
free [option(s)]
The command free displays information about RAM and swap space
usage, showing the total and the used amount in both categories.
-b : Output in bytes
-k : Output in kilobytes
-m : Output in megabytes
date [option(s)]
This simple program displays the current system time. If run as root,
it can also be used to change the system time. Details about the
program are available in date.

Processes
top [options(s)]
top provides a quick overview of the currently running processes.
Press H to access a page that briefly explains the main options to
customize the program.
ps [option(s)] [process ID]
If run without any options, this command displays a table of all your
own programs or processes — those you started. The options for this
command are not preceded by hyphen.
aux
Displays a detailed list of all processes, independent of the owner.
kill [option(s)] process ID
Unfortunately, sometimes a program cannot be terminated in the
normal way. However, in most cases, you should still be able to stop
such a runaway program by executing the kill command, specifying
the respective process ID (see top and ps).
kill sends a TERM signal that instructs the program to shut itself
down. If this does not help, the following parameter can be used:
-9
Sends a KILL signal instead of a TERM signal, with which the
process really is annihilated by the operating system. This brings the
specific processes to an end in almost all cases.
killall [option(s)] processname
This command is similar to kill, but uses the process name (instead
of the process ID) as an argument, causing all processes with that
name to be killed.

Network
ping [option(s)] host name|IP address
The ping command is the standard tool for testing the basic
functionality of TCP/IP networks. It sends a small data packet to the
destination host, requesting an immediate reply. If this works, ping
displays a message to that effect, which indicates that the network
link is basically functioning.
-c : number Determines the total number of packages to send and
ends after they have been dispatched. By default, there is no
limitation set.
-f flood ping: sends as many data packages as possible. A popular
means, reserved to root, to test networks.
-i :value Specifies the interval between two data packages in seconds.
Default: one second
nslookup
The Domain Name System resolves domain names to IP addresses.
With this tool, send queries to information servers (DNS servers).
telnet [option(s)] host name or IP address
Telnet is actually an Internet protocol that enables you to work on
remote hosts across a network. telnet is also the name of a Linux
program that uses this protocol to enable operations on remote
computers. Warning

Miscellaneous
passwd [option(s)] [username]
Users may change their own passwords at any time using this
command. Furthermore, the administrator root can use the command
to change the password of any user on the system.
su [option(s)] [username]
The su command makes it possible to log in under a different user
name from a running session. When using the command without
specifying a user name, you will be prompted for the root password.
Specify a user name and the corresponding password to use the
environment of the respective user. The password is not required
from root, as root is authorized to assume the identity of any user.
halt [option(s)]
To avoid loss of data, you should always use this program to shut
down your system.
reboot [option(s)]
Does the same as halt with the difference that the system performs
an immediate reboot.
clear
This command cleans up the visible area of the console. It has no
options.

2.3 File system Concepts in Linux & Standard files in Linux

A Linux file system is a structured collection of files on a disk drive or a


partition. A partition is a segment of memory and contains some specific
data. In our machine, there can be various partitions of the memory.
Generally, every partition contains a file system.
The general-purpose computer system needs to store data systematically so
that we can easily access the files in less time. It stores the data on hard
disks (HDD) or some equivalent storage type. There may be below reasons
for maintaining the file system:
o Primarily the computer saves data to the RAM storage; it may lose
the data if it gets turned off. However, there is non-volatile RAM
(Flash RAM and SSD) that is available to maintain the data after the
power interruption.
o Data storage is preferred on hard drives as compared to standard
RAM as RAM costs more than disk space. The hard disks costs are
dropping gradually comparatively the RAM.
The Linux file system contains the following sections:
o The root directory (/)
o A specific data storage format (EXT3, EXT4, BTRFS, XFS and so
on)
o A partition or logical volume having a particular file system.

What is the Linux File System?


Linux file system is generally a built-in layer of a Linux operating
system used to handle the data management of the storage. It helps to
arrange the file on the disk storage. It manages the file name, file size,
creation date, and much more information about a file.

Linux File System Structure


Linux file system has a hierarchal file structure as it contains a root
directory and its subdirectories. All other directories can be accessed from
the root directory. A partition usually has only one file system, but it may
have more than one file system.
A file system is designed in a way so that it can manage and provide space
for non-volatile storage data. All file systems required a namespace that is
a naming and organizational methodology. The namespace defines the
naming process, length of the file name, or a subset of characters that can
be used for the file name. It also defines the logical structure of files on a
memory segment, such as the use of directories for organizing the specific
files. Once a namespace is described, a Metadata description must be
defined for that particular file.
The data structure needs to support a hierarchical directory structure; this
structure is used to describe the available and used disk space for a
particular block. It also has the other details about the files such as file
size, date & time of creation, update, and last modified.
Also, it stores advanced information about the section of the disk, such as
partitions and volumes.
The advanced data and the structures that it represents contain the
information about the file system stored on the drive; it is distinct and
independent of the file system metadata.
Linux file system contains two-part file system software implementation
architecture. Consider the below image:
The file system requires an API (Application programming interface) to
access the function calls to interact with file system components like files
and directories. API facilitates tasks such as creating, deleting, and
copying the files. It facilitates an algorithm that defines the arrangement of
files on a file system.
The first two parts of the given file system together called a Linux virtual
file system. It provides a single set of commands for the kernel and
developers to access the file system. This virtual file system requires the
specific system driver to give an interface to the file system.

Directory Structure
The directories help us to store the files and locate them when we need
them. Also, directories are called folders as they can be assumed of as
folders where files reside in the form of a physical desktop analogy.
Directories can be organized in a tree-like hierarchy in Linux and several
other operating systems.
The directory structure of Linux is well-documented and defined in the
Linux FHS (Filesystem Hierarchy Standard). Referencing those directories
if accessing them is achieved via the sequentially deeper names of the
directory linked by '/' forward slash like /var/spool/mail and /var/log.
These are known as paths.
The below table gives a very short standard, defined, and well-known top-
level Linux directory list and their purposes:
o / (root filesystem): It is the top-level filesystem directory. It must
include every file needed to boot the Linux system before another
filesystem is mounted. Every other filesystem is mounted on a well-
defined and standard mount point because of the root filesystem
directories after the system is started.
o /boot: It includes the static kernel and bootloader configuration and
executable files needed to start a Linux computer.
o /bin: This directory includes user executable files.
o /dev: It includes the device file for all hardware devices connected to
the system. These aren't device drivers; instead, they are files that
indicate all devices on the system and provide access to these
devices.
o /etc: It includes the local system configuration files for the host
system.
o /lib: It includes shared library files that are needed to start the
system.
o /home: The home directory storage is available for user files. All
users have a subdirectory inside /home.
o /mnt: It is a temporary mount point for basic filesystems that can be
used at the time when the administrator is working or repairing a
filesystem.
o /media: A place for mounting external removable media devices like
USB thumb drives that might be linked to the host.
o /opt: It contains optional files like vendor supplied application
programs that must be placed here.
o /root: It's the home directory for a root user. Keep in mind that it's
not the '/' (root) file system.
o /tmp: It is a temporary directory used by the OS and several
programs for storing temporary files. Also, users may temporarily
store files here. Remember that files may be removed without prior
notice at any time in this directory.
o /sbin: These are system binary files. They are executables utilized
for system administration.
o /usr: They are read-only and shareable files, including executable
libraries and binaries, man files, and several documentation types.
o /var: Here, variable data files are saved. It can contain things such as
MySQL, log files, other database files, email inboxes, web server
data files, and much more.

Linux File System Features


In Linux, the file system creates a tree structure. All the files are arranged
as a tree and its branches. The topmost directory called the root (/)
directory. All other directories in Linux can be accessed from the root
directory.
Some key features of Linux file system are as following:
o Specifying paths: Linux does not use the backslash (\) to separate
the components; it uses forward slash (/) as an alternative. For
example, as in Windows, the data may be stored in C:\ My
Documents\ Work, whereas, in Linux, it would be stored in /home/
My Document/ Work.
o Partition, Directories, and Drives: Linux does not use drive letters
to organize the drive as Windows does. In Linux, we cannot tell
whether we are addressing a partition, a network device, or an
"ordinary" directory and a Drive.
o Case Sensitivity: Linux file system is case sensitive. It distinguishes
between lowercase and uppercase file names. Such as, there is a
difference between test.txt and Test.txt in Linux. This rule is also
applied for directories and Linux commands.
o File Extensions: In Linux, a file may have the extension '.txt,' but it
is not necessary that a file should have a file extension. While
working with Shell, it creates some problems for the beginners to
differentiate between files and directories. If we use the graphical file
manager, it symbolizes the files and folders.
o Hidden files: Linux distinguishes between standard files and hidden
files, mostly the configuration files are hidden in Linux OS. Usually,
we don't need to access or read the hidden files. The hidden files in
Linux are represented by a dot (.) before the file name (e.g., .ignore).
To access the files, we need to change the view in the file manager or
need to use a specific command in the shell.

Types of Linux File System


When we install the Linux operating system, Linux offers many file
systems such as Ext, Ext2, Ext3, Ext4, JFS, ReiserFS, XFS,
btrfs, and swap.

Let's understand each of these file systems in detail:


1. Ext, Ext2, Ext3 and Ext4 file system
The file system Ext stands for Extended File System. It was primarily
developed for MINIX OS. The Ext file system is an older version, and is
no longer used due to some limitations.
Ext2 is the first Linux file system that allows managing two terabytes of
data. Ext3 is developed through Ext2; it is an upgraded version of Ext2 and
contains backward compatibility. The major drawback of Ext3 is that it
does not support servers because this file system does not support file
recovery and disk snapshot.
Ext4 file system is the faster file system among all the Ext file systems. It
is a very compatible option for the SSD (solid-state drive) disks, and it is
the default file system in Linux distribution.
2. JFS File System
JFS stands for Journaled File System, and it is developed by IBM for
AIX Unix. It is an alternative to the Ext file system. It can also be used in
place of Ext4, where stability is needed with few resources. It is a handy
file system when CPU power is limited.
3. ReiserFS File System
ReiserFS is an alternative to the Ext3 file system. It has improved
performance and advanced features. In the earlier time, the ReiserFS was
used as the default file system in SUSE Linux, but later it has changed
some policies, so SUSE returned to Ext3. This file system dynamically
supports the file extension, but it has some drawbacks in performance.
4. XFS File System
XFS file system was considered as high-speed JFS, which is developed for
parallel I/O processing. NASA still using this file system with its high
storage server (300+ Terabyte server).
5. Btrfs File System
Btrfs stands for the B tree file system. It is used for fault tolerance, repair
system, fun administration, extensive storage configuration, and more. It is
not a good suit for the production system.
6. Swap File System
The swap file system is used for memory paging in Linux operating
system during the system hibernation. A system that never goes in
hibernate state is required to have swap space equal to its RAM size.

What is Mounting in the Linux Filesystem?


In Linux, the "to mount", a filesystem term, refers to the initial days of
computing when a removable disk or tape pack would physically need to
be mounted on a correct drive device. On the disk pack, the filesystem
would logically be mounted by the OS to make contents available to
access by application programs, OS, and users after being located on the
drive physically.
Simply, a mount point is a directory that's made as a component of the
filesystem. For instance, the home filesystem is placed on the /home
directory. Filesystems can be placed on mount points on many non-root
filesystems, but it's less common.
o The root file system of Linux is mounted on the / directory (root
directory) very early inside the boot sequence.
o Several files ystems are later mounted by the start-up programs of
Linux, either rc upon System V or via systemd in new Linux
versions.
o File system mounting during startup is handled by the configuration
file, i.e., /etc/fstab.
o An easy way to understand that is fstab is short for "file system
table", and it's a filesystem list that is to be mounted, their options,
and designated mount points that may be required for particular
filesystems.
File systems can be mounted on an available mount point/directory with
the help of the mount command. In other words, any directory that's
applied as a mount point shouldn't have other files in it and should be
empty. Linux will not avoid users from mounting a filesystem on one that's
already available or on a directory that includes files. The actual contents
will be covered, and just the freshly mounted filesystem content will be
visible if we mount any filesystem on any existing filesystem or directory.

Linux has three types of users


1) Super-user: Super-user in Linux is called “root”. Root user has
complete previlage in Linux. Only he has the administratory power.
2) Normal-user: Normal user doesn't have administrator power.
Normal users have only a limited access. It is the root user which creates
the normal user. In certain Linux OS there is no root user, like in Ubuntu,
Linuxmint etc. In such cases we can use commands to give normal user an
administrative privilage.
3) System user :System users are the users created by applications in
the system. For example in servers the application allows only authorised
users to access its service.

 In Linux, everything is configured as a file. This includes not only


text files, images and compiled programs (also referred to as
executables), but also directories, partitions and hardware device drivers.

 Each file system (used in the first sense) contains a control block,
which holds information about that file system. The other blocks in the
file ystem are inodes, which contain information about individual files,
and data blocks, which contain the information stored in the individual
files.

o the Linux kernel, however, the file system is flat. That is, it does not (1)
have a hierarchical structure, (2) differentiate between directories, files or
programs or (3) identify files by names. Instead, the kernel uses inodes to
represent each file.

 An inode is actually an entry in a list of inodes referred to as the


inode list.
 Each inode contains information about a file including
(1) its inode number (a unique identification number)
(2) the owner and group associated with the file,
(3) the file type (for example, whether it is a regular file or a
directory),
(4) the file's permission list,
(5) the file creation, access and modification times,
(6) the size of the file and
(7) the disk address (i.e., the location on the disk where the file is
physically stored).

2.4.Vi Editor
Vi is a command line text editor. As you would be quite aware now, the
command line is quite a different environment to your GUI. It's a single
window with text input and output only. Vi has been designed to work
within these limitations and many would argue, is actually quite powerful
as a result. Vi is intended as a plain text editor (similar to Notepad on
Windows, or Textedit on Mac) as opposed to a word processing suite such
as Word or Pages. It does, however have a lot more power compared to
Notepad or Textedit.
There are two modes in Vi. Insert (or Input) mode and Edit mode. In
input mode you may input or enter content into the file. In edit mode you
can move around the file, perform actions such as deleting, copying,
search and replace, saving etc.
When we run vi we normally issue it with a single command line argument
which is the file you would like to edit.
vi <file>
 When you run this command it opens up the file.
 You always start off in edit mode so the first thing we are going to do
is switch to insert mode by pressing i. You can tell when you are in
insert mode as the bottom left corner will tell you.
 ZZ (Note: capitals) - Save and exit
 :q! - discard all changes, since the last save, and exit
 :w - save file but don't exit
 :wq - again, save and exit
Below are some of the many commands you may enter to move around the
file. Have a play with them and see how they work.
 Arrow keys - move the cursor around
 j, k, h, l - move the cursor down, up, left and right (similar to the
arrow keys)
 ^ (caret) - move cursor to beginning of current line
 $ - move cursor to end of the current line
 nG - move to the nth line (eg 5G moves to 5th line)
 G - move to the last line
 w - move to the beginning of the next word
 nw - move forward n word (eg 2w moves two words forwards)
 b - move to the beginning of the previous word
 nb - move back n word
 { - move backward one paragraph
 } - move forward one paragraph
Below are some of the many ways in which we may delete content within
vi. Have a play with them now. (also check out the section below on
undoing so that you can undo your deletes.)
 x - delete a single character
 nx - delete n characters (eg 5x deletes five characters)
 dd - delete the current line
 dn - d followed by a movement command. Delete to where the
movement command would have taken you. (eg d5w means delete 5
words)
Undoing changes in vi is fairly easy. It is the character u.
 u - Undo the last action (you may keep pressing u to keep undoing)
 U (Note: capital) - Undo all changes to the current line

2.5 Partitions creation:

2.5.1 Formating Partitions


At the shell prompt, I begin making the file systems on my partitions.
Continuing with the example in this is:
# mke2fs /dev/sda1

I need to do this for each of my partitions, but not for /dev/sda4 (my
extended partition). Linux supports types of file systems other than ext2.
You can find out what kinds your kernel supports by looking in:
/usr/src/linux/include/linux/fs.h
The most common file systems can be made with programs in /sbin that
start with "mk" like mkfs.msdos and mke2fs.

2.5.2. Activating Swap Space


To set up a swap partition:
# mkswap -f /dev/hda5

To activate the swap area:


# swapon /dev/hda5

Normally, the swap area is activated by the initialization scripts at boot


time.

2.5.3. Mounting Partitions


Mounting a partition means attaching it to the linux file system. To mount
a linux partition:
# mount -t ext2 /dev/sda1 /opt

-t ext2

File system type. Other types you are likely to use are:

 ext3 (journaling sile system based on ext2)

 msdos (DOS)

 hfs (mac)

 iso9660 (CDROM)

 nfs (network file system)

/dev/sda1

Device name. Other device names you are likely to use:

 /dev/hdb2 (second partition in second IDE drive)

 /dev/fd0 (floppy drive A)

 /dev/cdrom (CDROM)

/opt

mount point. This is where you want to "see" your partition. When
you type ls /opt, you can see what is in /dev/sda1. If there are already
some directories and/or files under /opt, they will be invisible after
this mount command.

2.5.4. Some facts about file systems and fragmentation


Disk space is administered by the operating system in units of blocks and
fragments of blocks. In ext2, fragments and blocks have to be of the same
size, so we can limit our discussion to blocks.
Files come in any size. They don't end on block boundaries. So with every
file a part of the last block of every file is wasted. Assuming that file sizes
are random, there is approximately a half block of waste for each file on
your disk. Tanenbaum calls this "internal fragmentation" in his book
"Operating Systems".
You can guess the number of files on your disk by the number of allocated
inodes on a disk. On my disk
# df -i
Filesystem Inodes IUsed IFree %IUsed Mounted on
/dev/hda3 64256 12234 52022 19% /
/dev/hda5 96000 43058 52942 45% /var

there are about 12000 files on / and about 44000 files on /var. At a block
size of 1 KB, about 6+22 = 28 MB of disk space are lost in the tail blocks
of files. Had I chosen a block size of 4 KB, I had lost 4 times this space.
Data transfer is faster for large contiguous chunks of data, though. That's
why ext2 tries to preallocate space in units of 8 contigous blocks for
growing files. Unused preallocation is released when the file is closed, so
no space is wasted.
Noncontiguous placement of blocks in a file is bad for performance, since
files are often accessed in a sequential manner. It forces the operating
system to split a disk access and the disk to move the head. This is called
"external fragmentation" or simply "fragmentation" and is a common
problem with MS-DOS file systems. In conjunction with the abysmal
buffer cache used by MS-DOS, the effects of file fragmentation on
performance are very noticeable. DOS users are accustomed to defragging
their disks every few weeks and some have even developed some
ritualistic beliefs regarding defragmentation.
None of these habits should be carried over to Linux and ext2. Linux
native file systems do not need defragmentation under normal use and this
includes any condition with at least 5% of free space on a disk. There is a
defragmentation tool for ext2 called defrag, but users are cautioned against
casual use. A power outage during such an operation can trash your file
system. Since you need to back up your data anyway, simply writing back
from your copy will do the job.
The MS-DOS file system is also known to lose large amounts of disk
space due to internal fragmentation. For partitions larger than 256 MB,
DOS block sizes grow so large that they are no longer useful (This has
been corrected to some extent with FAT32). Ext2 does not force you to
choose large blocks for large file systems, except for very large file
systems in the 0.5 TB range (that's terabytes with 1 TB equaling 1024 GB)
and above, where small block sizes become inefficient. So unlike DOS
there is no need to split up large disks into multiple partitions to keep
block size down.
Use a 1Kb block size if you have many small files. For large partitions,
4Kb blocks are fine.

2. 6.Shell Introduction
String operators in shell use unique among programming languages curly-
bracket syntax. In shell any variable can be displayed as
${name_of_the_variable} instead of $name_of_the_variable. This
notation was introduced to protect a variable name from merging with
string that comes after it, but was extended to allow string operations on
variables. Here is example in which it is used for separation of a variable
$var and a string "_string" using curly brackets:
$ export var='test'
$ echo ${var}_string # var is a variable that uses syntax ${var} with the
value test
$ echo $var_string # var_string is a variable that doesn't exist, echo doesn't
print anything

In Korn 88 shell this notation was extended to allow expressions inside


curvy brackets. For example
${var:=moo}

Each operation is encoded using special symbol or two symbols (


"digram", for example :- , := , etc). An argument that the operator may
need is positioned after the symbol of the operation. Later this notation
extended ksh93 and adopted by bash and other shells.
This "ksh-originated" group of operators is the most popular and probably
the most widely used group of string-handling operators so it makes sense
to learn them, if only in order to be able to modify old scripts.

2.6.1 Implementation of classic string operations in shell


Despite shell deficiencies in this area and idiosyncrasies preserved from
1970th most classic string operations can be implemented in shell. You can
define functions that behave almost exactly like in Perl or other "more
normal" language. In case shell facilities are not enough you can use AWK
or Perl. It's actually sad that AWK was not integrated into shell.

2.6.1.1Length Operator
There are several ways to get length of the string.
 The simplest one is ${#varname}, which returns the length of the
value of the variable as a character string. For example, if filename
has the value ntp.conf, then ${#filename} would have the value 8.
 The second is to use built-in function expr, for example
expr length $string

or
expr "$string" : '.*'

 Additional example from Advanced Bash-Scripting Guide


stringZ=abcABC123ABCabc

echo ${#stringZ} # 15
echo `expr length $stringZ` # 15
echo `expr "$stringZ" : '.*'` # 15

 For checking if length of the string is zero you can use -n STRING
operator.
More complex example. Here's the function for validating that that string
is within a given max length. It requires two parameters, the actual string
and the maximum length the string should be.
check_length()
# check_length
# to call: check_length string max_length_of_string
{
# check we have the right params
if (( $# != 2 )) ; then
echo "check_length need two parameters: a string and max_length"
return 1
fi
if (( ${#1} > $2 )) ; then
return 1
fi
return 0
}

You could call the function check_length like this:


#!/usr/bin/bash
# test_name
while :
do
echo -n "Enter customer name :"
read NAME
[ check_length $NAME 10 ] && break
echo "The string $NAME is longer then 10 characters"
done

echo $NAME

2.6.2Determining the Length of Matching Substring at Beginning of


String

This is pretty rarely used capability of expr built-in but still sometimes it
can be useful:
expr match "$string" '$substring'

where:
 String is any variable of literal string.
 $substring is a regular expression.
my_regex=abcABC123ABCabc
# |------|

echo `expr match "$my_regex" 'abc[A-Z]*.2'` # 8


echo `expr "$my_regex" : 'abc[A-Z]*.2'` #8

2.7.String processing
2.7.1Manipulating Strings
Bash supports a surprising number of string manipulation operations.
Unfortunately, these tools lack a unified focus. Some are a subset of
parameter substitution, and others fall under the functionality of the UNIX
expr command. This results in inconsistent command syntax and overlap
of functionality, not to mention confusion.
String Length
${#string}

expr length $string

These are the equivalent of strlen() in C.


expr "$string" : '.*'

stringZ=abcABC123ABCabc

echo ${#stringZ} # 15
echo `expr length $stringZ` # 15
echo `expr "$stringZ" : '.*'` # 15

Example 7-1. Inserting a blank line between paragraphs in a text file


#!/bin/bash
# paragraph-space.sh
# Ver. 2.1, Reldate 29Jul12 [fixup]

# Inserts a blank line between paragraphs of a single-spaced text file.


# Usage: $0 <FILENAME

MINLEN=60 # Change this value? It's a judgment call.


# Assume lines shorter than $MINLEN characters ending in a period
#+ terminate a paragraph. See exercises below.

while read line # For as many lines as the input file has ...
do
echo "$line" # Output the line itself.

len=${#line}
if [[ "$len" -lt "$MINLEN" && "$line" =~ [*{\.}]$ ]]
# if [[ "$len" -lt "$MINLEN" && "$line" =~ \[*\.\] ]]
# An update to Bash broke the previous version of this script. Ouch!
# Thank you, Halim Srama, for pointing this out and suggesting a fix.
then echo # Add a blank line immediately
fi #+ after a short line terminated by a period.
done

exit

# Exercises:
# ---------
# 1) The script usually inserts a blank line at the end
#+ of the target file. Fix this.
# 2) Line 17 only considers periods as sentence terminators.
# Modify this to include other common end-of-sentence characters,
#+ such as ?, !, and ".

Length of Matching Substring at Beginning of String


expr match "$string" '$substring'

$substring is a regular expression.

expr "$string" : '$substring'

$substring is a regular expression.

stringZ=abcABC123ABCabc
# |------|
# 12345678

echo `expr match "$stringZ" 'abc[A-Z]*.2'` # 8


echo `expr "$stringZ" : 'abc[A-Z]*.2'` #8

Index
expr index $string $substring

Numerical position in $string of first character in $substring that


matches.

stringZ=abcABC123ABCabc
# 123456 ...
echo `expr index "$stringZ" C12` #6
# C position.

echo `expr index "$stringZ" 1c` #3


# 'c' (in #3 position) matches before '1'.

This is the near equivalent of strchr() in C.

Substring Extraction
${string:position}
Extracts substring from $string at $position.

If the $string parameter is "*" or "@", then this extracts the positional
parameters, [1] starting at $position.

${string:position:length}

Extracts $length characters of substring from $string at $position.

stringZ=abcABC123ABCabc
# 0123456789.....
# 0-based indexing.

echo ${stringZ:0} # abcABC123ABCabc


echo ${stringZ:1} # bcABC123ABCabc
echo ${stringZ:7} # 23ABCabc

echo ${stringZ:7:3} # 23A


# Three characters of substring.

# Is it possible to index from the right end of the string?

echo ${stringZ:-4} # abcABC123ABCabc


# Defaults to full string, as in ${parameter:-default}.
# However . . .

echo ${stringZ:(-4)} # Cabc


echo ${stringZ: -4} # Cabc
# Now, it works.
# Parentheses or added space "escape" the position parameter.

# Thank you, Dan Jacobson, for pointing this out.

The position and length arguments can be "parameterized," that is,


represented as a variable, rather than as a numerical constant.

Example 7-2. Generating an 8-character "random" string


#!/bin/bash
# rand-string.sh
# Generating an 8-character "random" string.

if [ -n "$1" ] # If command-line argument present,


then #+ then set start-string to it.
str0="$1"
else # Else use PID of script as start-string.
str0="$$"
fi

POS=2 # Starting from position 2 in the string.


LEN=8 # Extract eight characters.

str1=$( echo "$str0" | md5sum | md5sum )


# Doubly scramble ^^^^^^ ^^^^^^
#+ by piping and repiping to md5sum.

randstring="${str1:$POS:$LEN}"
# Can parameterize ^^^^ ^^^^

echo "$randstring"

exit $?

# bozo$ ./rand-string.sh my-password


# 1bdd88c4

# No, this is is not recommended


#+ as a method of generating hack-proof passwords.

If the $string parameter is "*" or "@", then this extracts a maximum of


$length positional parameters, starting at $position.

echo ${*:2} # Echoes second and following positional parameters.


echo ${@:2} # Same as above.

echo ${*:2:3} # Echoes three positional parameters, starting at


second.

expr substr $string $position $length

Extracts $length characters from $string starting at $position.

stringZ=abcABC123ABCabc
# 123456789......
# 1-based indexing.

echo `expr substr $stringZ 1 2` # ab


echo `expr substr $stringZ 4 3` # ABC

expr match "$string" '\($substring\)'

Extracts $substring at beginning of $string, where $substring is a


regular expression.

expr "$string" : '\($substring\)'

Extracts $substring at beginning of $string, where $substring is a


regular expression.

stringZ=abcABC123ABCabc
# =======

echo `expr match "$stringZ" '\(.[b-c]*[A-Z]..[0-9]\)'` # abcABC1


echo `expr "$stringZ" : '\(.[b-c]*[A-Z]..[0-9]\)'` # abcABC1
echo `expr "$stringZ" : '\(.......\)'` # abcABC1
# All of the above forms give an identical result.

expr match "$string" '.*\($substring\)'

Extracts $substring at end of $string, where $substring is a regular


expression.

expr "$string" : '.*\($substring\)'

Extracts $substring at end of $string, where $substring is a regular


expression.
stringZ=abcABC123ABCabc
# ======

echo `expr match "$stringZ" '.*\([A-C][A-C][A-C][a-c]*\)'` #


ABCabc
echo `expr "$stringZ" : '.*\(......\)'` # ABCabc

Substring Removal
${string#substring}

Deletes shortest match of $substring from front of $string.

${string##substring}

Deletes longest match of $substring from front of $string.

stringZ=abcABC123ABCabc
# |----| shortest
# |----------| longest

echo ${stringZ#a*C} # 123ABCabc


# Strip out shortest match between 'a' and 'C'.

echo ${stringZ##a*C} # abc


# Strip out longest match between 'a' and 'C'.

# You can parameterize the substrings.

X='a*C'

echo ${stringZ#$X} # 123ABCabc


echo ${stringZ##$X} # abc
# As above.

${string%substring}

Deletes shortest match of $substring from back of $string.


For example:
# Rename all filenames in $PWD with "TXT" suffix to a "txt"
suffix.
# For example, "file1.TXT" becomes "file1.txt" . . .

SUFF=TXT
suff=txt

for i in $(ls *.$SUFF)


do
mv -f $i ${i%.$SUFF}.$suff
# Leave unchanged everything *except* the shortest pattern
match
#+ starting from the right-hand-side of the variable $i . . .
done ### This could be condensed into a "one-liner" if desired.

# Thank you, Rory Winston.

${string%%substring}

Deletes longest match of $substring from back of $string.

stringZ=abcABC123ABCabc
# || shortest
# |------------| longest

echo ${stringZ%b*c} # abcABC123ABCa


# Strip out shortest match between 'b' and 'c', from back of
$stringZ.

echo ${stringZ%%b*c} # a
# Strip out longest match between 'b' and 'c', from back of
$stringZ.

This operator is useful for generating filenames.

Example 7-3. Converting graphic file formats, with filename


change

#!/bin/bash
# cvt.sh:
# Converts all the MacPaint image files in a directory to "pbm"
format.

# Uses the "macptopbm" binary from the "netpbm" package,


#+ which is maintained by Brian Henderson (bryanh@giraffe-
data.com).
# Netpbm is a standard part of most Linux distros.

OPERATION=macptopbm
SUFFIX=pbm # New filename suffix.

if [ -n "$1" ]
then
directory=$1 # If directory name given as a script argument...
else
directory=$PWD # Otherwise use current working directory.
fi

# Assumes all files in the target directory are MacPaint image files,
#+ with a ".mac" filename suffix.

for file in $directory/* # Filename globbing.


do
filename=${file%.*c} # Strip ".mac" suffix off filename
#+ ('.*c' matches everything
#+ between '.' and 'c', inclusive).
$OPERATION $file > "$filename.$SUFFIX"
# Redirect conversion to new filename.
rm -f $file # Delete original files after converting.
echo "$filename.$SUFFIX" # Log what is happening to stdout.
done

exit 0

# Exercise:
# --------
# As it stands, this script converts *all* the files in the current
#+ working directory.
# Modify it to work *only* on files with a ".mac" suffix.

# *** And here's another way to do it. *** #

#!/bin/bash
# Batch convert into different graphic formats.
# Assumes imagemagick installed (standard in most Linux distros).

INFMT=png # Can be tif, jpg, gif, etc.


OUTFMT=pdf # Can be tif, jpg, gif, pdf, etc.

for pic in *"$INFMT"


do
p2=$(ls "$pic" | sed -e s/\.$INFMT//)
# echo $p2
convert "$pic" $p2.$OUTFMT
done

exit $?

Example 7-4. Converting streaming audio files to ogg

#!/bin/bash
# ra2ogg.sh: Convert streaming audio files (*.ra) to ogg.

# Uses the "mplayer" media player program:


# http://www.mplayerhq.hu/homepage
# Uses the "ogg" library and "oggenc":
# http://www.xiph.org/
#
# This script may need appropriate codecs installed, such as sipr.so ...
# Possibly also the compat-libstdc++ package.

OFILEPREF=${1%%ra} # Strip off the "ra" suffix.


OFILESUFF=wav # Suffix for wav file.
OUTFILE="$OFILEPREF""$OFILESUFF"
E_NOARGS=85

if [ -z "$1" ] # Must specify a filename to convert.


then
echo "Usage: `basename $0` [filename]"
exit $E_NOARGS
fi

########################################################
##################
mplayer "$1" -ao pcm:file=$OUTFILE
oggenc "$OUTFILE" # Correct file extension automatically added
by oggenc.
########################################################
##################

rm "$OUTFILE" # Delete intermediate *.wav file.


# If you want to keep it, comment out above line.

exit $?

# Note:
# ----
# On a Website, simply clicking on a *.ram streaming audio file
#+ usually only downloads the URL of the actual *.ra audio file.
# You can then use "wget" or something similar
#+ to download the *.ra file itself.

# Exercises:
# ---------
# As is, this script converts only *.ra filenames.
# Add flexibility by permitting use of *.ram and other filenames.
#
# If you're really ambitious, expand the script
#+ to do automatic downloads and conversions of streaming audio
files.
# Given a URL, batch download streaming audio files (using "wget")
#+ and convert them on the fly.

A simple emulation of getopt using substring-extraction constructs.

Example 7-5. Emulating getopt

#!/bin/bash
# getopt-simple.sh
# Author: Chris Morgan
# Used in the ABS Guide with permission.

getopt_simple()
{
echo "getopt_simple()"
echo "Parameters are '$*'"
until [ -z "$1" ]
do
echo "Processing parameter of: '$1'"
if [ ${1:0:1} = '/' ]
then
tmp=${1:1} # Strip off leading '/' . . .
parameter=${tmp%%=*} # Extract name.
value=${tmp##*=} # Extract value.
echo "Parameter: '$parameter', value: '$value'"
eval $parameter=$value
fi
shift
done
}

# Pass all options to getopt_simple().


getopt_simple $*

echo "test is '$test'"


echo "test2 is '$test2'"

exit 0 # See also, UseGetOpt.sh, a modified version of this


script.
---

sh getopt_example.sh /test=value1 /test2=value2

Parameters are '/test=value1 /test2=value2'


Processing parameter of: '/test=value1'
Parameter: 'test', value: 'value1'
Processing parameter of: '/test2=value2'
Parameter: 'test2', value: 'value2'
test is 'value1'
test2 is 'value2'

Substring Replacement
${string/substring/replacement}

Replace first match of $substring with $replacement. [2]

${string//substring/replacement}

Replace all matches of $substring with $replacement.

stringZ=abcABC123ABCabc

echo ${stringZ/abc/xyz} # xyzABC123ABCabc


# Replaces first match of 'abc' with 'xyz'.

echo ${stringZ//abc/xyz} # xyzABC123ABCxyz


# Replaces all matches of 'abc' with # 'xyz'.

echo ---------------
echo "$stringZ" # abcABC123ABCabc
echo ---------------
# The string itself is not altered!

# Can the match and replacement strings be parameterized?


match=abc
repl=000
echo ${stringZ/$match/$repl} # 000ABC123ABCabc
# ^ ^ ^^^
echo ${stringZ//$match/$repl} # 000ABC123ABC000
# Yes! ^ ^ ^^^ ^^^

echo

# What happens if no $replacement string is supplied?


echo ${stringZ/abc} # ABC123ABCabc
echo ${stringZ//abc} # ABC123ABC
# A simple deletion takes place.

${string/#substring/replacement}

If $substring matches front end of $string, substitute $replacement for


$substring.

${string/%substring/replacement}

If $substring matches back end of $string, substitute $replacement for


$substring.

2.7.2. Manipulating strings using awk

A Bash script may invoke the string manipulation facilities of awk as an


alternative to using its built-in operations.
Example 7-6. Alternate ways of extracting and locating substrings
#!/bin/bash
# substring-extraction.sh

String=23skidoo1
# 012345678 Bash
# 123456789 awk
# Note different string indexing system:
# Bash numbers first character of string as 0.
# Awk numbers first character of string as 1.

echo ${String:2:4} # position 3 (0-1-2), 4 characters long


# skid
# The awk equivalent of ${string:pos:length} is substr(string,pos,length).
echo | awk '
{ print substr("'"${String}"'",3,4) # skid
}
'
# Piping an empty "echo" to awk gives it dummy input,
#+ and thus makes it unnecessary to supply a filename.

echo "----"

# And likewise:

echo | awk '


{ print index("'"${String}"'", "skid") # 3
} # (skid starts at position 3)
' # The awk equivalent of "expr index" ...

exit 0

2.8.Installing Application:

Online installation:

#1. Through software manager(linux mint)/software center(ubuntu):


first open the terminal and run this command to get the latest version of
the software:
sudo apt-get update
then
1. open software manager/center. it's in the menu.
2. search your desired software in the search box
3. if it's in the list then it will appear before you . if it's not in the list
follow the instructions in the ppa installation section of this tutorial.
4. now double click on the desired software entry and then click "install".
5. it will be installed on your system as per your network connection
speed.
#2. Through synaptic package manager:
if it is absent in your linux distribution then you will have to install it
through software manager/center first.
to me it's the best way to install softwares in linux.
1. open synaptic package manager. click reload to get the latest version
of the softwares.
2. search your desired software/s in the search box.
3. right click each software you want to install and mark them for
installing. it will mark additional dependencies on it's own.
if your softwares not in the list follow the instructions in the ppa
installation section of this tutorial.
4. after marking for installing, click apply
6. it will download and install the marked softwares.
additional info:
if you have a list of softwares then save the file with the list, with .list
extension (this file should contain the exact package name one at every
line with an extra string "install" included after each package name
preceding by an space/tab). then go to file->read markings and then brows
to the file and open it. synaptic will mark the softwares in the list
automatically.
#3. Through terminal:
if you know the exact name of the software then you can install it through
terminal by simply entering the command:
sudo apt-get update (to get the latest version)
sudo apt-get install software-package-name
that's it.....
if it says "unable to locate package..." then follow the instructions in
the ppa installation section of this tutorial.
#4. PPA installation:
if your software's not in the software list then it may come from private
package archives (PPA's).
these are private development of softwares so use it at your own risk.
steps:
1. search google for the ppa address for your software. (like ppa for
package-name)
2. then add it to the repository by entering this command in terminal:
sudo add-apt-repository ppa:.....whatever_it_is
3. then run this command (must)
sudo apt-get update
4. now your desired software is in the list. so you can follow one of the
above processes (#1,#2,#3)

Offline installation:
say, you downloaded your desired softwares from some website. in this
case if you don't trust the origin of the software then don't install it or
install it at your own risk.
Your downloaded softwares may come as a .zip, tar.gz, tar.bz2, .deb,
.rpm, .tgz, tar.xz or any other types of archives.
if you are in linux mint or in ubuntu or in a debian based OS try to
download .deb packages because it's easier to install in debian based OS.
#5. installing .deb packages:
through terminal:
cd path_to_the_directory_that_contains_the_.deb_file
sudo dpkg -i filename.deb
through gdebi package manager:
if gdebi is not installed then you have to install it through one of the
processes #1,#2,#3 (requires internet connection)
1. then double click on the .deb file or open the file with gdebi package
manager and click install.
2. it will be istalled soon.
#6. installing .rpm packages:
rpm has to be installed in the system, otherwise follow one of the
processes #1,#2,#3 to install rpm (requires internet connection)
code:
cd path_to_the_directory_that_contains_the_.rpm_file
sudo rpm -i filename.rpm
#7. installing from archives(.zip tar.gz.......etc):
these archives generally conatains the source of the package. each of them
generally has a different approach to install. I will be discussing a common
method which will supposedly work for all of them.
general requirements:
1. flex
2. bison or bison++
3. python
As these archives contains the source, your system needs the required
programming languages to compile and build the source. so the general
requirement packages stated above may not be sufficient for you. in that
case you have to install the required packages through one of the processes
#1,#2,#3 (requires internet connection). you can know about the
dependencies about your software in a readme file included in the
archives.
steps:
1. open the archives with archive manager by double clicking it, then
extract it.
2. code:
cd path-to-the-extracted-folder
3. inside the extracted folder look carefully....
a. if you find a file named configure then :
code:
./configure
make
sudo make install
if the first code fails to execute then run this code before above codes:
chmod +x configure
b. if you find a file named install.sh then
code :
chmod +x install.sh
./install.sh or sudo ./install.sh (if it needs root permission)
or you can double click it and select run in terminal or simply run
N.B : sometimes there is a file, something like your_software_name.sh is
found instead of install.sh. for this case you have to replace install.sh with
the correct name in the previous codes.
c. if you find a file named install then
code:
chmod +x install
./install or sudo ./install (if it needs root permission)
or you can double click it and select run in terminal or simply run
d. if you find a file named make (if there is no configure file) then
code:
make
sudo make install
e. If you still can't find the required files
then it may be in a special folder (generally in a folder named 'bin'). move
to this folder with cd command with appropriate path and then look
again and follow the same process.
#8. pre installed archives:
some packages are archived as pre installed packages i.e you don't have to
install them , you just need to extract them in a secure place and theres an
executable file (name is generally same as the software name) in the
extracted folder or in child folders like bin,build etc. you have to find it
and make it executable.
Example: eclipse, adt bundle (android developing tool)
code to make executable:
chmod +x filename_with_exact_path
then you can run it with :
code:
filename
or double clicking it and selecting run in terminal or run, whatever
supports your software.
#9. installing .sh files:
some softwares come with a .sh file to install it
chmod +x filename.sh
./filename.sh or sudo ./filename.sh (if it needs root permission)
or double click it and select run in terminal or run, whatever supports
your software.
#10. installing .run files:
some softwares come with a .run file to install it
chmod +x filename.run
./filename.run or sudo ./filename.run (if it needs root permission)
or double click it and select run in terminal or run, whatever supports
your software.
Additional info about offline installation:Often, softwares generally have a
lot of dependencies. You need to download all of them, which sometimes
can be very difficult and tiring. for this you can follow the instructions
here which will save your time and effort.

You might also like