You are on page 1of 26

EXPERIMENT NO: 1

Name of the Student :-______________________________________________

Roll No.____________ Subject:-_______________________

Date of Practical Performed :-________ Staff Signature with Date

& Marks

Aim:- To Installation of ubuntu operating system.

Step 1: Download the ISO file using the following links. Download ubuntu 15.04
(64-bit) Download ubuntu 15.04 (32bit). Once the iso file has been downloaded,
burn it into DVD or USB drive and make it bootable.
Step 2: Once you get the bootable USB working follow the screens below to install
USB: pick your language

Step: 3 Download Updates while Installing and Install This Third-Party Software.
Either way Ubuntu will download the bulk of the operating system from the
internet
Step 4: Select Installation Type

Confirm to write changes to disk


Step 5: Select your respective Time Zone

Step 6: Select your respective Keyboard Layout


Click on continue
Step 7: Set the hostname of your user system and User credentials that will be used
after installation.

Clock on Continue

Step 8: As shown below Installation completed.


Conclusion:

……………………………………………………………………………………….
……………………………………………………………………………………….
……………………………………………………………………………………….

Questions

1. How is Ubuntu not affected by viruses?


2. If Ubuntu is free, what’s in Ubuntu Advantage?
3. What’s the largest desktop migration to Ubuntu so far?
4. Why is Ubuntu the most popular operating system for cloud?
5. Can Ubuntu be integrated with Microsoft infrastructure?
EXPERIMENT NO 2

Name of the Student :- _____________________________________________

Roll No.____________ Subject:-_______________________

Date of Practical Performed :-_________Staff Signature with Date


& Marks

Aim:- To study of unix commands.

Command Example Description

1. ls ls Lists files in current directory


ls -alF List in long format

2. cd cd tempdir Change directory to tempdir


cd .. Move back one directory
cd ~dhyatt/web-docs Move into dhyatt's web-docs
directory

3. mkdir mkdir graphics Make a directory called graphics

4. rmdir rmdir emptydir Remove directory (must be empty)

5. cp cp file1 web-docs Copy file into directory


cp file1 file1.bak Make backup of file1

6. rm rm file1.bak Remove or delete file


rm *.tmp Remove all file

7. mv mv old.html Move or rename files


new.html

8. more more index.html Look at file, one page at a time

9. lpr lpr index.html Send file to printer


10. man man ls Online manual (help) about
command

11. chmod Chmod 777 cg2.cpp It changes file mode bits

12. ps ps It reports snapshot of current


process

13. clear clear Clear clears the screen

14. who who Who displays current user logged


in

15. echo Echo “hello” Used to print any string like printf
in c

Conclusion:

………………………………………………………………………………………
………………………………………………………………………………………
………………………………………………………………………………………

Questions
1. What is the description for Kernel?
2. What is a single user system?
3. What are the main features of UNIX?
4. Describe the term directory in UNIX?
5. Specify the difference between absolute path and related path?
6. Describe fork() system call?
7. What is mean by Super User?
EXPERIMENT NO: 3

Name of the Student :- _____________________________________________

Roll No.____________ Subject:-_______________________

Date of Practical Performed :-_________Staff Signature with Date


& Marks

Aim:- To study of Unix networking commands.

Theory

ifconfig

One of the most basic networking commands is ifconfig. It will tell you about your
network interfaces, the state that they're in, your assigned IP address(es), and even
provide some counts of packets that have crossed the interface since the system
was last booted. These days, you may see both ipv4 and ipv6 addresses.

bond0 Link encap:Ethernet HWaddr 78:2B:CB:44:BF:DA


inet addr:10.20.30.40 Bcast:10.20.30.255 Mask:255.255.254.0
inet6 addr: fe80::7a2c:deac:fe22:bbda/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500
Metric:1
RX packets:957499349 errors:0 dropped:17641 overruns:0 frame:0
TX packets:946779445 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:106377372276 (99.0 GiB) TX bytes:1399270021829 (1.2 TiB)

