Wednesday, September 01, 2010

O.S. First Assignment Answers.


Q.1 Login with your user name and password.
 Ans:
login as: mca09176
password:

Q.2 Display present working directory.
Ans:
[mca09176@ALS ~]$ pwd
/home/PARAM/mca09176

Q.3 List the content of your present working directory.
Ans:
[mca09176@ALS ~]$ mkdir dir1
[mca09176@ALS ~]$ ls
dir1

Q.4 Only create a file homeadd.txt, officeadd.txt, collegeadd.txt.
Ans:
[mca09176@ALS ~]$ touch homeadd.txt
[mca09176@ALS ~]$ touch office address.txt
[mca09176@ALS ~]$ touch officeadd.txt
[mca09176@ALS ~]$ touch collegeadd.txt
[mca09176@ALS ~]$ ls
dir1 collegeadd.txt homeadd.txt officeadd.txt

Q.5 Append your home address in homeadd.txt, office address in officeadd.txt and college address in collegeadd.txt.
Ans:
[mca09176@ALS ~]$ cat > homeadd.txt
[mca09176@ALS ~]$ cat > officeadd.txt
[mca09176@ALS ~]$ cat >collegeadd.txt

Q.6 Now change your password with new password.
Ans:
[mca09176@ALS ~]$ pwd
/home/PARAM/mca09176
[mca09176@ALS ~]$ passwd
Changing password for user mca09176.
Changing password for mca09176
(current) NT password:
New UNIX password:
Retype new UNIX password:
//passwd: System error
//Segmentation fault

Q.7 Write a command to get help for commands like cp, mv, mkdir.
Ans:
[mca09176@ALS ~]$ man cp
[mca09176@ALS ~]$ whatis cp
[mca09176@ALS ~]$ apropos cp
[mca09176@ALS ~]$ man mv
[mca09176@ALS ~]$ whatis mv
[mca09176@ALS ~]$ apropos mv
[mca09176@ALS ~]$ man mkdir
[mca09176@ALS ~]$ whatis mkdir
[mca09176@ALS ~]$ apropos mkdir

Q.8 Display the content of homeadd.txt.
Ans:
[mca09176@ALS ~]$ cat homeadd.txt

Q.9 Display the content of officeadd.txt.
Ans:
[mca09176@ALS ~]$ cat officeadd.txt

Q.10 Display the content of collegeadd.txt.
Ans:
[mca09176@ALS ~]$ cat collegeadd.txt

Q.11 Display the content of all above files using just single line command.
Ans:
[mca09176@ALS ~]$ cat homeadd.txt officeadd.txt collegeadd.txt

Q.12 Execute above command breaking in different lines.
Ans:
[mca09176@ALS ~]$ ls homeadd.txt
homeadd.txt
[mca09176@ALS ~]$ ls officeadd.txt
officeadd.txt
[mca09176@ALS ~]$ ls collegeadd.txt
collegeadd.txt

Q.13 Append your name and roll No in collegeadd.txt.
Ans:
[mca09176@ALS ~]$ cat >> collegeadd.txt
Name :
Roll No:
[mca09176@ALS ~]$ cat collegeadd.txt
Atmiya Institute of Science & Technology
Kalawad road
Rajkot
Name :
Roll No:

Q.14 Display the content of above 3 text file using cat, more and less simultaneously.
Ans:
[mca09176@ALS ~]$ more homeadd.txt
[mca09176@ALS ~]$ cat > officeadd.txt
[mca09176@ALS ~]$ more officeadd.txt
[mca09176@ALS ~]$ cat > collegeadd.txt
[mca09176@ALS ~]$ more collegeadd.txt
homeadd.txt (END)
officeadd.txt (END)
Atmiya Institute of Technology & Science,
kalawad Road,
Rajkot.
collegeadd.txt (END)

Q.15 Clear the content of your console.
Ans:
[mca09176@ALS ~]$clear

Q.16 Create 3 directory like hm, office,college.
Ans:
[mca09176@ALS ~]$ mkdir hm
[mca09176@ALS ~]$ mkdir office1
[mca09176@ALS ~]$ mkdir college
[mca09176@ALS ~]$ ls
collegeadd.txt hm office officeadd.txt
college homeadd.txt office

