Dana Vrajitoru
C151 Multi-User Operating Systems
Homework 2
Due date: Monday, January 30, 2012.
Ex. 1. Just as before, you will need to copy the content of
the terminal to a file called hw2.txt.
- Find out what part of your quota you have already used. Print the
list of directories in your home directory with the total size of the
files inside them. Print the structure of the filesystems on your
computer. For this part, use the commands quota, df, and du, that were
shown in the demo.
- Use the command which to find the absolute path for the command
grep that we have used in the previous homework.
- Display the current date and time (find this command in Chapter
3 in the textbook or you can try to guess it).
- Use the command ps to display all the processes running on your
computer with a long list of details for each of them. Display the
same list using the command top. I suggest to use the subject index in
your textbook if you want to learn more about these commands.
-
Launch the application pico from the terminal in the background. For
this, run the command terminated with an & character:
pico &
-
Find out what the process id is for this process. Do not list all the
processes active on your computer again, but only those running from
the terminal. Kill the process named pico and the list the processes
runing from the terminal again to make sure it's not there
anymore.
-
Launch the pico application again in the background and bring it to
the foreground. The command to bring the application to the foreground
is fg. Exit the editor without writing any file.
- From the list of processes running on your computer, choose one
and write down the process id. Find out if this process uses any
temporary files while running. For this, you need to check the content
of a folder with a name equal to the process id in /proc.
At this point copy the contents of the terminal to the text file and
you can save it and close it. The rest of the homework doesn't need to
be in it.
Ex. 2 Archiving files
List all the files starting with an m from the directory
/bin. Suppose that we want to create an archive of these
files. Without changing your current directory (if you changed it
before, go back to your home directory), create the archive with the
following command:
tar cf binm.tar /bin/m*
List the files in the current directory to see if the archive was
created correctly. List the files contained in the archive with the
following command:
tar tf binm.tar
List all the files in the current directory with a long list of
attributes.
Compress the tar file created at the previous step with the command
gzip:
gzip binm.tar
List the files again with the option -l to compare the size of the
archive before and after the compression with gzip.
Ex. 3.
Save the content of the terminal to a file called hw2.txt and upload
it and the archive file you created to Homework 2 on Oncourse in
Assignments 2. Add as a comment in the submission for the complete
(absolute) path to the file icing.jpg that you copied in your home
directory. At this point I should be able to see it if you did these
operations well. This completes your homework.