Notice the RX (receive) and TX (transmit) packets counts as well as the same basic
statistics shown in bytes. These numbers may seem huge but the system was being
running for roughly a year. The uptime command shows you this along with the
load averages that indicate how hard this system is working to keep up with the
load. In this case, the system isn't breaking a sweat. The 0.10 one-minute load
basically tells you that every 10th time the system checks, there is one process
having to wait for access to the CPU. The 0.01 fifteen minute numbers tell you
we're seeing something waiting only one time in a hundred.
$ uptime
09:56:19 up 325 days, 18:16, 1 user, load average: 0.10, 0.06, 0.01

ping

Ping is one of the most basic networking troubleshooting commands. It might tell
you that you can reach a remote system, but you can't assume a system is down if
you don't get a response -- especially if it belongs to some other company as the
ping command and, often, all members of ths icmp protocol family may be blocked
somewhere along the route. If you get a response, you know the system you're
pinging is up, but you also know that your network connection is good. I often ping
a system somewhere else in the US (one on which I had an account many years
ago) as a test of my network connection. If I can get a response from a system
several states up the coast, I must be doing OK. If I'm not OK, then it's time to do a
little troubleshooting.

The ping command generally behaves in one of two ways. It runs four times in
succession and then tells you how many of the requests got through or it runs until
you type ^c to stop it and then gives you the statistics. You can also provide the
command with a -c option to specify how many times you want to ask. If I'm trying
to verify that the systems that I'm expecting to find on a particular subnet are
indeed up, I generally don't want to send each more than one ping. It takes too
long. Sending one ping per system in a for sys in `cat syslist`; do ping -c 1 $sys;
done or, even better, maybe for sys in `cat syslist`; do echo -n "$sys: "; ping -c 1
$sys | grep loss; done.

traceroute

The traceroute command will attempt to provide a list of all the routers your
connections cross when reaching out to a remote system. The output also provides
some information on how long each segment of the path takes, thus giving you
some notion of the quality of a connection.

$ traceroute fermion
traceroute to fermion (10.10.10.10), 30 hops max, 40 byte packets
1 coresys (10.10.10.2) 0.965 ms 1.010 ms 1.006 ms
2 rtr2 (10.10.8.10) 0.613 ms 0.627 ms 0.642 ms
3 10.210.1.14 (10.20.1.11) 78.226 ms 77.779 ms 77.734 ms
4 fermion (10.1.2.3) 77.257 ms !X 81.914 ms !X 73.626 ms !X

netstat

The netstat command can tell you about ongoing connections on the local system
and ports (i.e., services) that are listening, indicating that services are waiting for
requests to come through. By itself, netstat gives you a *lot* information. With a -a
option, it gives you even more.

$ netstat -a | grep LISTEN | grep -v LISTENING


tcp 0 0 localhost.localdomain:32000 *:* LISTEN
tcp 0 0 localhost.locald:bootserver *:* LISTEN
tcp 0 0 *:cbt *:* LISTEN
tcp 0 0 *:38821 *:* LISTEN
tcp 0 0 *:8009 *:* LISTEN

nslookup

The nslookup command will do a DNS query for you. Assuming the system, you
are working on has a proper /etc/resolv.conf to let it know where to go to ask this
type of question, it can help you find the IP addresses for particular systems and,
often, the system names that go along with particular IP addresses. I've found that
companies are often lax in setting up the reverse lookup (PTR) records that tie IP
addresses back to hostnames, but they are wonderfully useful. By the time you are
watching over hundreds or even thousands of servers, you're going to occasionally
ask yourself something like "What system is 10.94.1.7?" and having an easy way
to get an answer can be very helpful.

whois

You can often find a lot more information about a domain using the whois
command, the output below is truncated. Here I'm picking on my local gas station.
Let's see what I can find out about Valero.

$ whois valero.com
whois valero.com
[Querying whois.verisign-grs.com]
[Redirected to whois.networksolutions.com]
[Querying whois.networksolutions.com]
[whois.networksolutions.com]

