Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

1.

Enter the following commands and note your observation i)who ii)ps iii)echo $$
2. Command to count the no of files in the directory
3. Evaluate the following expression 12+5, 12*12,2^8,9/3
4. Display all the users who are logged in to the system with a header ?
5. Display date of june 17th 2003
6. Evaluate the following expression 12+5, 12*12,2^8,9/3 redirect the output to a file
7. Create a file and display the contents of a file using a command
8. How to increase the link count of a file
9. How to find out the type of the file.
10. Determine the current working directory
11. Find out the users who are currently logged in.
12. Display the calendar for (i) Jan 2000 (ii) Feb 1999 (iii) 9th month of the year 7 A.D (iv) For
the current month (v) Current Date Day Abbreviation , Month Abbreviation along with year.
13. Display the Current Date and Current Time.
14. Display the name of your home directory.
15. Create a directory SAMPLE under your home directory.
a. Create a sub-directory by name TRIAL under SAMPLE.
b. Change to SAMPLE.
c. Change to your home directory.
d. Change from home directory to TRIAL by using absolute and relative pathname.
e. Remove directory TRIAL.
16. . Create a directory TEST using absolute pathname.
17. Using a single command change from current directory to home directory.
18. Remove a directory using absolute pathname.
19. Create files myfile and yourfile under Present Working Directory. Display the files myfile
and yourfile.
20. Append more lines in the myfile and yourfile files.
21. Copy myfile file to emp.
22. Write the command to create alias name for a file.
23. Display the inode numbers
24. Copy content of one file to another files
25. Display the inode number of a file
26. Extract the permission of a file
27. Extract the link count of a file
28. Change the permission of others to read and execute
29. Change the permission of group to read and write
30. Change the permission to add all the users with execute permission.
31. Display the output of ls on the screen and as well as redirect it to a file
32. Rename a file with name file1 to exam1
33. Count number of lines in a file
34. Count number of words in a file
35. Display the content of a exe file
36. Find out whether two files are identical.
37. Suppose you have two files containing list of people. You are asked find out the nameas
available in one and not in other.
38. Suppose you have two files containing list of people. You are asked find out the nameas
common to both.
39. Create a files with current permission rw-r-xr--, later change permission to rwxrwxrwx
40. Create a files with current permission rw-r-xr--, later change permission to r—r-----
41. Create a files with current permission rw-r-xr--, later change permission to ---r—r—
42. Create a files with current permission rw-r-xr--, later change permission to --------
43. Display process attributes
44. How to select i) first 10 lines from a file ii) how to select last 10 lines from a file
45. Search a pattern in a file where search pattern is not particular about the case
46. Delete all the lines except those containing the pattern
47. How many lines of a file contains a particular pattern
48. Display only the names of files containing the pattern
49. Remove the blank lines in a file
50. Search a pattern in a file which starts with s

Questions on Shell scripts


1. Write a shell script to display the contents of all the files which have a common
prefix in their file name.
2. Write a shell script that searches for a substring in a string.
3. Write a shell script that deletes all the white spaces present in the given line of
content.
4. Write a shell script that displays a list of all the directories present the current path.
5. Write a shell script to read two strings from the terminal. Display a message if both
strings have equal number of characters.
6. Write a shell script that displays the last modification time of any file
7. Write a shell script that changes the name of the files passed as arguments to
uppercase.
8. Write a shell script that changes the string read from the terminal to lowercase.
9. Write a shell script to combine any three text files into a single file (append them in
the order as they appear in the arguments) and display the word count.
10. Write a shell script to combine the contents of two files which have a common prefix
in their file name and display the content.
11. Write a script which outputs the following:
a. the time and date
b. who is logged on
c. also output a line of asterisks (*********) after each section.
12. Write a script which outputs the following:
a. your username
b. list of files present in the current directory
c. also output a line of asterisks (*********) after each section.
13. Write a shell script that displays the last modification time of any file
14. Write a shell script to find the largest among the three numbers read from the
terminal.
15. Write a shell script to find the largest among the three numbers passed as argument.
16. Write a shell script to find the smallest among the three numbers read from the
terminal.
17. Write a shell script to find the smallest among the three numbers passed as
argument.
18. Write a shell script to find the factorial of given integer
19. Write a shell script to display the ‘n’ fibonacci series.
20. Write a shell script to display 10 multiples of a given number.
21. Write a shell script to print all the command line arguments and total number of
arguments
22. Write a shell script to check weather the argument is file or a directory
23. Write a shell script to check whether the file has read permission
24. Write a shell script to check whether the file has write permission
25. Write a shell script to check whether the file has execute permission
26. Write a menu driven script to execute ls ps date who commands
27. Write a shell script to implement a basic caluclator
28. Write a shell script that accepts a filename as argument and displays link count if the
file exists and a suitable message if it doesn’t.
29. Program to CHECK WHETHER THE NUMBER IS ZERO/ POSITIVE/ NEGATIVE
30. Write a shell script to take any number of directories as arguments and list the
content of each directory.
31. shell script to convert string from upper to lower and lower to upper case

