Вы находитесь на странице: 1из 1

CS9257 – Operating System Lab

1. Write a UNIX system program that prints both the access time and the time of
modification of a file.

2. Write a UNIX system program that prints a file backwards, a line at a time

a. For example, if the file contains:

i. dog

ii. bites

iii. man

b. then backward will print:

i. man

ii. bites

iii. dog

3. Write a program that lists from the current directory all ordinary filenames whose size
exceeds 100,000 bytes. Also remove all files whose size is 0 bytes.

4. Write a program that accepts a directory name as argument and then checks
whether it exists as a directory. If it doesn’t exist or exists as an ordinary file, then
remove file and create the directory. Also change to that directory and display the
current directory.

5. Implement your own version of a command to display a file that should be almost
same as the UNIX cat command that displays a requested file on the screen. Name
your command as displayfile that should have the following syntax:
displayfile file_name
that displays the file called file_name and reports with an appropriate message if the
file_name does not exist or can’t be opened. You can use open( ), read( ), write( )
and close( ) system calls.
6. Write a program that implements the ls utility of UNIX by using getdents ( ) system
call to first get the names of files in the given directory and then using the stat ( )
system call get all the needed information for the files present and print them one by
one.

Вам также может понравиться