SlideShare a Scribd company logo
1 of 40
1
INDEX
S.No Date Topic Sign Remarks
1. Installation, Configuration and Customizations
of UNIX/LINUX.
2. To study UNIX operating system and explain
its function.
3. To study architecture of LINUX.
4. To study basic & user status UNIX/LINUX
commands.
5. To study basic & user status UNIX/LINUX
directory commands.
6. Study and use of commands for performing
arithmetic operation with LINUX.
7. Study and use of commands for changing file
permissions.
8. What is shell programming and shell script?
Explain the types of shell.
9. Write a shell script and put your comments in
your script and make it executable.
10. Write a shell script that stores any value you
want in a variable and access the variable using
commands.
11. Write a program in LINUX which uses all the
arithmetic operators.
12. Write a program in LINUX which uses all the
relational operators.
13. Write a program in LINUX to find out whether
the number is greater or lesser.
14. What is VI editor? Execute shell commands
using VI editor.
15. What is LINUX file system?
2
Experiment No. 1
Installation, Configuration and Customizations of UNIX/LINUX.
Step 1:
The first thing you should do is head to http://www.ubuntu.com/download/ubuntu/download and
download Ubuntu 11.10 LiveCD. Just click the big orange Start download box.
Step 2:
Using your disc burning software, burn the .iso you downloaded to a CD.
Step 3:
Before you go any further, ensure all important data is backed up in case of data loss on your drives.
This guide assumes you have media backups of your Windows partitioned hard drive and you are safe
to proceed.
***Warning: Installing another operating system without first ensuring you have backups of your
current files and operating system is a big risk. If you have no data to lose or you’ve backed up
important data, you’re ready to proceed. YOU are responsible if you lose data. For those of you using
Windows, and installing Linux for the first time I recommend you either use a separate hard disk that
does not contain the Windows OS, or create a partition big enough for Linux within Windows using
Disk Management in the Administrative Tools menu of the control panel. 30GB of hard disk space is
absolutely plenty of space for you to begin exploring Ubuntu whilst at the same time having room to
grow.
Step 4:
Ensure you have a network cable connected, restart your computer, and boot from the CD drive.
3
Step 5:
The LiveCD will load up, and you'll be presented by the following box.
For the purposes of this guide, we will assume you've already tried Ubuntu and want to proceed with
an installation, so click "Install Ubuntu."
Step 6:
You'll be greeted by the "Preparing to install Ubuntu" screen, exactly as below.
4
I recommend you select "Install third-party software" as I have done in the screenshot above. I prefer
to do system updates once up and running, but if you have the extra time you can also select
"download updates while installing" as well. Then click continue.
Step 7:
The next screen you will see is "installation type," what you see will be dependent on whether you
have an existing Windows installation or not.
I'm going to split this into three different sub-steps, to make it as simple as possible.
Step 7-A:
For those installing in a virtual machine or to hard disks without an OS you will see the following
screen:
5
You have two choices:
1. Erase the entire disk and use all of it for installation -- Ubuntu will automatically partition your disk
and proceed with installation.
2. Select "something else" and manually create your partitions (which is covered in detail in step 7-C).
If you are choosing the first option, select the radio button and then click continue, proceeding to
step 8.
Step 7-B:
Those of you that have current Windows installations or are going to dual-boot with another existing
OS will be presented with a screen similar to below.
6
You have three options available:
1. You can choose the first option and install Ubuntu alongside your existing OS.
2. You can opt to replace your Windows installation with Ubuntu, allowing the installer to format your
current partitions and automatically create new ones for Linux.
3. You can choose "something else" and create your own partition scheme and sizing (covered in
detail in step 7-C).
Once you have selected which route you wish to proceed with click continue and proceed to step 8.
Step 7-C:
Having selected the "something else" option you will be presented with the following window,
Linux recognizes and assigns IDs to drive in a different manner to Windows. In the above image, you
can clearly see my hard disk in the list. It is identified by "/dev/sda." Linux recognizes drives in the
following way:
• Sda = 1st drive
7
• Sdb = 2nd drive
• Sdc = 3rd drive and so on
Partitions are also shown after the drive letters. So if I had 2 partitions on my first disk, they would be
identified as:
• Sda1 – 1st drive, 1st partition
• Sda2 – 1st drive, 2nd partition
You will not see the common Windows C: label in the disk menu in the above list. You do, however,
have key things to help you recognize your Windows C: drive. Both of these can be used to identify
which is your Windows disk.
• The size of the disk is shown
• The name of the drive is shown
This is your current partition layout for your hard disks. If you have more than one disk, they will show
up as /dev/sda, /dev/sdb etc.
Firstly, identify your Windows installation. In my case, it's sda1 (which is my first hard disk, first
partition). What you see depends on how you created the extra space. I just resized the Windows
partition from within Windows, and left the free space ready to install Linux. I recommend using
Windows or a free utility from within Windows to resize your partition as most beginners will
understand it more.
Therefore, we now need create a minimum of two partitions:
Click "Add" and the following box will appear:
You will notice I have already filled out the example above to create a 10GB root partition.
You can have a maximum of 4 primary partitions, or 3 primary partitions and 1 logical (which allows
8
for another 64 partitions). The size above is 10.00GB. e.g. 1,000 = 1GB 10,000 = 10GB (Remember to
leave enough free remaining space to create your SWAP partition!)
Location for new partition: e.g. do you want it at the start or end of the free space. Select beginning.
Use as: Ext4 is the recommended file system for Ubuntu, much the same as NTFS is Windows. SWAP
is for SWAP space.
Mount point: This is where you want the partition to mount. E.g. we need a root partition, which in
Linux is denoted by a "/".
Click OK once you have finished setting the partition information and you will return to your partition
screen, now showing the root partition you just created. Using the same methods as before, create a
SWAP partition.
I recommend you set the size of your SWAP partition to at least the size of your available RAM. If you
have plenty of hard disk capacity I would suggest you use double the size. So if you have 2GB of RAM,
set it to either 2GB or 4GB. For best performance it is recommended you have your SWAP partition at
the beginning or end of your drive.
Once you have done that, you should be looking at something like below.
So to re-cap the above, (in my example) we have the following:
• /dev/sda1 is your Windows partition.
• /dev/sda2 is your new root partition (Windows equiv. of C.
• /dev/sda3 is your SWAP space.
Once you are happy with the changes you have made, click install now and proceed to the next step.
9
Step 8:
As the installation starts to copy the required files to the hard disk, you will be presented with a
screen to select your locale. It should automatically find where you are, as it has for me already.
Just double check it is correct, and then select continue.
Step 9:
The next screen to appear will be keyboard layout.
Ensure the correct option is selected, above you will see the correct (and default UK) selection has
been automatically made for me.
10
Step 10:
You will now be greeted by the "who are you" screen, ready for you to fill out with your user details.
The computers name and username will automatically populate when you type your full name. You
can however edit them as you please. Fill in the details and then click continue.
You can opt to have Ubuntu automatically log in for you -- even with a password set -- or you can
choose the traditional option requiring a password to log in. You really don't need to choose the
encrypt option unless you're installing on a laptop and are dealing with highly secure information.
Step 11:
The installation information screens will now appear as Ubuntu continues the installation:
11
Step 12:
Once installation has finished, you will be presented with the following box
Select "restart now" and when requested, remove your installation CD, then press enter to reboot.
Step 13:
For those of you that have Ubuntu as the only OS the computer will boot directly into Linux. If you're
dual-booting, you will see the GRUB menu appear similar to below.
12
Hit enter, to select the first option and load your newly installed Ubuntu OS.
Step 14:
For those that elected to automatically log into Ubuntu, you will go straight to the desktop in Step 15.
For everyone else, you will be greeted with the new login manager for Ubuntu.
Enter your password, and hit enter to login to your desktop.
Step 15:
Your desktop should look like this.
13
Step 16:
Before we proceed further, let's check for updates. Click on the power button on the top right corner
of the screen and select "check for updates," or words to that effect.
I'd already run updates on this install so the example above is displaying "software up to date," but
the picture highlights where you need to select anyway.
Upon selecting the update option, the update manager will appear, as below.
14
If it comes up with no available updates, just select "check" again to verify that it is correct. Having
done the same thing myself, I was presented with the updates you see above. For those that opted to
install updates during installation it is unlikely there will be further updates required.
You might be asked to enter your password to confirm changes. If prompted, enter your password
and click OK. The same is true of any notifications that may appear during updating the OS.
Once complete select close, and restart Ubuntu. The power button is located on the top right corner
of the screen. Click this and select shutdown
Step 17:
No install is complete without full support for mp3s, core MS fonts, DVD playback codecs, Flash and
Java, so let’s go ahead and sort this now.
Click the black Ubuntu menu button at the top left corner of the screen and in the menu that appears,
type "software center" and select the Ubuntu Software Centre. Once open, click the search bar, type
"restricted" and the following should appear:
15
Select Ubuntu restricted extras, and then click on the install button.
Authentication is much like UAC (user access control) in windows Vista and 7. It is required to elevate
your user privileges to that of root (Linux administrator).
Ubuntu restricted extras will now download, sort any dependencies and install. You can check its
progress by viewing the progress bar above the install button. Once finished the In Progress tab will
disappear -- restart Linux. It’s not strictly necessary, but I always do it after installing this package so
everything can start up properly.
Now you can enjoy your new OS and begin exploring its features.
16
Experiment No. 2
To study UNIX operating system and explain its function.
OPERATING SYSTEM:An Operating System is a set of programs that Functions as an virtual
machine by presenting an interface that is easier to program than the underlying hardware acts as
resource management through orderly and controlled allocation of the processors, memories, and I/O
devices among the programs competing for it.
Types of Operating System:
1. Single User: The system will have its own hard disk, memory, CPU and other resources all
dedicated to a single user. Example: MS-DOS.
2. Multi User: The users having access to a multi-user system will have just a terminal and a
keyboard. The other resources such as hard disk, printers are centrally located. The user is
expected to simply hook onto his account, perform the work, disconnect and leave quietly.
Example: UNIX.
UNIX History:
The spade work for UNIX began at AT&T Bell Laboratories in 1969 by Ken Thompson and Dennis
Ritchie. The OS was initially known as UNICS (jokingly UNiplexed Information and Computing
System). In 1970 UNICS finally became UNIX. In 1973, UNIX was rewritten in 1973 in C principally
authored by Ritchie.
UNIX Function:
1. Multi-user system: Multi-user capability of UNIX allows several users to use the same
computer to perform their tasks. Several terminals [Keyboards and Monitors] are connected to a
single powerful computer [UNIX server] and each user can work with their terminals.
2. Multi-tasking system: Multitasking is the capability of the operating system to perform
various task simultaneously, i.e. a user can run multiple tasks concurrently.
3. Programming Facility: UNIX is highly programmable, the UNIX shell has all the necessary
ingredients like conditional and control structures, etc.
4. Security: UNIX allows sharing of data; every user must have a single login name and password.
So, accessing another user’s data is impossible without his permission.
5. Portability: UNIX is portable because it is written in a high level language. So, UNIX can be run
on different computers.
6. Communication: UNIX supports communication between different terminals of the same
server as well as between terminals on different servers. Apart from these features, UNIX has an
17
extensive Tool kit, exhaustive system calls and Libraries and enhanced GUI (X Window).
Experiment No. 3
To study architecture of LINUX.
Linux System Architecture is consists of following layers:
ORGANIZATION OF UNIX
Hardware layer: Hardware consists of all peripheral devices (RAM/ HDD/ CPU etc).
Kernel:Core component of Operating System, interacts directly with hardware, and provides low
level services to upper layer components. The kernel is the heart of the system, a collection of
programs written in C that directly communicate with the hardware. There is only one kernel for any
system. It's that part of UNIX system that is loaded into memory when the system is booted. It
manages the system resources, allocates time between users and processes, decides process
priorities, and performs all other tasks. The kernel, in traditional parlance, is often called the
Operating system.
Shell: An interface to kernel, hiding complexity of kernel's functions from users. Takes commands
from user and executes kernel's functions. The shell, on the other hand, is the "sleeping beauty" of
UNIX. It is actually the interface between the user and the kernel. The shell is the agency which takes
18
care of the features of redirection and has a programming capability of its own.
Utilities: The Tools and Applications consist of Application Software, Compilers, Database Package,
Internet tools, UNIX commands, etc.
Experiment No. 4
To study basic & user status UNIX/LINUXcommands.
1. “touch” command: Create an empty file with 0 byte. It is also used to change the access and
modified time of currently exiting file.
Syntax:
$touch [option] [filename]
option:
“-a”: update the access time of a file.
“-m”: update the modification time of a file.
2. “chomd” command(Change Mode): Changes the file mode. The command is used to
change the permission of an ordinary file or directory.
Syntax:
$chmod <nnn> filename
Number Binary
Text
<nnn>
Octal Permission Representation
0 000 --- No permission (All types of access are denied
1 001 --x Execute permission (Execute access is allowed only)
2 010 -w- Write permission (Write access is allowed only)
3
011
-wx
Execute and write permission: 1 (execute) + 2 (write) = 3 (Write and
Execute are allowed)
4 100 r-- Read permission (Read access is allowed only)
5 101 r-x
Read and execute permission: 4 (read) +1 (execute) = 5 (Read and
Execute access are allowed)
6
110
rw-
Read and write permission: 4 (read) + 2 (write) = 6 (Read and Write
access are allowed)
7 111 rwx
All permissions: 4 (read) + 2 (write) + 1 (execute) = 7 (Read, Write and
Execute are allowed)
3. “rm” command(Remove File): The command is used to remove file from the system.
19
Syntax:
$rm (f) filename
f: remove all the files regardless of their permission.
4. “mv” command(Move File): The command is used to move file from source to destination.
Syntax:
$mv (F) <source> <destination>
F: Do not ask whole approval or confirmation.
5. “cp” command(Copy File): The command copy the file from source to destination.
Syntax:
$cp <source> <destination>
6. “wc” command(WordCount): Counting the number of characters, words and lines.
Syntax:
$wc [option] [file]
option:
“-w”:words
“-l”:lines
“-c”:characters
7. “cat” command(Display File): This command is used to display file.
Syntax:
$cat <filename>
20
Experiment No. 5
To study basic & user status UNIX/LINUXdirectory commands.
1. “ls” command: The “ls” command lists all files in the directory.
Syntax:
$ls [option] [filename]
option:
“-a”: list all the hidden files.
“-t”: list of the file name sorted by create time.
“-l”: long list of the directory purpose show the owner, group, permission and file size.
2. “pwd” command(Print Working Directory): It display the current path, pathname,
enables you to work out where you are in relation to all file system.
Syntax:
$pwd
3. “cd” command(Change Directory): The command cd directory means change the
working to directory.
Syntax:
$cd
4. “mkdir” command(Make Directory): This command is used to create a directory.
Syntax:
$mkdir <directoryname>
5. “rmdir” command(Remove Directory): This command is used to remove directory.
Syntax:
$rmdir <directory name>
21
Experiment No.6
Study and use of commands for performing arithmetic operation with LINUX.
“bc” is an arbitrary precision calculator language. A standard math library is available by command
line option. If requested, the math library is defined before processing any files.bc starts by processing
code from all the files listed on the command line in the order listed. After all files have been
processed, bc reads from the standard input. All code is executed as it is read. (If a file contains a
command to halt the processor, bc will never read from the standard input.)
22
Experiment No. 7
Study and use of commands for changing file permissions.
File ownership is an important component of UNIX that provides a secure method for storing files.
Every file in UNIX has the following attributes:
1. Owner permissions: The owner's permissions determine what actions the owner of the file
can perform on the file.
2. Group permissions: The group's permissions determine what actions a user, who is a
member of the group that a file belongs to, can perform on the file.
3. Other (world) permissions: The permissions for others indicate what action all other users
can perform on the file.
The Permission Indicators:
While using ls -l command it displays various information related to file permission as follows:
$ls -l /home/tarun
-rwxr-xr-- 1 tarun users 1024 Nov 2 00:10 myfile
drwxr-xr--- 1 tarun users 1024 Nov 2 00:10 mydir
Here first column represents different access mode i.e. Permission associated with a file or directory.
The permissions are broken into groups of threes, and each position in the group denotes a specific
permission, in this order: read (r), write (w), execute (x):
 The first three characters (2-4) represent the permissions for the file's owner. For example -
rwxr-xr-- represents that owner has read (r), write (w) and execute (x) permission.
 The second group of three characters (5-7) consists of the permissions for the group to which
the file belongs. For example -rwxr-xr-- represents that group has read (r) and execute (x)
permission but no write permission.
23
 The last group of three characters (8-10) represents the permissions for everyone else. For
example -rwxr-xr-- represents that other world has read (r) only permission.
File Access Modes:
The permissions of a file are the first line of defense in the security of a UNIX system. The basic
building blocks of UNIX permissions are the read, write, and execute permissions, which are
described below:
1. Read: Grants the capability to read i.e. view the contents of the file.
2. Write: Grants the capability to modify, or remove the content of the file.
3. Execute: User with execute permissions can run a file as a program.
To change file or directory permissions, you use the chmod (change mode) command. There are two
ways to use chmod: symbolic mode and absolute mode.
Using chmod in Symbolic Mode: The easiest way for a beginner to modify file or directory
permissions is to use the symbolic mode. With symbolic permissions you can add, delete, or specify
the permission set you want by using the operators in the following table.
Chmod operator Description
+
Adds the designated permission(s) to a file or
directory.
-
Removes the designated permission(s) from a file or
directory.
= Sets the designated permission(s).
Here's an example using testfile. Running ls -1 on testfile shows that the file's permissions are as
follows:
$ls -l abc
-rwxrwxr-- 1 tarun users 1024 Nov 2 00:10 abc
Then each example chmod command from the preceding table is run on testfile, followed by ls -l so
you can see the permission changes:
$chmod o+wx abc
$ls -l abc
-rwxrwxrwx 1 tarun users 1024 Nov 2 00:10 abc
$chmod u-x abc
$ls -l abc
-rw-rwxrwx 1 tarun users 1024 Nov 2 00:10 abc
$chmod g=r-x abc
$ls -l testfile
-rw-r-xrwx 1 tarun users 1024 Nov 2 00:10 abc
24
Here's how you could combine these commands on a single line:
$chmod o+wx,u-x,g=r-x abc
$ls -l abc
-rw-r-xrwx 1 tarun users 1024 Nov 2 00:10 abc
Using chmod with Absolute Permissions:
The second way to modify permissions with the chmod command is to use a number to specify each
set of permissions for the file.
Each permission is assigned a value, as the following table shows, and the total of each set of
permissions provides a number for that set.
Number Binary Text Octal Permission Representation
0 000 --- No permission (All types of access are denied
1 001 --x Execute permission (Execute access is allowed only)
2 010 -w- Write permission (Write access is allowed only)
3
011
-wx
Execute and write permission: 1 (execute) + 2 (write) = 3 (Write and Execute
are allowed)
4 100 r-- Read permission (Read access is allowed only)
5 101 r-x
Read and execute permission: 4 (read) +1 (execute) = 5 (Read and Execute
access are allowed)
6
110
rw-
Read and write permission: 4 (read) + 2 (write) = 6 (Read and Write access
are allowed)
7
111
rwx
All permissions: 4 (read) + 2 (write) + 1 (execute) = 7 (Read, Write and
Execute are allowed)
25
Experiment No. 8
What is shell programming and shell script? Explain the types of shell.
Shell:The shell or the command interpreter is the mediator which interprets the command that we
give and then convey them to the kernel which ultimately executes them.
Syntax:
$echo $SHELL
Types of shell:
1. Bourne shell (sh): originally UNIX shell written by Steve Bourne of Bell Labs, which is
available on all UNIX system.
It is bundled with every UNIX system.
2. C shell (csh): it was created by Bill Joy. It has advantage over the Bourne shell. Provides the c
like languages with which to write shell script.
C shell has 1 command history feature; this is the second benefit of that comes with C shell.
3. Korn shell (ksh): shell written by David Korn of Bell Labs, which is now provided as the
Standard Shell in UNIX system.
It provides all the features of the C together with a shell programming language similar to that
of the original Bourne Shell.
It is the most efficient shell.
4. Bourne Again Shell (Bash): this is the public domain shell written by the free software
26
foundation widely used within the academic community.
Provides all the interactive features of the C shell and the Korn Shell (ksh).
If Bourne Shell (sh) is used for shell programming, bash is recommended as a complete shell
environment.
Experiment No. 9
Write a shell script and put your comments in your script and make it
executable.
To write shell script and make it executable, the following procedure should be followed:
1. Firstly we have to enter in editor, .i.e., VI Editor using command “vi”.
Syntax to enter in VI Editor:
$vi filename
2. To executable we have to change the permission of file by using following syntax:
$chmod +x filename
3. To run the executable script we have to use the following syntax:
$./filename
27
Experiment No. 10
Write a shell script that stores any value you want in a variable and access the
variable using commands.
For writing a shell script in Linux command is used named as “script”.
$script
A variable assignment is of form variable=value (no spaces around ‘=’), but its evaluation requires the
$ as prefix to the variable name.
$a=50 // Here 50 is assigned to variable a
$echo $a // By using command echo the value of a will show on display
50
28
$total=$a
$echo $total
50
Output:
Experiment No. 11
Write a program in LINUXwhich uses all the arithmetic operators.
#include<stdio.h>
int main()
{
int a,b,c=0,op=0;
printf("nEnter the value of first number:");
scanf("%d",&a);
printf("nEnter the value of second number:");
29
scanf("%d",&b);
printf("nSelect the following to perform operationn");
printf("1. ADDITIONn");
printf("2. SUBTRACTIONn");
printf("3. MULTIPLICATIONn");
printf("4. DIVISIONn");
printf("5. EXITn");
printf("nnSelect option from the above:");
scanf("%d",&op);
switch(op)
{
case 1:
c=a+b;
printf("Sum:%dnn",c);
break;
case 2:
if(a>b)
{
c=a-b;
printf("Subtraction:%dnn",c);
}
else
{
c=b-a;
printf("Subtraction:%dnn",c);
}
break;
case 3:
c=a*b;
printf("Multiplication:%dnn",c);
break;
case 4:
if(a>=b)
{
c=a/b;
printf("Division:%dnn",c);
}
else
{
printf("Division is in decimal valuenn");
}
break;
30
case 5:
printf("nnttTHANK YOUnn");
break;
default:
printf("Invalid optionnn");
break;
}
return 0;
}
Output for Addition:
Output for Subtraction:
31
Output of Multiplication:
32
Output of Modulo Division:
33
Experiment No. 12
Write a program in LINUXwhich uses all the relational operators.
#include<stdio.h>
int main()
{
int a,b;
printf("nEnter the fisrt number:");
scanf("%d",&a);
printf("nEnter the Second number:");
scanf("%d",&b);
if(a==b)
{
printf("nn%d is equal to %dn",a,b);
}
if(a!=b)
{
printf("nn%d is not equal to %dn",a,b);
}
if(a<b)
{
printf("nn%d is less than %dn",a,b);
}
if(a>b)
{
printf("nn%d is greater than %dn",a,b);
}
/* Lets change the values of numbers */
printf("nEnter the fisrt number:");
scanf("%d",&a);
printf("nEnter the Second number:");
scanf("%d",&b);
if(a<=b)
{
printf("nn%d is either less than or equal to %dnn",a,b);
}
else
{
printf("nn%d is either greater than or equal to %dnn",a,b);
34
}
return 0;
}
Output:
35
Experiment No. 13
Write a program in LINUXto find out whether the numberis greater or lesser.
#include<stdio.h>
int main()
{
int a,b,c;
printf("nEnter the first number:");
scanf("%d",&a);
printf("nEnter the second number:");
scanf("%d",&b);
printf("nEnter the third number:");
scanf("%d",&c);
/* To find largest number */
if( a>b && a>c )
{
printf("nn%d is the largest numbernn",a);
}
else
if( b>c && b>a )
{
printf("nn%d is the largest numbernn",b);
}
else
{
printf("nn%d is the largest numbernn",c);
}
/* To find smallest number */
if( a<b && a<c )
{
printf("nn%d is the smallest numbernn",a);
}
else
if( b<c && b<a )
{
36
printf("nn%d is the smallest numbernn",b);
}
else
{
printf("nn%d is the smallest numbernn",c);
}
return 0;
}
Output:
37
Experiment No. 14
What is VI editor? Execute shell commands using VI editor.
There are many ways to edit files in UNIX and for me one of the best ways is using screen-oriented
text editor vi. This editor enables you to edit lines in context with other lines in the file. Now days you
would find an improved version of vi editor which is called VIM. Here VIM stands for ViIMproved.
The VI is generally considered the de facto standard in UNIX editors because:
1. It's usually available on all the flavors of UNIX system.
2. Its implementations are very similar across the board.
3. It requires very few resources.
4. It is more user friendly than any other editors like ed or ex.
You can use vi editor to edit an existing file or to create a new file from scratch. You can also use this
editor to just read a text file.
Starting the VI Editor:
There are following way you can start using VI editor:
Command Description
vi filename
Creates a new file if it already does not exist, otherwise
opens existing file.
vi -R filename Opens an existing file in read only mode.
view filename Opens an existing file in read only mode.
Following is the example to create a new file testfile if it already does not exist in the current working
directory:
$vi abc
As a result you would see a screen something like as follows:
38
|
~
~
~
~
~
~
~
~
~
~
~
~
"abc" [New File]
You will notice a tilde (~) on each line following the cursor. A tilde represents an unused line. If a line
does not begin with a tilde and appears to be blank, there is a space, tab, newline, or some other non-
viewable character present.
So now you have opened one file to start with. Before proceeding further let us understanding few
minor but important concepts explained below.
OperationModes:
While working with VI editor you would come across following two modes:
1. Command mode: This mode enables you to perform administrative tasks such as saving files,
executing commands, moving the cursor, cutting (yanking) and pasting lines or words, and
finding and replacing. In this mode, whatever you type is interpreted as a command.
2. Insert mode: This mode enables you to insert text into the file. Everything that's typed in this
mode is interpreted as input and finally it is put in the file.
The vi always starts in command mode. To enter text, you must be in insert mode. To come in insert
mode you simply type i. To get out of insert mode, press the Esc key, which will put you back into
command mode.
Hint: If you are not sure which mode you are in, press the Esc key twice, and then you'll be in
command mode. You open a file using VI editor and start type some characters and then come in
command mode to understand the difference.
Getting Out of VI:
The command to quit out of vi is: q. Once in command mode, type colon, and 'q', followed by return.
If your file has been modified in any way, the editor will warn you of this, and not let you quit. To
ignore this message, the command to quit out of vi without saving is: q! This lets you exit vi without
saving any of the changes.
39
The command to save the contents of the editor is: w. you can combine the above command with the
quit command, or: wq and return.
The easiest way to save your changes and exit out of vi is the ZZ command. When you are in
command mode, type ZZ and it will do the equivalent of: wq.
Experiment No. 15
What is LINUX file system?
A file in UNIX is nothing but a storehouse of information and everything is treated as a file by UNIX.
The files can be broadly classified as follows:
1. Ordinary files: Contains stream of data. All data, text, source programs, object and executable
code, commands fall into this category.
2. Directory files: Contains no external data. It contains an entry, name of the file and its inode
(identification number) for each file and subdirectory under that directory. Directory files are
not created by the user but by the UNIX system itself.
3. Device files: Even physical devices are treated as files. These are special in the sense that any
output directed to it will be reflected onto the respective device.
40
UNIX File System
All files in UNIX are related to one another. The file system of UNIX resembles a tree that grows from
top to bottom as shown in the figure. The file system begins with a directory called root (at the top).
The root directory is denoted by a slash (). Branching from root there are several directories such as
bin, lib, etc, tmp, dev. Each of these directories contains several sub-directories and files.

More Related Content

What's hot

Tricks N Tips By Ravish Roshan
Tricks N Tips By Ravish RoshanTricks N Tips By Ravish Roshan
Tricks N Tips By Ravish Roshanravish roshan
 
Windows xp and windows 7 installaton
Windows xp and windows 7 installatonWindows xp and windows 7 installaton
Windows xp and windows 7 installatonSiddharth Jain
 
How to install windows 7
How  to install windows 7How  to install windows 7
How to install windows 7cmark11
 
Instalar w7 desde_usb
Instalar w7 desde_usbInstalar w7 desde_usb
Instalar w7 desde_usbRoberto Loera
 
How to Install Ubuntu as Dual
How to  Install Ubuntu as DualHow to  Install Ubuntu as Dual
How to Install Ubuntu as DualKanchilug
 
How to install windows 8
How to install windows 8How to install windows 8
How to install windows 8Itech Fever
 
Windows 7 Unit A PPT
Windows 7 Unit A PPTWindows 7 Unit A PPT
Windows 7 Unit A PPTokmomwalking
 
Windows Xp Presentation Downing
Windows Xp Presentation  DowningWindows Xp Presentation  Downing
Windows Xp Presentation DowningIWCS
 
How to create windows 10 bootable usb drive from iso using Command Prompt
How to create windows 10 bootable usb drive from iso using Command PromptHow to create windows 10 bootable usb drive from iso using Command Prompt
How to create windows 10 bootable usb drive from iso using Command PromptViney Dhiman
 
Windows 7 project.pptx
Windows 7 project.pptxWindows 7 project.pptx
Windows 7 project.pptxTea Trebicka
 
Windows 7 VS Windows 8
Windows 7 VS Windows 8Windows 7 VS Windows 8
Windows 7 VS Windows 8Yugal Gupta
 
Coc 4 backup and restore
Coc 4 backup and restoreCoc 4 backup and restore
Coc 4 backup and restoreDanilo Anos
 
Linux installation on a Virtual Machine
Linux installation on a Virtual MachineLinux installation on a Virtual Machine
Linux installation on a Virtual MachineNikhil Bhalwankar
 

What's hot (20)

Unit A Windows 7
Unit A Windows 7Unit A Windows 7
Unit A Windows 7
 
Bootable Usb
Bootable UsbBootable Usb
Bootable Usb
 
Tricks N Tips By Ravish Roshan
Tricks N Tips By Ravish RoshanTricks N Tips By Ravish Roshan
Tricks N Tips By Ravish Roshan
 
Windows xp and windows 7 installaton
Windows xp and windows 7 installatonWindows xp and windows 7 installaton
Windows xp and windows 7 installaton
 
How to install windows 7
How  to install windows 7How  to install windows 7
How to install windows 7
 
Instalar w7 desde_usb
Instalar w7 desde_usbInstalar w7 desde_usb
Instalar w7 desde_usb
 
Windows 7, 8, 8.1 & 10
Windows 7, 8, 8.1 & 10Windows 7, 8, 8.1 & 10
Windows 7, 8, 8.1 & 10
 
Dual boot
Dual bootDual boot
Dual boot
 
How to Install Ubuntu as Dual
How to  Install Ubuntu as DualHow to  Install Ubuntu as Dual
How to Install Ubuntu as Dual
 
How to install windows 8
How to install windows 8How to install windows 8
How to install windows 8
 
Windows 7 Unit A PPT
Windows 7 Unit A PPTWindows 7 Unit A PPT
Windows 7 Unit A PPT
 
Windows 7 Features
Windows 7 FeaturesWindows 7 Features
Windows 7 Features
 
Windows Xp Presentation Downing
Windows Xp Presentation  DowningWindows Xp Presentation  Downing
Windows Xp Presentation Downing
 
Windows xp install
Windows xp installWindows xp install
Windows xp install
 
How to create windows 10 bootable usb drive from iso using Command Prompt
How to create windows 10 bootable usb drive from iso using Command PromptHow to create windows 10 bootable usb drive from iso using Command Prompt
How to create windows 10 bootable usb drive from iso using Command Prompt
 
Windows 7 project.pptx
Windows 7 project.pptxWindows 7 project.pptx
Windows 7 project.pptx
 
Arraque dual "open suse y windows"
Arraque dual "open suse y windows"Arraque dual "open suse y windows"
Arraque dual "open suse y windows"
 
Windows 7 VS Windows 8
Windows 7 VS Windows 8Windows 7 VS Windows 8
Windows 7 VS Windows 8
 
Coc 4 backup and restore
Coc 4 backup and restoreCoc 4 backup and restore
Coc 4 backup and restore
 
Linux installation on a Virtual Machine
Linux installation on a Virtual MachineLinux installation on a Virtual Machine
Linux installation on a Virtual Machine
 

Viewers also liked

Service solahart serpong 087777888338
Service solahart serpong 087777888338Service solahart serpong 087777888338
Service solahart serpong 087777888338hasian service
 
Erick Parsell Resume- 2016 territory
Erick Parsell Resume- 2016 territoryErick Parsell Resume- 2016 territory
Erick Parsell Resume- 2016 territoryErick Parsell
 
Gholz press protecting_2
Gholz press protecting_2Gholz press protecting_2
Gholz press protecting_2Elechi Aja
 
Reflexive questions
Reflexive questionsReflexive questions
Reflexive questionsDEFToer3
 
Why Utility Scale Wind Power is Wrong for Vermont By Ben Luce, Ph.D.
Why Utility Scale Wind Power is Wrong for Vermont By Ben Luce, Ph.D.Why Utility Scale Wind Power is Wrong for Vermont By Ben Luce, Ph.D.
Why Utility Scale Wind Power is Wrong for Vermont By Ben Luce, Ph.D.Energize Vermont
 
19 January Daily market report
19 January Daily market report 19 January Daily market report
19 January Daily market report QNB Group
 
Icomplete phone call archive (mobile and landlines) - e brochure
Icomplete   phone call archive (mobile and landlines) - e brochureIcomplete   phone call archive (mobile and landlines) - e brochure
Icomplete phone call archive (mobile and landlines) - e brochuremyleshantler
 
Marktbote2014
Marktbote2014Marktbote2014
Marktbote2014WMdN
 
Social media 101 november 2011
Social media 101 november 2011Social media 101 november 2011
Social media 101 november 2011mrjtyler
 
Global Online Payment Methods Report 2013 - First Half 2013 by yStats.com
Global Online Payment Methods Report 2013 - First Half 2013 by yStats.comGlobal Online Payment Methods Report 2013 - First Half 2013 by yStats.com
Global Online Payment Methods Report 2013 - First Half 2013 by yStats.comyStats.com
 
RF Code solutions presentation
RF Code solutions presentationRF Code solutions presentation
RF Code solutions presentationpe2six
 
Putting the D&D in TDD
Putting the D&D in TDDPutting the D&D in TDD
Putting the D&D in TDDGuy Royse
 
D &amp; C Inpsection Services, Inc Presentation
D &amp; C Inpsection Services, Inc PresentationD &amp; C Inpsection Services, Inc Presentation
D &amp; C Inpsection Services, Inc Presentationdcinspection
 
GPDI Portfolio 2014
GPDI Portfolio 2014GPDI Portfolio 2014
GPDI Portfolio 2014scottgales
 
Problèmatique de l'entrepreneuriat et de la Micro finance des jeunes en RDC
Problèmatique de l'entrepreneuriat et de la Micro finance des jeunes en RDCProblèmatique de l'entrepreneuriat et de la Micro finance des jeunes en RDC
Problèmatique de l'entrepreneuriat et de la Micro finance des jeunes en RDCpolybru
 
CALL CENTER BUSINESS IN BANGLADESH SHAHIN PSTU
CALL CENTER BUSINESS IN BANGLADESH SHAHIN PSTUCALL CENTER BUSINESS IN BANGLADESH SHAHIN PSTU
CALL CENTER BUSINESS IN BANGLADESH SHAHIN PSTUMd. Shahinuzzaman
 
Prepositions English- M. van Eijk MA
Prepositions English- M. van Eijk MAPrepositions English- M. van Eijk MA
Prepositions English- M. van Eijk MAZadkine
 
Bacteria enumeration
Bacteria enumerationBacteria enumeration
Bacteria enumerationmartyynyyte
 

Viewers also liked (20)

Service solahart serpong 087777888338
Service solahart serpong 087777888338Service solahart serpong 087777888338
Service solahart serpong 087777888338
 
Nga baku
Nga bakuNga baku
Nga baku
 
Erick Parsell Resume- 2016 territory
Erick Parsell Resume- 2016 territoryErick Parsell Resume- 2016 territory
Erick Parsell Resume- 2016 territory
 
Gholz press protecting_2
Gholz press protecting_2Gholz press protecting_2
Gholz press protecting_2
 
Reflexive questions
Reflexive questionsReflexive questions
Reflexive questions
 
Why Utility Scale Wind Power is Wrong for Vermont By Ben Luce, Ph.D.
Why Utility Scale Wind Power is Wrong for Vermont By Ben Luce, Ph.D.Why Utility Scale Wind Power is Wrong for Vermont By Ben Luce, Ph.D.
Why Utility Scale Wind Power is Wrong for Vermont By Ben Luce, Ph.D.
 
19 January Daily market report
19 January Daily market report 19 January Daily market report
19 January Daily market report
 
Icomplete phone call archive (mobile and landlines) - e brochure
Icomplete   phone call archive (mobile and landlines) - e brochureIcomplete   phone call archive (mobile and landlines) - e brochure
Icomplete phone call archive (mobile and landlines) - e brochure
 
Compensation Plan Us En
Compensation Plan Us EnCompensation Plan Us En
Compensation Plan Us En
 
Marktbote2014
Marktbote2014Marktbote2014
Marktbote2014
 
Social media 101 november 2011
Social media 101 november 2011Social media 101 november 2011
Social media 101 november 2011
 
Global Online Payment Methods Report 2013 - First Half 2013 by yStats.com
Global Online Payment Methods Report 2013 - First Half 2013 by yStats.comGlobal Online Payment Methods Report 2013 - First Half 2013 by yStats.com
Global Online Payment Methods Report 2013 - First Half 2013 by yStats.com
 
RF Code solutions presentation
RF Code solutions presentationRF Code solutions presentation
RF Code solutions presentation
 
Putting the D&D in TDD
Putting the D&D in TDDPutting the D&D in TDD
Putting the D&D in TDD
 
D &amp; C Inpsection Services, Inc Presentation
D &amp; C Inpsection Services, Inc PresentationD &amp; C Inpsection Services, Inc Presentation
D &amp; C Inpsection Services, Inc Presentation
 
GPDI Portfolio 2014
GPDI Portfolio 2014GPDI Portfolio 2014
GPDI Portfolio 2014
 
Problèmatique de l'entrepreneuriat et de la Micro finance des jeunes en RDC
Problèmatique de l'entrepreneuriat et de la Micro finance des jeunes en RDCProblèmatique de l'entrepreneuriat et de la Micro finance des jeunes en RDC
Problèmatique de l'entrepreneuriat et de la Micro finance des jeunes en RDC
 
CALL CENTER BUSINESS IN BANGLADESH SHAHIN PSTU
CALL CENTER BUSINESS IN BANGLADESH SHAHIN PSTUCALL CENTER BUSINESS IN BANGLADESH SHAHIN PSTU
CALL CENTER BUSINESS IN BANGLADESH SHAHIN PSTU
 
Prepositions English- M. van Eijk MA
Prepositions English- M. van Eijk MAPrepositions English- M. van Eijk MA
Prepositions English- M. van Eijk MA
 
Bacteria enumeration
Bacteria enumerationBacteria enumeration
Bacteria enumeration
 

Similar to Srgoc linux

The installing of widows 7
The installing of widows 7The installing of widows 7
The installing of widows 7MCC
 
Install Linux OS in Virtual Box.pptx
Install Linux OS in Virtual Box.pptxInstall Linux OS in Virtual Box.pptx
Install Linux OS in Virtual Box.pptxCiceer Ghimirey
 
Becoming Linux Expert Series-Install Linux Operating System
Becoming Linux Expert Series-Install Linux Operating SystemBecoming Linux Expert Series-Install Linux Operating System
Becoming Linux Expert Series-Install Linux Operating Systemskbansal222
 
Installation of DSpace, Koha and other software using Liblivecd
Installation of DSpace, Koha and other software using LiblivecdInstallation of DSpace, Koha and other software using Liblivecd
Installation of DSpace, Koha and other software using LiblivecdRupesh Kumar
 
Guide to dual booting
Guide to dual bootingGuide to dual booting
Guide to dual bootingMahfud Saja
 
Kali Linux Installation process in VMware Step-By-Step
Kali Linux Installation process in VMware Step-By-StepKali Linux Installation process in VMware Step-By-Step
Kali Linux Installation process in VMware Step-By-StepSupriya G
 
Pic Frame
Pic FramePic Frame
Pic Framegenti74
 
Prepare Installer Week 1.pdf
Prepare Installer Week 1.pdfPrepare Installer Week 1.pdf
Prepare Installer Week 1.pdfemersonrebibis1
 
CSS 4th Quarter Lessons.pptx
CSS 4th Quarter Lessons.pptxCSS 4th Quarter Lessons.pptx
CSS 4th Quarter Lessons.pptxRGSMags
 
Redhat OS installation
Redhat OS installationRedhat OS installation
Redhat OS installationPontika Gupta
 
Installation guide for Red Hat Enterprise Linux 6
Installation guide for Red Hat Enterprise Linux 6Installation guide for Red Hat Enterprise Linux 6
Installation guide for Red Hat Enterprise Linux 6Varnnit Jain
 
WINDOW 7 INSTALL PROCESS
WINDOW 7 INSTALL PROCESSWINDOW 7 INSTALL PROCESS
WINDOW 7 INSTALL PROCESSNagesh Babu
 

Similar to Srgoc linux (20)

Dspace Installation Manual in Ubuntu 14.04 Alongwith Windows
Dspace Installation Manual in Ubuntu 14.04 Alongwith WindowsDspace Installation Manual in Ubuntu 14.04 Alongwith Windows
Dspace Installation Manual in Ubuntu 14.04 Alongwith Windows
 
How to install windows xp
How to install windows xpHow to install windows xp
How to install windows xp
 
The installing of widows 7
The installing of widows 7The installing of widows 7
The installing of widows 7
 
Install Linux OS in Virtual Box.pptx
Install Linux OS in Virtual Box.pptxInstall Linux OS in Virtual Box.pptx
Install Linux OS in Virtual Box.pptx
 
Becoming Linux Expert Series-Install Linux Operating System
Becoming Linux Expert Series-Install Linux Operating SystemBecoming Linux Expert Series-Install Linux Operating System
Becoming Linux Expert Series-Install Linux Operating System
 
Open_suse
Open_suseOpen_suse
Open_suse
 
Installation of DSpace, Koha and other software using Liblivecd
Installation of DSpace, Koha and other software using LiblivecdInstallation of DSpace, Koha and other software using Liblivecd
Installation of DSpace, Koha and other software using Liblivecd
 
Windows 7
Windows 7Windows 7
Windows 7
 
Guide to dual booting
Guide to dual bootingGuide to dual booting
Guide to dual booting
 
Kali Linux Installation process in VMware Step-By-Step
Kali Linux Installation process in VMware Step-By-StepKali Linux Installation process in VMware Step-By-Step
Kali Linux Installation process in VMware Step-By-Step
 
Pic Frame
Pic FramePic Frame
Pic Frame
 
Guide koha
Guide kohaGuide koha
Guide koha
 
Prepare Installer Week 1.pdf
Prepare Installer Week 1.pdfPrepare Installer Week 1.pdf
Prepare Installer Week 1.pdf
 
linux
linuxlinux
linux
 
CSS 4th Quarter Lessons.pptx
CSS 4th Quarter Lessons.pptxCSS 4th Quarter Lessons.pptx
CSS 4th Quarter Lessons.pptx
 
Ubuntu server guide
Ubuntu server guideUbuntu server guide
Ubuntu server guide
 
Redhat OS installation
Redhat OS installationRedhat OS installation
Redhat OS installation
 
Koha Installation Manual in Ubuntu 14.04 Alongwith Windows
Koha Installation Manual in Ubuntu 14.04 Alongwith WindowsKoha Installation Manual in Ubuntu 14.04 Alongwith Windows
Koha Installation Manual in Ubuntu 14.04 Alongwith Windows
 
Installation guide for Red Hat Enterprise Linux 6
Installation guide for Red Hat Enterprise Linux 6Installation guide for Red Hat Enterprise Linux 6
Installation guide for Red Hat Enterprise Linux 6
 
WINDOW 7 INSTALL PROCESS
WINDOW 7 INSTALL PROCESSWINDOW 7 INSTALL PROCESS
WINDOW 7 INSTALL PROCESS
 

More from Gaurav Singh

More from Gaurav Singh (8)

Oral presentation
Oral presentationOral presentation
Oral presentation
 
srgoc dotnet_ppt
srgoc dotnet_pptsrgoc dotnet_ppt
srgoc dotnet_ppt
 
Srgoc dotnet_new
Srgoc dotnet_newSrgoc dotnet_new
Srgoc dotnet_new
 
Srgoc dotnet
Srgoc dotnetSrgoc dotnet
Srgoc dotnet
 
ADA FILE
ADA FILEADA FILE
ADA FILE
 
srgoc
srgocsrgoc
srgoc
 
Srgoc java
Srgoc javaSrgoc java
Srgoc java
 
cs506_linux
cs506_linuxcs506_linux
cs506_linux
 

Recently uploaded

(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...ranjana rawat
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 

Recently uploaded (20)

(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
(TARA) Talegaon Dabhade Call Girls Just Call 7001035870 [ Cash on Delivery ] ...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 

Srgoc linux

  • 1. 1 INDEX S.No Date Topic Sign Remarks 1. Installation, Configuration and Customizations of UNIX/LINUX. 2. To study UNIX operating system and explain its function. 3. To study architecture of LINUX. 4. To study basic & user status UNIX/LINUX commands. 5. To study basic & user status UNIX/LINUX directory commands. 6. Study and use of commands for performing arithmetic operation with LINUX. 7. Study and use of commands for changing file permissions. 8. What is shell programming and shell script? Explain the types of shell. 9. Write a shell script and put your comments in your script and make it executable. 10. Write a shell script that stores any value you want in a variable and access the variable using commands. 11. Write a program in LINUX which uses all the arithmetic operators. 12. Write a program in LINUX which uses all the relational operators. 13. Write a program in LINUX to find out whether the number is greater or lesser. 14. What is VI editor? Execute shell commands using VI editor. 15. What is LINUX file system?
  • 2. 2 Experiment No. 1 Installation, Configuration and Customizations of UNIX/LINUX. Step 1: The first thing you should do is head to http://www.ubuntu.com/download/ubuntu/download and download Ubuntu 11.10 LiveCD. Just click the big orange Start download box. Step 2: Using your disc burning software, burn the .iso you downloaded to a CD. Step 3: Before you go any further, ensure all important data is backed up in case of data loss on your drives. This guide assumes you have media backups of your Windows partitioned hard drive and you are safe to proceed. ***Warning: Installing another operating system without first ensuring you have backups of your current files and operating system is a big risk. If you have no data to lose or you’ve backed up important data, you’re ready to proceed. YOU are responsible if you lose data. For those of you using Windows, and installing Linux for the first time I recommend you either use a separate hard disk that does not contain the Windows OS, or create a partition big enough for Linux within Windows using Disk Management in the Administrative Tools menu of the control panel. 30GB of hard disk space is absolutely plenty of space for you to begin exploring Ubuntu whilst at the same time having room to grow. Step 4: Ensure you have a network cable connected, restart your computer, and boot from the CD drive.
  • 3. 3 Step 5: The LiveCD will load up, and you'll be presented by the following box. For the purposes of this guide, we will assume you've already tried Ubuntu and want to proceed with an installation, so click "Install Ubuntu." Step 6: You'll be greeted by the "Preparing to install Ubuntu" screen, exactly as below.
  • 4. 4 I recommend you select "Install third-party software" as I have done in the screenshot above. I prefer to do system updates once up and running, but if you have the extra time you can also select "download updates while installing" as well. Then click continue. Step 7: The next screen you will see is "installation type," what you see will be dependent on whether you have an existing Windows installation or not. I'm going to split this into three different sub-steps, to make it as simple as possible. Step 7-A: For those installing in a virtual machine or to hard disks without an OS you will see the following screen:
  • 5. 5 You have two choices: 1. Erase the entire disk and use all of it for installation -- Ubuntu will automatically partition your disk and proceed with installation. 2. Select "something else" and manually create your partitions (which is covered in detail in step 7-C). If you are choosing the first option, select the radio button and then click continue, proceeding to step 8. Step 7-B: Those of you that have current Windows installations or are going to dual-boot with another existing OS will be presented with a screen similar to below.
  • 6. 6 You have three options available: 1. You can choose the first option and install Ubuntu alongside your existing OS. 2. You can opt to replace your Windows installation with Ubuntu, allowing the installer to format your current partitions and automatically create new ones for Linux. 3. You can choose "something else" and create your own partition scheme and sizing (covered in detail in step 7-C). Once you have selected which route you wish to proceed with click continue and proceed to step 8. Step 7-C: Having selected the "something else" option you will be presented with the following window, Linux recognizes and assigns IDs to drive in a different manner to Windows. In the above image, you can clearly see my hard disk in the list. It is identified by "/dev/sda." Linux recognizes drives in the following way: • Sda = 1st drive
  • 7. 7 • Sdb = 2nd drive • Sdc = 3rd drive and so on Partitions are also shown after the drive letters. So if I had 2 partitions on my first disk, they would be identified as: • Sda1 – 1st drive, 1st partition • Sda2 – 1st drive, 2nd partition You will not see the common Windows C: label in the disk menu in the above list. You do, however, have key things to help you recognize your Windows C: drive. Both of these can be used to identify which is your Windows disk. • The size of the disk is shown • The name of the drive is shown This is your current partition layout for your hard disks. If you have more than one disk, they will show up as /dev/sda, /dev/sdb etc. Firstly, identify your Windows installation. In my case, it's sda1 (which is my first hard disk, first partition). What you see depends on how you created the extra space. I just resized the Windows partition from within Windows, and left the free space ready to install Linux. I recommend using Windows or a free utility from within Windows to resize your partition as most beginners will understand it more. Therefore, we now need create a minimum of two partitions: Click "Add" and the following box will appear: You will notice I have already filled out the example above to create a 10GB root partition. You can have a maximum of 4 primary partitions, or 3 primary partitions and 1 logical (which allows
  • 8. 8 for another 64 partitions). The size above is 10.00GB. e.g. 1,000 = 1GB 10,000 = 10GB (Remember to leave enough free remaining space to create your SWAP partition!) Location for new partition: e.g. do you want it at the start or end of the free space. Select beginning. Use as: Ext4 is the recommended file system for Ubuntu, much the same as NTFS is Windows. SWAP is for SWAP space. Mount point: This is where you want the partition to mount. E.g. we need a root partition, which in Linux is denoted by a "/". Click OK once you have finished setting the partition information and you will return to your partition screen, now showing the root partition you just created. Using the same methods as before, create a SWAP partition. I recommend you set the size of your SWAP partition to at least the size of your available RAM. If you have plenty of hard disk capacity I would suggest you use double the size. So if you have 2GB of RAM, set it to either 2GB or 4GB. For best performance it is recommended you have your SWAP partition at the beginning or end of your drive. Once you have done that, you should be looking at something like below. So to re-cap the above, (in my example) we have the following: • /dev/sda1 is your Windows partition. • /dev/sda2 is your new root partition (Windows equiv. of C. • /dev/sda3 is your SWAP space. Once you are happy with the changes you have made, click install now and proceed to the next step.
  • 9. 9 Step 8: As the installation starts to copy the required files to the hard disk, you will be presented with a screen to select your locale. It should automatically find where you are, as it has for me already. Just double check it is correct, and then select continue. Step 9: The next screen to appear will be keyboard layout. Ensure the correct option is selected, above you will see the correct (and default UK) selection has been automatically made for me.
  • 10. 10 Step 10: You will now be greeted by the "who are you" screen, ready for you to fill out with your user details. The computers name and username will automatically populate when you type your full name. You can however edit them as you please. Fill in the details and then click continue. You can opt to have Ubuntu automatically log in for you -- even with a password set -- or you can choose the traditional option requiring a password to log in. You really don't need to choose the encrypt option unless you're installing on a laptop and are dealing with highly secure information. Step 11: The installation information screens will now appear as Ubuntu continues the installation:
  • 11. 11 Step 12: Once installation has finished, you will be presented with the following box Select "restart now" and when requested, remove your installation CD, then press enter to reboot. Step 13: For those of you that have Ubuntu as the only OS the computer will boot directly into Linux. If you're dual-booting, you will see the GRUB menu appear similar to below.
  • 12. 12 Hit enter, to select the first option and load your newly installed Ubuntu OS. Step 14: For those that elected to automatically log into Ubuntu, you will go straight to the desktop in Step 15. For everyone else, you will be greeted with the new login manager for Ubuntu. Enter your password, and hit enter to login to your desktop. Step 15: Your desktop should look like this.
  • 13. 13 Step 16: Before we proceed further, let's check for updates. Click on the power button on the top right corner of the screen and select "check for updates," or words to that effect. I'd already run updates on this install so the example above is displaying "software up to date," but the picture highlights where you need to select anyway. Upon selecting the update option, the update manager will appear, as below.
  • 14. 14 If it comes up with no available updates, just select "check" again to verify that it is correct. Having done the same thing myself, I was presented with the updates you see above. For those that opted to install updates during installation it is unlikely there will be further updates required. You might be asked to enter your password to confirm changes. If prompted, enter your password and click OK. The same is true of any notifications that may appear during updating the OS. Once complete select close, and restart Ubuntu. The power button is located on the top right corner of the screen. Click this and select shutdown Step 17: No install is complete without full support for mp3s, core MS fonts, DVD playback codecs, Flash and Java, so let’s go ahead and sort this now. Click the black Ubuntu menu button at the top left corner of the screen and in the menu that appears, type "software center" and select the Ubuntu Software Centre. Once open, click the search bar, type "restricted" and the following should appear:
  • 15. 15 Select Ubuntu restricted extras, and then click on the install button. Authentication is much like UAC (user access control) in windows Vista and 7. It is required to elevate your user privileges to that of root (Linux administrator). Ubuntu restricted extras will now download, sort any dependencies and install. You can check its progress by viewing the progress bar above the install button. Once finished the In Progress tab will disappear -- restart Linux. It’s not strictly necessary, but I always do it after installing this package so everything can start up properly. Now you can enjoy your new OS and begin exploring its features.
  • 16. 16 Experiment No. 2 To study UNIX operating system and explain its function. OPERATING SYSTEM:An Operating System is a set of programs that Functions as an virtual machine by presenting an interface that is easier to program than the underlying hardware acts as resource management through orderly and controlled allocation of the processors, memories, and I/O devices among the programs competing for it. Types of Operating System: 1. Single User: The system will have its own hard disk, memory, CPU and other resources all dedicated to a single user. Example: MS-DOS. 2. Multi User: The users having access to a multi-user system will have just a terminal and a keyboard. The other resources such as hard disk, printers are centrally located. The user is expected to simply hook onto his account, perform the work, disconnect and leave quietly. Example: UNIX. UNIX History: The spade work for UNIX began at AT&T Bell Laboratories in 1969 by Ken Thompson and Dennis Ritchie. The OS was initially known as UNICS (jokingly UNiplexed Information and Computing System). In 1970 UNICS finally became UNIX. In 1973, UNIX was rewritten in 1973 in C principally authored by Ritchie. UNIX Function: 1. Multi-user system: Multi-user capability of UNIX allows several users to use the same computer to perform their tasks. Several terminals [Keyboards and Monitors] are connected to a single powerful computer [UNIX server] and each user can work with their terminals. 2. Multi-tasking system: Multitasking is the capability of the operating system to perform various task simultaneously, i.e. a user can run multiple tasks concurrently. 3. Programming Facility: UNIX is highly programmable, the UNIX shell has all the necessary ingredients like conditional and control structures, etc. 4. Security: UNIX allows sharing of data; every user must have a single login name and password. So, accessing another user’s data is impossible without his permission. 5. Portability: UNIX is portable because it is written in a high level language. So, UNIX can be run on different computers. 6. Communication: UNIX supports communication between different terminals of the same server as well as between terminals on different servers. Apart from these features, UNIX has an
  • 17. 17 extensive Tool kit, exhaustive system calls and Libraries and enhanced GUI (X Window). Experiment No. 3 To study architecture of LINUX. Linux System Architecture is consists of following layers: ORGANIZATION OF UNIX Hardware layer: Hardware consists of all peripheral devices (RAM/ HDD/ CPU etc). Kernel:Core component of Operating System, interacts directly with hardware, and provides low level services to upper layer components. The kernel is the heart of the system, a collection of programs written in C that directly communicate with the hardware. There is only one kernel for any system. It's that part of UNIX system that is loaded into memory when the system is booted. It manages the system resources, allocates time between users and processes, decides process priorities, and performs all other tasks. The kernel, in traditional parlance, is often called the Operating system. Shell: An interface to kernel, hiding complexity of kernel's functions from users. Takes commands from user and executes kernel's functions. The shell, on the other hand, is the "sleeping beauty" of UNIX. It is actually the interface between the user and the kernel. The shell is the agency which takes
  • 18. 18 care of the features of redirection and has a programming capability of its own. Utilities: The Tools and Applications consist of Application Software, Compilers, Database Package, Internet tools, UNIX commands, etc. Experiment No. 4 To study basic & user status UNIX/LINUXcommands. 1. “touch” command: Create an empty file with 0 byte. It is also used to change the access and modified time of currently exiting file. Syntax: $touch [option] [filename] option: “-a”: update the access time of a file. “-m”: update the modification time of a file. 2. “chomd” command(Change Mode): Changes the file mode. The command is used to change the permission of an ordinary file or directory. Syntax: $chmod <nnn> filename Number Binary Text <nnn> Octal Permission Representation 0 000 --- No permission (All types of access are denied 1 001 --x Execute permission (Execute access is allowed only) 2 010 -w- Write permission (Write access is allowed only) 3 011 -wx Execute and write permission: 1 (execute) + 2 (write) = 3 (Write and Execute are allowed) 4 100 r-- Read permission (Read access is allowed only) 5 101 r-x Read and execute permission: 4 (read) +1 (execute) = 5 (Read and Execute access are allowed) 6 110 rw- Read and write permission: 4 (read) + 2 (write) = 6 (Read and Write access are allowed) 7 111 rwx All permissions: 4 (read) + 2 (write) + 1 (execute) = 7 (Read, Write and Execute are allowed) 3. “rm” command(Remove File): The command is used to remove file from the system.
  • 19. 19 Syntax: $rm (f) filename f: remove all the files regardless of their permission. 4. “mv” command(Move File): The command is used to move file from source to destination. Syntax: $mv (F) <source> <destination> F: Do not ask whole approval or confirmation. 5. “cp” command(Copy File): The command copy the file from source to destination. Syntax: $cp <source> <destination> 6. “wc” command(WordCount): Counting the number of characters, words and lines. Syntax: $wc [option] [file] option: “-w”:words “-l”:lines “-c”:characters 7. “cat” command(Display File): This command is used to display file. Syntax: $cat <filename>
  • 20. 20 Experiment No. 5 To study basic & user status UNIX/LINUXdirectory commands. 1. “ls” command: The “ls” command lists all files in the directory. Syntax: $ls [option] [filename] option: “-a”: list all the hidden files. “-t”: list of the file name sorted by create time. “-l”: long list of the directory purpose show the owner, group, permission and file size. 2. “pwd” command(Print Working Directory): It display the current path, pathname, enables you to work out where you are in relation to all file system. Syntax: $pwd 3. “cd” command(Change Directory): The command cd directory means change the working to directory. Syntax: $cd 4. “mkdir” command(Make Directory): This command is used to create a directory. Syntax: $mkdir <directoryname> 5. “rmdir” command(Remove Directory): This command is used to remove directory. Syntax: $rmdir <directory name>
  • 21. 21 Experiment No.6 Study and use of commands for performing arithmetic operation with LINUX. “bc” is an arbitrary precision calculator language. A standard math library is available by command line option. If requested, the math library is defined before processing any files.bc starts by processing code from all the files listed on the command line in the order listed. After all files have been processed, bc reads from the standard input. All code is executed as it is read. (If a file contains a command to halt the processor, bc will never read from the standard input.)
  • 22. 22 Experiment No. 7 Study and use of commands for changing file permissions. File ownership is an important component of UNIX that provides a secure method for storing files. Every file in UNIX has the following attributes: 1. Owner permissions: The owner's permissions determine what actions the owner of the file can perform on the file. 2. Group permissions: The group's permissions determine what actions a user, who is a member of the group that a file belongs to, can perform on the file. 3. Other (world) permissions: The permissions for others indicate what action all other users can perform on the file. The Permission Indicators: While using ls -l command it displays various information related to file permission as follows: $ls -l /home/tarun -rwxr-xr-- 1 tarun users 1024 Nov 2 00:10 myfile drwxr-xr--- 1 tarun users 1024 Nov 2 00:10 mydir Here first column represents different access mode i.e. Permission associated with a file or directory. The permissions are broken into groups of threes, and each position in the group denotes a specific permission, in this order: read (r), write (w), execute (x):  The first three characters (2-4) represent the permissions for the file's owner. For example - rwxr-xr-- represents that owner has read (r), write (w) and execute (x) permission.  The second group of three characters (5-7) consists of the permissions for the group to which the file belongs. For example -rwxr-xr-- represents that group has read (r) and execute (x) permission but no write permission.
  • 23. 23  The last group of three characters (8-10) represents the permissions for everyone else. For example -rwxr-xr-- represents that other world has read (r) only permission. File Access Modes: The permissions of a file are the first line of defense in the security of a UNIX system. The basic building blocks of UNIX permissions are the read, write, and execute permissions, which are described below: 1. Read: Grants the capability to read i.e. view the contents of the file. 2. Write: Grants the capability to modify, or remove the content of the file. 3. Execute: User with execute permissions can run a file as a program. To change file or directory permissions, you use the chmod (change mode) command. There are two ways to use chmod: symbolic mode and absolute mode. Using chmod in Symbolic Mode: The easiest way for a beginner to modify file or directory permissions is to use the symbolic mode. With symbolic permissions you can add, delete, or specify the permission set you want by using the operators in the following table. Chmod operator Description + Adds the designated permission(s) to a file or directory. - Removes the designated permission(s) from a file or directory. = Sets the designated permission(s). Here's an example using testfile. Running ls -1 on testfile shows that the file's permissions are as follows: $ls -l abc -rwxrwxr-- 1 tarun users 1024 Nov 2 00:10 abc Then each example chmod command from the preceding table is run on testfile, followed by ls -l so you can see the permission changes: $chmod o+wx abc $ls -l abc -rwxrwxrwx 1 tarun users 1024 Nov 2 00:10 abc $chmod u-x abc $ls -l abc -rw-rwxrwx 1 tarun users 1024 Nov 2 00:10 abc $chmod g=r-x abc $ls -l testfile -rw-r-xrwx 1 tarun users 1024 Nov 2 00:10 abc
  • 24. 24 Here's how you could combine these commands on a single line: $chmod o+wx,u-x,g=r-x abc $ls -l abc -rw-r-xrwx 1 tarun users 1024 Nov 2 00:10 abc Using chmod with Absolute Permissions: The second way to modify permissions with the chmod command is to use a number to specify each set of permissions for the file. Each permission is assigned a value, as the following table shows, and the total of each set of permissions provides a number for that set. Number Binary Text Octal Permission Representation 0 000 --- No permission (All types of access are denied 1 001 --x Execute permission (Execute access is allowed only) 2 010 -w- Write permission (Write access is allowed only) 3 011 -wx Execute and write permission: 1 (execute) + 2 (write) = 3 (Write and Execute are allowed) 4 100 r-- Read permission (Read access is allowed only) 5 101 r-x Read and execute permission: 4 (read) +1 (execute) = 5 (Read and Execute access are allowed) 6 110 rw- Read and write permission: 4 (read) + 2 (write) = 6 (Read and Write access are allowed) 7 111 rwx All permissions: 4 (read) + 2 (write) + 1 (execute) = 7 (Read, Write and Execute are allowed)
  • 25. 25 Experiment No. 8 What is shell programming and shell script? Explain the types of shell. Shell:The shell or the command interpreter is the mediator which interprets the command that we give and then convey them to the kernel which ultimately executes them. Syntax: $echo $SHELL Types of shell: 1. Bourne shell (sh): originally UNIX shell written by Steve Bourne of Bell Labs, which is available on all UNIX system. It is bundled with every UNIX system. 2. C shell (csh): it was created by Bill Joy. It has advantage over the Bourne shell. Provides the c like languages with which to write shell script. C shell has 1 command history feature; this is the second benefit of that comes with C shell. 3. Korn shell (ksh): shell written by David Korn of Bell Labs, which is now provided as the Standard Shell in UNIX system. It provides all the features of the C together with a shell programming language similar to that of the original Bourne Shell. It is the most efficient shell. 4. Bourne Again Shell (Bash): this is the public domain shell written by the free software
  • 26. 26 foundation widely used within the academic community. Provides all the interactive features of the C shell and the Korn Shell (ksh). If Bourne Shell (sh) is used for shell programming, bash is recommended as a complete shell environment. Experiment No. 9 Write a shell script and put your comments in your script and make it executable. To write shell script and make it executable, the following procedure should be followed: 1. Firstly we have to enter in editor, .i.e., VI Editor using command “vi”. Syntax to enter in VI Editor: $vi filename 2. To executable we have to change the permission of file by using following syntax: $chmod +x filename 3. To run the executable script we have to use the following syntax: $./filename
  • 27. 27 Experiment No. 10 Write a shell script that stores any value you want in a variable and access the variable using commands. For writing a shell script in Linux command is used named as “script”. $script A variable assignment is of form variable=value (no spaces around ‘=’), but its evaluation requires the $ as prefix to the variable name. $a=50 // Here 50 is assigned to variable a $echo $a // By using command echo the value of a will show on display 50
  • 28. 28 $total=$a $echo $total 50 Output: Experiment No. 11 Write a program in LINUXwhich uses all the arithmetic operators. #include<stdio.h> int main() { int a,b,c=0,op=0; printf("nEnter the value of first number:"); scanf("%d",&a); printf("nEnter the value of second number:");
  • 29. 29 scanf("%d",&b); printf("nSelect the following to perform operationn"); printf("1. ADDITIONn"); printf("2. SUBTRACTIONn"); printf("3. MULTIPLICATIONn"); printf("4. DIVISIONn"); printf("5. EXITn"); printf("nnSelect option from the above:"); scanf("%d",&op); switch(op) { case 1: c=a+b; printf("Sum:%dnn",c); break; case 2: if(a>b) { c=a-b; printf("Subtraction:%dnn",c); } else { c=b-a; printf("Subtraction:%dnn",c); } break; case 3: c=a*b; printf("Multiplication:%dnn",c); break; case 4: if(a>=b) { c=a/b; printf("Division:%dnn",c); } else { printf("Division is in decimal valuenn"); } break;
  • 30. 30 case 5: printf("nnttTHANK YOUnn"); break; default: printf("Invalid optionnn"); break; } return 0; } Output for Addition: Output for Subtraction:
  • 32. 32 Output of Modulo Division:
  • 33. 33 Experiment No. 12 Write a program in LINUXwhich uses all the relational operators. #include<stdio.h> int main() { int a,b; printf("nEnter the fisrt number:"); scanf("%d",&a); printf("nEnter the Second number:"); scanf("%d",&b); if(a==b) { printf("nn%d is equal to %dn",a,b); } if(a!=b) { printf("nn%d is not equal to %dn",a,b); } if(a<b) { printf("nn%d is less than %dn",a,b); } if(a>b) { printf("nn%d is greater than %dn",a,b); } /* Lets change the values of numbers */ printf("nEnter the fisrt number:"); scanf("%d",&a); printf("nEnter the Second number:"); scanf("%d",&b); if(a<=b) { printf("nn%d is either less than or equal to %dnn",a,b); } else { printf("nn%d is either greater than or equal to %dnn",a,b);
  • 35. 35 Experiment No. 13 Write a program in LINUXto find out whether the numberis greater or lesser. #include<stdio.h> int main() { int a,b,c; printf("nEnter the first number:"); scanf("%d",&a); printf("nEnter the second number:"); scanf("%d",&b); printf("nEnter the third number:"); scanf("%d",&c); /* To find largest number */ if( a>b && a>c ) { printf("nn%d is the largest numbernn",a); } else if( b>c && b>a ) { printf("nn%d is the largest numbernn",b); } else { printf("nn%d is the largest numbernn",c); } /* To find smallest number */ if( a<b && a<c ) { printf("nn%d is the smallest numbernn",a); } else if( b<c && b<a ) {
  • 36. 36 printf("nn%d is the smallest numbernn",b); } else { printf("nn%d is the smallest numbernn",c); } return 0; } Output:
  • 37. 37 Experiment No. 14 What is VI editor? Execute shell commands using VI editor. There are many ways to edit files in UNIX and for me one of the best ways is using screen-oriented text editor vi. This editor enables you to edit lines in context with other lines in the file. Now days you would find an improved version of vi editor which is called VIM. Here VIM stands for ViIMproved. The VI is generally considered the de facto standard in UNIX editors because: 1. It's usually available on all the flavors of UNIX system. 2. Its implementations are very similar across the board. 3. It requires very few resources. 4. It is more user friendly than any other editors like ed or ex. You can use vi editor to edit an existing file or to create a new file from scratch. You can also use this editor to just read a text file. Starting the VI Editor: There are following way you can start using VI editor: Command Description vi filename Creates a new file if it already does not exist, otherwise opens existing file. vi -R filename Opens an existing file in read only mode. view filename Opens an existing file in read only mode. Following is the example to create a new file testfile if it already does not exist in the current working directory: $vi abc As a result you would see a screen something like as follows:
  • 38. 38 | ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ "abc" [New File] You will notice a tilde (~) on each line following the cursor. A tilde represents an unused line. If a line does not begin with a tilde and appears to be blank, there is a space, tab, newline, or some other non- viewable character present. So now you have opened one file to start with. Before proceeding further let us understanding few minor but important concepts explained below. OperationModes: While working with VI editor you would come across following two modes: 1. Command mode: This mode enables you to perform administrative tasks such as saving files, executing commands, moving the cursor, cutting (yanking) and pasting lines or words, and finding and replacing. In this mode, whatever you type is interpreted as a command. 2. Insert mode: This mode enables you to insert text into the file. Everything that's typed in this mode is interpreted as input and finally it is put in the file. The vi always starts in command mode. To enter text, you must be in insert mode. To come in insert mode you simply type i. To get out of insert mode, press the Esc key, which will put you back into command mode. Hint: If you are not sure which mode you are in, press the Esc key twice, and then you'll be in command mode. You open a file using VI editor and start type some characters and then come in command mode to understand the difference. Getting Out of VI: The command to quit out of vi is: q. Once in command mode, type colon, and 'q', followed by return. If your file has been modified in any way, the editor will warn you of this, and not let you quit. To ignore this message, the command to quit out of vi without saving is: q! This lets you exit vi without saving any of the changes.
  • 39. 39 The command to save the contents of the editor is: w. you can combine the above command with the quit command, or: wq and return. The easiest way to save your changes and exit out of vi is the ZZ command. When you are in command mode, type ZZ and it will do the equivalent of: wq. Experiment No. 15 What is LINUX file system? A file in UNIX is nothing but a storehouse of information and everything is treated as a file by UNIX. The files can be broadly classified as follows: 1. Ordinary files: Contains stream of data. All data, text, source programs, object and executable code, commands fall into this category. 2. Directory files: Contains no external data. It contains an entry, name of the file and its inode (identification number) for each file and subdirectory under that directory. Directory files are not created by the user but by the UNIX system itself. 3. Device files: Even physical devices are treated as files. These are special in the sense that any output directed to it will be reflected onto the respective device.
  • 40. 40 UNIX File System All files in UNIX are related to one another. The file system of UNIX resembles a tree that grows from top to bottom as shown in the figure. The file system begins with a directory called root (at the top). The root directory is denoted by a slash (). Branching from root there are several directories such as bin, lib, etc, tmp, dev. Each of these directories contains several sub-directories and files.