The focus of the first homework assignment is learning to navigate and operate the Unix filesystem. In addition to moving around a Unix system, you will need to know how to manipulate files and folders, search for files, read and modify permissions, and combine programs using pipes.
For this assignment, record your responses to the following exercises in the
README.md
file in the homework01
folder of your assignments
Bitbucket repository and push your work by 11:59 PM Friday, January 22,
2016.
Suppose you were at your AFS home directory on one of the student machines:
How would you navigate to the csesoft
AFS home directory using an
absolute path?
How would you navigate to the csesoft
AFS home directory using a
relative path?
How would you navigate to the csesoft
AFS home directory using a path
that contains ~
?
How would you create a shortcut or link in your own $HOME
directory
called csesoft
to the csesoft
AFS home directory.
The csesoft
AFS home directory contains a collection of updated and
additional software for students to use in coursework including:
It is located at the following path:
/afs/nd.edu/user14/csesoft
To utilize the software collection, you can add it to your $PATH
environmental variable by using the following command:
setenv PATH /afs/nd.edu/user14/csesoft/new/bin:$PATH
To make this a permanent change, you should store the command above in your
~/.cshrc
file.
The /usr/share/pixmaps
folder is found on many Linux machines. It
usually contains images such as icons and wallpapers. On the student
machines:
How would you copy all the contents of the /usr/share/pixmaps
folder to
a new images
folder in your AFS home directory?
Perform the copy operation above and then inspect the symlinks in the
new images
folder. Are there any broken links? If so, how do you know and
why are they broken?
How would you rename the images
folder to pixmaps
? Time this
operation using the time command.
How would you move the pixmaps
to /tmp/$USER-pixmaps
(where $USER
is
your netid)? Time this operation using the time command. Is this
operation slower? Why?
How would you remove the /tmp/$USER-pixmaps
folder? Time this operation
using the time command. How does this compare to the previous move
command?
In a past life, the instructor was a member of the Cooperative Computing Lab (CCL) and worked under the direction of Dr. Douglas Thain. One of the instructor's duties was to maintain the group's software, which is still located at the following path:
/afs/nd.edu/user37/ccl/software
How would you list the contents of the software directory such that you get a long listing with file sizes in human readable format (ie. K, M, G, etc.)?
How would you list the contents of the software directory such that you get a long listing of objects from newest to oldest (ie. the most recently modified file or directory is listed at the top)?
The Cooperative Computing Lab develops a set of distributed and scientific computing applications collectively called the CCTools and provides the latest version of the software at the following path:
/afs/nd.edu/user37/ccl/software/cctools/x86_64
How many total files (excluding directories) are in the directory above? What command(s) did you use to determine the total?
Does the directory above contain an executable named weaver
? If so,
that is the program written by the instructor for his dissertation. What
command(s) did you use to determine if the folder contained weaver
?
Which of the three folders in the
/afs/nd.edu/user37/ccl/software/cctools/x86_64
directory is the largest and
how large is it (in terms of megabytes)? What command(s) did you use to
determine the largest directory and its size?
How many files are in the largest folder found above? What command(s) did you use to determine the number of files in the largest folder?
What is the largest file in the
/afs/nd.edu/user37/ccl/software/cctools/x86_64
directory? What command(s)
did you use to determine the largest file?
How many files in the /afs/nd.edu/user37/ccl/software/cctools/x86_64
directory have not been modified in more than 30
days? What command(s) did
you use to determine this?
You may wish to utilize some of the following commands: du, find, ls, sort, xargs, wc.
You can combine multiple commands by passing the output of one command as the input of a subsequent command by using pipes such as:
du | sort -n | head -n 5
Which gives you the top five results after sorting the output of du.
Suppose you had a file, data.txt
, with the following permissions:
rwxr-x--x
Identify who can read from that file, write to that file, and execute that file.
What command would you execute to change data.txt
such that:
a. Only you can read and write to the file.
b. Only you and members of your group can read, write, and execute the file.
c. Anyone can read the file.
d. There are no permissions on the file.
If there are no permissions on the file, who can delete the file?
On the student machines, your home directory is stored on AFS, which is a distributed filesystem. While it has support for traditional Unix permissions, it has an additional layer of ACLs or Access Control Lists.
Use the fs listacl command to view the ACLs on your home directory,
your Private
directory, and your Public
directory. What are the
differences in the ACLs for those three folders and what do those
differences mean?
What are the Unix permissions for the folder /afs/nd.edu/common
? Use
touch create a file /afs/nd.edu/common/$USER.txt
(where $USER is your
netid). What happened? Explain.
How would you use the fs setacl command to give the instructor (but no one else but yourself) access to a folder in your home directory?
Do each of the following:
Type umask 000
and then use touch to create a file called
world1.txt
.
Type umask 022
and then use touch to create a file called
world2.txt
.
Type umask 044
and then use touch to create a file called
world3.txt
.
What are the permissions of each of the three files you created? Are they the same? Why or why not? Explain the effect umask has on file creation and how this can be useful.
For extra credit, install a Linux distribution either on a partition on your laptop or in a virtual machine. Once you have Linux installed, please show your setup to the instructor or a TA to verify.
There are a number of Linux distributions and which one you wish to install is up to you. That said, these are probably the most popular ones:
You can find a more exhaustive list on Distrowatch. For virtualization software, Virtualbox is a popular choice.
If you have any questions, comments, or concerns regarding the course, please
provide your feedback at the end of your README.md
.
To submit your assignment, please commit your work to the homework01
folder
in your assignments Bitbucket repository by 11:59 PM Friday, January
22, 2016.