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

Unix Programming Lab Assignment - Unix Commands: TH TH

The document provides instructions for 30 UNIX commands assignments, including listing files with certain extensions or starting characters, creating empty and text files, copying and merging files, setting permissions, removing directories, searching and replacing text, and dividing or joining files.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views

Unix Programming Lab Assignment - Unix Commands: TH TH

The document provides instructions for 30 UNIX commands assignments, including listing files with certain extensions or starting characters, creating empty and text files, copying and merging files, setting permissions, removing directories, searching and replacing text, and dividing or joining files.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

UNIX PROGRAMMING LAB

ASSIGNMENT UNIX COMMANDS


1. List all the files in directory mydir which end with x and store them in a file file1.
2. List all the files in a directory whose name start with a vowel and store them in a file
file2.
3. List all the files in a directory whose names do not begin with vowel.
4. List all 5 character file names in the current directory whose first character is in the range
a to m, the second character is in the range c to z, the third character is in the range 4 to 9
where 4th and 5th and valid characters.
5. List all the files in the present directory including the files present in any sub-directories
that may be present in the current directory.
6. Create 5 empty files empty1, empty2, empty3, empty4 and empty5.
7. Create a file called text and store your name, age, sex, and address in it and display its
contents.
8. Make a copy of the file text into another file newtext.
9. Create a file called matter and combine the contents of the file text and matter into
another file txtmat.
10. Create one more link called tmpfile for the file matter
11. Copy the contents of mydir directory to the newdir directory.
12. Delete interactively the files created earlier.
13. Set up sticky bit for the directory newdir
14. Create a directory which should have permissions 754.
15. Suppose the path dir1/dir2/dir3/dir4 exists in your directory. All these directories are
empty. How would you remove all of them at one shot.
16. Display all four letter words whose first letter is b and last letter is k.
17. Convert the input file report from lower case to upper case. And copy them to the
output file document

18. Output of who should be sorted and displayed on the screen along with the total number
of users. The same output except the number of users should also be stored in a file file1.
19. Merge the contents of the file a.txt, b.txt and c.txt , sort them and display the sorted
output on the screen page by page
20. Display the list of last 20 files present in the current directory. Also store this list in file
profile.
21. Extract the address field from a file text.
22. Search all the lines in a file which begin with a, b or c.
23. Search all the lines in a file which end with s to z.
24. There are 5 files available. How would you replace all occurrences of the
word printf in these files with the word PRINTF.
25. In the middle of the file being typed you want to import the output of who command.
How would you do this?
26. While editing a file file1 you want to read of the line numbers 10 to 20 from file2
can you do this?
27. Let us assume that a file by the name of sample is having the permission of rwxr_ _r _x,
now change the permission of this file to r_ _ _w_ _w_ by using symbolic mode.
28. Write a program using bc to print squares of numbers from 1 to 20.
29. Divide any file which consists of 20 lines into subfiles where each subfile contains 5
lines.
30. Join any two files vertically by placing the : as the separator between them.

You might also like