Q.17 List the content of your present working directory using ls command with all possible arguments.
Ans:
[mca09176@ALS ~]$ ls(2times Tab)
ls lsb_release lshal lsnrctl lsof lss16toppm
lsattr lsdiff lsnodes lsnrctl0 lspgpot

Q.18 Copy homeadd.txt into hm directory, officeadd.txt into office directoy and collegeadd.txt into college directory.
Ans:
[mca09176@ALS ~]$ cp homeadd.txt hm
[mca09176@ALS ~]$ cp officeadd.txt office1
[mca09176@ALS ~]$ cp collegeadd.txt college
[mca09176@ALS ~]$ cd hm
[mca09176@ALS hm]$ ls
homeadd.txt
[mca09176@ALS hm]$ cd ..
[mca09176@ALS ~]$ cd office1
[mca09176@ALS office1]$ ls
officeadd.txt
[mca09176@ALS office1]$ cd ..
[mca09176@ALS ~]$ cd college
[mca09176@ALS college]$ ls
collegeadd.txt

Q.19 Copy directory hm, office, college with the name according to hm1, office1,college1.
Ans:
[mca09176@ALS ~]$ mv hm hm1
[mca09176@ALS ~]$ ls
college collegeadd.txt hm1 homeadd.txt office officeadd.txt
[mca09176@ALS ~]$ mv college college1
[mca09176@ALS ~]$ ls
college1 collegeadd.txt hm1 homeadd.txt office officeadd.txt
[mca09176@ALS ~]$ mv Office Office1
[mca09176@ALS ~]$ ls
college1 collegeadd.txt hm1 homeadd.txt office1 officeadd.txt

Q.20 & Q.21 (Both are same.)
Move homeadd1.txt, officeadd1.txt, collegeadd1.txt according into hm, office1, college1 directory using single line command.
Ans:
[mca09176@ALS ~]$ mv collegeadd.txt college1 officeadd.txt hm1
[mca09176@ALS ~]$ ls
hm1 homeadd.txt office1
[mca09176@ALS ~]$ cd hm1
[mca09176@ALS hm1]$ ls
college1 collegeadd.txt homeadd1.txt homeadd.txt officeadd.txt
[mca09176@ALS hm1]$ cd ..
[mca09176@ALS ~]$ ls
hm1 homeadd.txt office1

Q.22 Remove homeadd.txt, officeadd.txt, collegeadd.txt.
Ans:
[mca09176@ALS ~]$ rm -r homeadd.txt
[mca09176@ALS ~]$ ls
college1 collegeadd.txt hm1 office1 officeadd.txt
[mca09176@ALS ~]$ rm -r officeadd.txt
[mca09176@ALS ~]$ ls
college1 collegeadd.txt hm1 office1
[mca09176@ALS ~]$ rm -r collegeadd.txt.
[mca09176@ALS ~]$ ls
college1 hm1 office1

 Q.23 Remove directory hm, office, college.
Ans:
[mca09176@ALS ~]$ rm -r hm1
[mca09176@ALS ~]$ ls
college1 office1
[mca09176@ALS ~]$ rm -r office1
[mca09176@ALS ~]$ ls
college1
[mca09176@ALS ~]$ rm -r college1
[mca09176@ALS ~]$ ls

Q.24 Display help for cat, ls, cp command with all possible help command.
Ans:
[mca09176@ALS ~]$ whatis cat
[mca09176@ALS ~]$ man cat
[mca09176@ALS ~]$ apropos cat
[mca09176@ALS ~]$ whatis ls
[mca09176@ALS ~]$ man ls
[mca09176@ALS ~]$ apropos ls
[mca09176@ALS ~]$ whatis cp
[mca09176@ALS ~]$ man cp
[mca09176@ALS ~]$ apropos cp

Q.25 Display content of homeadd1.txt, officeadd1.txt, collegeadd1.txt with the use of cat, more and less command.
Ans:
[mca09176@ALS ~]$ cat > homeadd1.txt
[mca09176@ALS ~]$ cat > officeadd1.txt
[mca09176@ALS ~]$ cat > collegeadd1.txt
[mca09176@ALS ~]$ more homeadd1.txt
[mca09176@ALS ~]$ more officeadd1.txt
[mca09176@ALS ~]$ more collegeadd1.txt
[mca09176@ALS ~]$ less homeadd1.txt
[mca09176@ALS ~]$ less officeadd1.txt
[mca09176@ALS ~]$ less collegeadd1.txt

No comments: