0% found this document useful (0 votes)
4 views

Unix

Uploaded by

kunjukukku20
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Unix

Uploaded by

kunjukukku20
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 30

502:-UNIX AND SHELL PROGRAMMING

TYBCA – Semester 5
502 UNIX and Shell Programming
Practical -1
Patel Jigisha

Rollno 29

1 .Create your own directory called “mydir” and “owndir”.

2. Change to mydir

3. Check the path of directory.

4. Using the cat command to create a file “student” containing the following data.
1425 ravi 15.65
4320 ramu 26.27
6830 sita 36.15
1450 raju 21.86

5. Use the cat command to display the file, my table.

6 .Display login information about the user who issued this command.

ROLLNO:-29 1
502:-UNIX AND SHELL PROGRAMMING

7.List the files. Check the ls command with all the options.
1st

ROLLNO:-29 2
502:-UNIX AND SHELL PROGRAMMING

Practical 2

1. Display the System date.

2. Display the System date in following formats.


a.06/29/95 The output will be in mm/dd/yy format

b. 29 06/29/95 12:01:11

3. Display the calendar.

ROLLNO:-29 3
502:-UNIX AND SHELL PROGRAMMING

4. Display the calendar of the current month.

5. Display the calendar of September 2020

ROLLNO:-29 4
502:-UNIX AND SHELL PROGRAMMING

6. Display the calendar of your birthdate.

7. Display the calendar of September 1752.

8. Make a banner with the content "welcome to KBS and Natraj Science College".

9. Displays the information about the co-users with the column headings.

10. Display login information about the user who issued this command.

11. Display the path of your current directory.

12. Display the path of bin directory.

13. Display the path of user’s bin directory.

ROLLNO:-29 5
502:-UNIX AND SHELL PROGRAMMING

14. Clear the screen.

15. See the manual of who command.

16. Check your terminal type.

ROLLNO:-29 6
502:-UNIX AND SHELL PROGRAMMING

17. Display the present working directory.

18. Display the home directory or login directory.

19. Using BC command do the following:


a. Add 2 nos.

b. Divide 2 nos. While division Change the scale and check the result

c. Convert from binary to decimal no.

d. Convert from decimal to binary no.

e. Convert from decimal to hexadecimal no.

ROLLNO:-29 7
502:-UNIX AND SHELL PROGRAMMING

f. Convert from decimal to octal no.

g. Display 1 to 10 no. using while and for loop.

ROLLNO:-29 8
502:-UNIX AND SHELL PROGRAMMING

Practical 3
1. Create your own file student.

2. Change the permissions of the file student to add execute privilege using relative
manner.

3. Change mode of myfile to 'rwxr--r--' using absolute manner.

4. Change mode of myfile to 'rw-rw-r--' using absolute manner.

5. Copy the files.

ROLLNO:-29 9
502:-UNIX AND SHELL PROGRAMMING

6. Rename the files.

7. How do you move a file from one directory to another using Linux commands?

8. Count the number of lines, words and characters of the file “student”.

9. Display the no. of lines of “student”.

10. What is the command to change the ownership of a file or directory in Linux?
11. How do you check the contents of a file without opening it in Linux?

ROLLNO:-29 10
502:-UNIX AND SHELL PROGRAMMING

Practical -4
1. Which is the command to check currently login in Linux?
Output:

2. What command can you use to show running processes on a Linux system?
Output:

3. What command can you use to show detail processes information on a linux?
Output:

ROLLNO:-29 11
502:-UNIX AND SHELL PROGRAMMING

4. How do you terminate a running process in Linux?


Output:

5. How do you make a command run in the background in Linux?


OUTPUT:

6. How do you create a symbolic link in Linux?

ROLLNO:-29 12
502:-UNIX AND SHELL PROGRAMMING

7. How do you create a hard link in Linux?

8. Which is the command to check file types

9. Create two files a1.txt and b1.txt. Then compare both files using cmp command

ROLLNO:-29 13
502:-UNIX AND SHELL PROGRAMMING

