Answers of Open Source Operating system
Login as Guest
1. useradd guest
2. passwd guest
3. Ctrl + alt + f2
4. login as guest
Find The Present directory
1. pwd
Write the / directory structure
1. ls
Write a few commands available in /bin and /sbin directory
1. /bin (pwd ,cat ,echo )
2. /sbin (traceroute,netconfig,ifconfig)
Write the permissions of guest directory
1. ls –l /home
Your will find guest directory’s permission
Create a new Directory test in guest directory
1. mkdir /home/guest/test
Write the permissions of test directory
1. ls –l /home/guest
Your will find guest directory’s permission
Copy the file /etc/resolv.conf in test directory
1. cp /etc/resolv.conf /home/guest/test/
Rename the test directory to testing
1. mv /home/guest/test /home/guest/testing
Delete the testing directory
1. rm –r /home/guest/testing
Change the permissions of guest directory to 775
1. chmod 755 /home/guest
Change the permissions of /tmp directory to 700
1. chmode 700 /tmp
Login as root user
1. Ctrl + atl + F3
2. Login name = root
Change the permissions of guest directory to 700
1. chmod 700 /home/guest
The location of kernel files in Unix File System is /boot and by looking at the kernel file,
write the kernel version you are using in your system.
1. when you login in the linux you will find the kernel version on the top of the
screen.
Practical No. 2
Login as root
1. Login name = root
Open two Text Mode Virtual Consoles and login as guest and root. Switch between different
Text Mode Consoles and GUI Mode Consol.
1. for Consol 1 PressCtrl+Atl+F1
2. for Consol 2 PressCtrl+Atl+F2
3. for GUI Interface PressCtrl+Atl+F7
Create a folder of your name on the desktop
1. Right Click on desktop
2. Click on “New Folder” or “New Directory”
3. Type Your Name and press Enter
Use the Text Editor and write a few lines. Save the file on the Desktop
1. Right Click on desktop
2. Click on “New Terminal”
3. vi Yourfilename
4. type some lines
5. Press “Esc” then press “:wq” and Press Enter
Change the Desktop Background
1. click on Main Menu(in Linux Click on Hat)
2. click on “Preference” and go to “Background” Tab
Change the font
1. in “Preference” go to “Font”
Change the screen resolution to
1. type on terminal in GUI Mode
2. redhat-config-xfree86
Find out the current run-level and how many daemons are running
1. ps
2. who
Restart the service and install it again
1. service DaemonName restart
2. example: service network restart
3. To install service we need rpm
4. To install type = rpm -ivh rpm full name
Find out the current CPU and Memory Utilization
1. click on Main Menu(in Linux Click on Hat)
2. go to “System Tools” and then Click on “System Monitor”
3. free(command)
Take a screenshot of a terminal session and save it on your desktop
1. Press “PrtScrn” Key on keyboard and save it.
Practical No. 3
Delete this file and try to recover it later on
1. create the file named “temp.tmp”
2. right click on “temp.tmp”
3. click in “delete”
4. to recover go to “Trash” which is on the desktop
5. and recover the file “temp.tmp”
Remove the software package for Mozilla Firefox and try to access Internet. Reinstall it again and
try to access Internet
1. to remove the mozila
2. rpm –e rpm name
3. to install
4. rpm –ivh rpm name
Find out the current CPU and Memory Utilization
1. free
See the System Logs
1. click on Main Menu(in Linux Click on Hat)
2. click on “system tools” and go to “System Log” Tab
Login in KDE Desktop mode and see the difference between the GNOME and KDE Desktop
environments
Program No. 4
List the contents of /home directory
1. ls /home
Find the group to which guest belongs
1. vi /etc/group
2. find the name guest
3. or
4. cd /home/
5. ls -l
Create a file sidbi in the home area of guest
1. touch sidbi
Find the permissions of the file sidbi
1. ls –l sidbi
Find the inode number of file sidbi
1. ls –i sidbi
Copy the file sidbi to sidbi1
1. cp sidbi sidbi1
Find the inode number of file sidbi1
1. ls –i sidbi1
Move the file sidbi to sidbi2
1. mv sidbi sidbi2
Find the inode number of file sidbi2
Move sidbi2 to sidbi
Create a new user guest1 with same group as
1. useradd guest1
2. passwd guest1
Create a new user guest2 with a different group than the group of guest
1. useradd –g groupname guest2
2. or
3. useradd guest2
4. passwd guest2
5. Go to /etc/passwd and delete the 4th column of the guest2 user’s line and
write the guest1’s group ID(4th column)
6. save it
7. go to /etc/group
8. delete the line of guest2
9. add guest2 in guest1’s line seprated by comma “,”
10. save it
Find, what permissions should the file sidbi have, so that both guest1 and guest2 can write
into this file.
1. chmod 722 sidbi
Program -5
Open Terminal and find out the shell you are using.
1. echo $SHELL
Change your shell to sh
1. Type = sh
2. or
3. init 1(single user mode)
Write a shell script to add two numbers.
1. echo “Enter two number for addition
2. read one
3. read two
4. echo `expr $one +$ two` //( ` ` ) are backcoat
Move the contents of test directory in test1 directory
1. mkdir /home/guest/test1
2. mv /home/guest/test/*.* /home/guest/test1/
Copy the test1 directory in /tmp
1. cp /home/guest/test1 /tmp
Write, the date of Creation/Modification, ownership, group and permissions of test1 directory
1. ls –l /tmp/test1
Tar and gzip the contents of test1.
1. Tar –cvf test1.tar test1
2. gzip test1.tar
Move the test1.tgz into your area and Untar it
1. gunzip test1.tgz
2. tar –xvf test1.tar /home/guest1/
Delete the test1 directory
1. rm test1
Create a command to create new users
1. vi addnewuser
2. if $1
3. then
4. adduser $1
5. fi
6. save it and run
7. to run : sh adnewuser username
Give appropriate permission so that only guest user can run this command
1. chmod 744 adnewuser
Program -6
Find out the disk usage of /etc directory.
1. du /etc
Find the hostname and domain name of the system.
1. hostname
2. domainname
Find the CPU and Memory utilization of the system.
1.top
Find the PID of the Process which is consuming maximum CPU
1.top
2.you can see the maximum cpu consuming process
Shutdown the system using command.
1.init 0
Find out the disk usage of / directory
1. du /
Compare it with the usage of / partition
1.df /
Traceroute to www.google.com and try to find out how many routers are there between your
machine and google server
1. traceroute www.google.com
Write a shell script to find greater among two numbers
1. vi grt
2. echo “give to number”
3. read one
4. read two
5. if test one -gt two
6. then
7. echo “$one is greatest”
8. else
9. echo “$two is greatest”
10. fi
11. save the file and run it
12. sh grt
Program -7
Find out the disk usage of /etc directory
Find out the disk free space of / partition
Create two users guest1 and guest2. guest1 should have his home directory in /users/guest1
and guest2 should have home directory in /home/guest2.
1.useradd guest2
2.passwd guest2
3. Enter the Password
4.useradd guest1
5.passwd guest1
6.Enter the password
7. mkdir /users
8. mv /home/guest1 /users
9.vi /etc/passwd
10.change the home directory in guest1’s line
Replace /home/guest1 with /users/guest1
11.save and exit
Set their passwords to guest123.
1.Passwd guest1
Use ssh or telnet to access your friends machine using guest1 and guest2 accounts
.1.telnet ipaddress (address of friend machine)
Delete the users guest1 and guest2 and remove their home directories.
1.userdel -r guest1
2.userdel –r guest2
Find out the total CPU utilization and Memory Utilization
1.top
Or
2.free
Find out the PPID and PID of httpd process
1.top
Kill the httpd process
1.ps
2.kill PID of the httpd
Traceroute to www.google.com and find out the round trip time to reach google server.
Find out the Default Gateway of your machine
1.ifconfig
Find out the IP address
1.ifconfig
Find out the uptime of your system
Check if the server 172.31.1.1 is reachable on the network.
1.ping 172.31.1.1
Program -8
Find out the current network settings.
1.ifconfig
Or
2.netstat
Use the GUI to configure the IP address of your machine to 255.255.255.0, DNS to
172.28.250.250 and the gateway to 172.28.250.254
1.net
Use the Text Mode to restore the network configurations back to your original settings. Check
if your network is working by pinging to 172.31.1.1
Write a script to take the full backup of the home areas of all the users in /backup directory.
1.mkdir backup
2.vi backfile
3.cp /home /backup
4.save and exit
5, sh backfile
Connect using Telnet to another system.
1.telnet ipaddress
Program -9
Configure a DHCP Server
1.instal the rpms
2.cp /usr/share/doc/dhcp-3.0.1/dhcpd.conf.sample /etc/dhcpd.conf
3.make the changes as given below in the dhcpd.conf file
4.netconfig (give the below ipaddress and default gateway )
5.service network restart
6.service dhcpd restart
Subnet :172.28.0.0/255.255.0.0
IP range : 172.28.250.128 to 172.28.250.250
Gateway : 172.28.250.254
DNS : 172.28.250.1
DNS Domain : abc.com
Test the DHCP server by configuring neighboring machine as DHCP client
Program -10
Write a program and Algorithm to find greatest among three numbers using C.Execute the
same on Linux
1.vi greater.c
2. #include<stdio.h>
Main(){
Int fst,scd,thd;
Printf(“Enter any three numbers”);
Scanf(“%d %d %d”,&fst,&scd,&thd);
If(fst>scd && fst>thd){
Printf(“\n %d”,fst,”is greater’);
elseif(scd>fst && scd>thd){
printf(“\n%d”,scd,”is greater”);
}
Else{
Printf(“\n%d”,thd,”is greater”):
3.save and exit
4.gcc –o greater greater.c
5. ./greater
configure a Telnet Server
1.install rpms
2.rpm –ivh telnet-*
3.rpm -ivh telnet-server-*