Domain Name: VALERO.COM


Registry Domain ID:
Registrar WHOIS Server: whois.networksolutions.com
Registrar URL: http://networksolutions.com
Updated Date: 2012-02-06T00:00:00Z
Creation Date: 1996-02-21T00:00:00Z
Registrar Registration Expiration Date: 2021-02-22T00:00:00Z
Registrar: NETWORK SOLUTIONS, LLC.
Registrar IANA ID: 2
Registrar Abuse Contact Email: abuse@web.com
Registrar Abuse Contact Phone: +1.8003337680
Reseller:
Domain Status: clientTransferProhibited
Registry Registrant ID:
Registrant Name: Valero Energy
Registrant Organization:
Registrant Street: One Valero Way
Registrant City: San Antonio
Registrant State/Province: TX
Registrant Postal Code: 78249-1616
...

hostname

Generally, you know the name of the system you're logged into. After all, you just
logged into it and, often, server names are set up as the system's command line
prompt. But you might be logged into several systems at once or you may want to
know just a bit more information. Here are some hostname command options that
you might not be using.

$ hostname
boson.particles.org
$ hostname -d
particles.org
$ hostname -i
10.20.30.40
The -i option provides and easy way to grab the system's IP address without having
to separate it from ifconfig output.

tcpdump

The tcpdump command can print out the headers of network packets as they reach
your server or can be used with various filters to select just the packets you want to
see. You can also save packets for later analysis.

Conclusion:

………………………………………………………………………………………
………………………………………………………………………………………
………………………………………………………………………………………

Questions:

Differentiate multiuser from multitask.

What is inode?

What is Bash Shell?

Enumerate some of the most commonly used network commands in UNIX

What is the use of -l when listing a directory?

Is it possible to see information about a process while it is being executed?


EXPERIMENT NO:4

Name of the Student :- _____________________________________________

Roll No.____________ Subject:-_______________________

Date of Practical Performed:-_________Staff Signature with Date


& Marks

Aim:- Write a shell script program to develop a scientific calculator.

Program:

echo -n "enter the first number :"


read num1
echo -n "enter the second number :"
read num2
sum=$((num1+num2))
sub=$((num1-num2))
mul=$((num1*num2))
div=$((num1/num2))
echo "sum of two values is $sum"
echo "sub of two values is $sub"
echo "mul of two values is $mul"
echo "div of two values is $div"

Conclusion:

………………………………………………………………………………………
………………………………………………………………………………………
………………………………………………………………………………………
EXPERIMENT NO: 5

Name of the Student :- _____________________________________________

Roll No.____________ Subject:-_______________________

Date of Practical Performed:-_________Staff Signature with Date


& Marks

Aim: Write a shell script program to display “HELLO WORLD”.


Write a shell Script program to check whether the given number is even or
odd.

Program 1:
echo "Hello World"

Program 2:

echo -n "enter number"


read n
rem=$(( $n % 2))
if [ $rem-eq 0]
then
echo "$n is even number"
else
echo "$n is odd number"
fi

Conclusion:

………………………………………………………………………………………
………………………………………………………………………………………
………………………………………………………………………………………
EXPERIMENT NO: 6

Name of the Student :- _____________________________________________

Roll No.____________ Subject:-_______________________

Date of Practical Performed :-_________Staff Signature with Date


& Marks

Aim:- Basic system administrative task.

Theory:

1. Process Management commands

top

The top command is the traditional way to view your system’s resource usage and
see the processes that are taking up the most system resources. Top displays a list
of processes, with the ones using the most CPU at the top.
ps

The ps command lists running processes. The following command lists all
processes running on your system:

ps -A

Kill

The kill command can kill a process, given its process ID. You can get this
information from the ps -A, top or pgrep commands.

kill PID
2. Memory management commands

free

The free command is the most simple and easy to use command to check memory
usage on Linux. Here is a quick example

$ free -m

total used free shared buffers cached

Mem: 7976 6459 1517 0 865 2248