Questions for Lab test

1.
a. Extract the permission of a file
b. Write a shell script to find the smallest among the three numbers
read from the terminal.

2.
a. Extract the link count of a file
b. Write a shell script to find the smallest among the three numbers
read from the terminal.

3.
a. Change the permission of others to read and execute
b. Write a shell script to find the smallest among the three numbers
passed as argument.

4.
a. Change the permission of group to read and write
b. Write a shell script to find the factorial of given integer

5.
a. Change the permission to add all the users with execute
permission.
b. Write a shell script to display the ‘n’ fibonacci series.

6.
a. Display the output of ls on the screen and as well as redirect it to a
file
b. Write a shell script to display 10 multiples of a given number.
7.
a. Rename a file with name file1 to exam1
b. Write a shell script to print all the command line arguments and
total number of arguments
8.
a. Count number of lines in a file
b. Write a shell script to check weather the argument is file or a
directory

9.
a. Count number of words in a file
b. Write a shell script to check whether the file has read permission

10.
a. Display the content of a exe file
b. Write a shell script to check whether the file has write permission

11.
a. Find out whether two files are identical.
b. Write a shell script to check whether the file has execute
permission

12.
a. Suppose you have two files containing list of people. You are
asked find out the nameas available in one and not in other.
b. Write a menu driven script to execute ls ps date who commands

13.
a. Suppose you have two files containing list of people. You are asked
find out the name as common to both.
b. Write a shell script to implement a basic calculator

14.
a. Create a files with current permission rw-r-xr--, later change
permission to rwxrwxrwx
b. Write a shell script that accepts a filename as argument and
displays link count if the file exists and a suitable message if it
doesn’t.

15.
a. Create a files with current permission rw-r-xr--, later change
permission to r—r-----
b. Program to CHECK WHETHER THE NUMBER IS ZERO/ POSITIVE/
NEGATIVE

16.
a. Create a files with current permission rw-r-xr--, later change
permission to ---r—r—
b. Write a shell script to take any number of directories as arguments
and list the content of each directory.

17.
a. Create a files with current permission rw-r-xr--, later change
permission to --------
b. Write a shell script to convert string from upper to lower and lower
to upper case

18.
a. Display process attributes
b. Write a shell script to find the smallest among the three numbers
read from the terminal.

19.
a. How to select i) first 10 lines from a file ii) how to select last 10
lines from a file
b. Write a shell script to find the smallest among the three numbers
read from the terminal.

20.
a. Search a pattern in a file where search pattern is not particular
about the case
b. Write a shell script to find the smallest among the three numbers
passed as argument.

21.
a. Delete all the lines except those containing the pattern
b. Write a shell script to find the factorial of given integer

22.
a. How many lines of a file contains a particular pattern
b. Write a shell script to display the ‘n’ fibonacci series.

23.
a. Display only the names of files containing the pattern
b. Write a shell script to display 10 multiples of a given number.

24.
a. Remove the blank lines in a file
b. Write a shell script to print all the command line arguments and
total number of arguments

25.
a. Search a pattern in a file which starts with s
b. Write a shell script to check weather the argument is file or a
directory

26.
a. Extract the permission of a file
b. Write a shell script to convert string from upper to lower and lower
to upper case
27.
a. Extract the link count of a file
b. Write a shell script to take any number of directories as arguments
and list the content of each directory.

28.
a. Change the permission of others to read and execute
b. Program to CHECK WHETHER THE NUMBER IS ZERO/ POSITIVE/
NEGATIVE

29.
a. Change the permission of group to read and write
b. Write a shell script that accepts a filename as argument and
displays link count if the file exists and a suitable message if it
doesn’t.

30.
a. Change the permission to add all the users with executes
permission.
b. Write a shell script to implement a basic calculator
31.
a. Display the output of ls on the screen and as well as redirect it to a
file
b. Write a menu driven script to execute ls ps date who commands

32.
a. Rename a file with name file1 to exam1
b. Write a shell script to find the smallest among the three numbers
read from the terminal.
33.
a. Count number of lines in a file
b. Write a shell script to check weather the argument is file or a
directory

34.
a. Count number of words in a file
b. Write a shell script to convert string from upper to lower and lower
to upper case

35.
a. Display the content of a exe file
b. Write a shell script to print all the command line arguments and
total number of arguments

You might also like