10.Use command and diff commands on these files and check the result.

ROLLNO:-29 14
502:-UNIX AND SHELL PROGRAMMING

PRACTICAL 5
1. Create a file using vi editor and navigate within the file.save the file.

2. Create a shell script to add two nos.

3. Create a shell script to perform mathematical operations.

ROLLNO:-29 15
502:-UNIX AND SHELL PROGRAMMING

4. Create a shell script to accept and check the highest no from two nos.

ROLLNO:-29 16
502:-UNIX AND SHELL PROGRAMMING

5. Write a script to calculate the simple interest.

ROLLNO:-29 17
502:-UNIX AND SHELL PROGRAMMING

6. Write a shell script to text two strings which are equal or not

7. Write a script to check whether a given string is palindrome or not.

ROLLNO:-29 18
502:-UNIX AND SHELL PROGRAMMING

8. Write a shell script to count files, directories and symbolic link files drom
current directory.

ROLLNO:-29 19
502:-UNIX AND SHELL PROGRAMMING

Practical 6
1. Create a shell script to perform mathematical operations using case.

ROLLNO:-29 20
502:-UNIX AND SHELL PROGRAMMING

ROLLNO:-29 21
502:-UNIX AND SHELL PROGRAMMING

2. Write a shell script to print Fibonacci series like 0, 1,2,3,5,8…………

3. Write a shell script to check the highest no. from three inputted nos.

ROLLNO:-29 22
502:-UNIX AND SHELL PROGRAMMING

4. Write a shell script to print the following pattern for n numbers.


i. If n=4 then
1
12
123
1234

5. VNSGU ……

ROLLNO:-29 23
502:-UNIX AND SHELL PROGRAMMING

6. Write a shell script that computes the gross salary of employee according
to the following
1) if basic salary is <15000 then HRA 15% of the basic and DA =90% of
the basic
2) if basic salary is >15000 then HRA 500 and DA =98% of the basic
The basic salary is entered interactively through the key board.

ROLLNO:-29 24
502:-UNIX AND SHELL PROGRAMMING

Practical 7
1. Use “grep” command.
1. Find all lines in a file named records.txt that contain the word "KBS".

2. Display the line numbers of lines containing "failed" in records.txt

3. Find lines that do not contain the word "Success" in records.txt

ROLLNO:-29 25
502:-UNIX AND SHELL PROGRAMMING

4. Search for lines that start with "ERROR" in record.txt

5. Find lines ending with ".com" in an email list emails.txt.

6. Search recursively for the word "Hello" in all files within the tybca
directory.

7. Display only the filenames that contain the word "password" in the /etcc directory.

8.Find all lines in data.csv that contain exactly 5 digits

ROLLNO:-29 26
502:-UNIX AND SHELL PROGRAMMING

Practical -8

Use “awk” command.

1) To print even no. of words in each line of file test.txt.


2) Display those words whose length is greater than 6 characters.

3) Print line number 6 to 12 from test.txt

4) Count the all occurrence of pattern “TYBCA” in file test.txt.

5) Display lines of file f1 in uppercase.

6) Display lines of file f1 in lowercase.

ROLLNO:-29 27
502:-UNIX AND SHELL PROGRAMMING

ROLLNO:-29 28
502:-UNIX AND SHELL PROGRAMMING

PRACTICAL 9
• Use “sed” command.
1. Which one of the following command will be used for quitting after selecting 3 line
from file emp.lst?

2. Display the last line of the file emp.lst

3. Display Replacing string on a specific line number.

4. Display the line 10 to 15 from the file emp.lst

5. Display the line 5, 10 and last line from the file emp.lst

ROLLNO:-29 29
502:-UNIX AND SHELL PROGRAMMING

6. Display data some specific country from the file emp.lst

7. Display data only even line number from the file emp.lst

8. To delete specific line number from the file emp.lst.

9. Add date from the line number 2 the file emp.lst

10.To display permanently delete empty line from the file emp.lst

ROLLNO:-29 30

You might also like