-/+ buffers/cache: 3344 4631


Swap: 1951 0 1951

/proc/meminfo

The next way to check memory usage is to read the /proc/meminfo file. Know that
the /proc file system does not contain real files. They are rather virtual files that
contain dynamic information about the kernel and the system.
vmstat

The vmstat command with the s option, lays out the memory usage statistics much
like the proc command. Here is an example
3. File system management

fdisk

The "fdisk" file system management tool is a text-based interface that lets you
divide a hard disk into partitions, which are contiguous regions of disk space on
which you can make file systems. The process of dividing a hard disk space is
called disk partitioning.
To list out the current available hard disks and their layout, you can use "fdisk -l"
as shown below.

[root@RHEL01 ~]# fdisk -l

Disk /dev/sda: 17.1 GB, 17179869184 bytes


255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System


/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 1930 15398302+ 8e Linux LVM
/dev/sda3 1931 2088 1269135 82 Linux swap / Solaris

Mount

mount Used to mount a filesystem. Complement is umount

4. User management

To add a new User and to set password

To add a new user you can use any two of the following User management
commands.

Syntax
adduser <username> useradd <username>

Example
[root@linuxhelp ~]# useradd user1

To set the password for the newly created username


Syntax
passwd <username>

[root@linuxhelp ~]# passwd user1

Changing password for user user1.


New password:

Retype new password:

passwd: all authentication tokens updated successfully.

To change the password


To change the old password of the user that is already created use the following
User management command.
Syntax
passwd
The same in root will prompt you to change the root password. The other user's
password can also be changed from the root.

passwd <username>
It will change the specific user's password and it won’t ask the old password, since
it’s a root.

Example
[user1@linuxhelp ~]$ passwd

Changing password for user user1.

Changing password for user1.

(current) UNIX password:

New password:

Retype new password:

passwd: all authentication tokens updated successfully.


To delete a user account
To delete an user account, use the following User management command.

Syntax
userdel -r [username]

Example
[root@linuxhelp ~]# userdel -r user1

Conclusion:

………………………………………………………………………………………
………………………………………………………………………………………
………………………………………………………………………………………
EXPERIMENT NO:7

Name of the Student :- _____________________________________________

Roll No.____________ Subject:-_______________________

Date of Practical Performed :-_________Staff Signature with Date


& Marks

Aim: Write a grep/egrep script to find the number of words characters, words and
lines in a file.

Theory

The wc (word count) command in Unix/Linux operating systems is used to find out
number of newline count, word count, byte and characters count in a files specified
by the file arguments. The syntax of wc command as shown below.

# wc [options] filenames

The following are the options and usage provided by the command.

wc -l : Prints the number of lines in a file.

wc -w : prints the number of words in a file.

wc -c : Displays the count of bytes in a file.

wc -m : prints the count of characters from a file.

wc -L : prints only the length of the longest line in a file.

So, let’s see how we can use the ‘wc’ command with their few available

Program

Echo ”Number of words in f.txt is:”


Grep “” f.txt | wc –w
Echo ”Number of lines in f.txt is:”
Grep “” f.txt | wc –l
Echo ”Number of characters in f.txt is:”
Grep “” f.txt | wc –c
Conclusion:
………………………………………………………………………………………
………………………………………………………………………………………
………………………………………………………………………………………
EXPERIMENT NO: 8

Name of the Student :- _____________________________________________

Roll No.____________ Subject:-_______________________

Date of Practical Performed :-_________Staff Signature with Date


& Marks

Aim: Write awk script to develop a fibonacci series.

Program:

[root@TechTutorial ~]# awk ' BEGIN{

> for(i=0;i<=10;i++)

> {

> if (i <=1 )

> {

> x=0;

> y=1;

> print i;

> }

> else

> {

> z=x+y;

> print z;

> x=y;

> y=z;

> }
> }

> }'

Output:

13

21

34

55

Conclusion:

………………………………………………………………………………………
………………………………………………………………………………………
………………………………………………………………………………………

You might also like