Updated: 2013-01-25 09:17 EST
23h59 (11:59pm) Friday January 25, 2013 (end of Week 3)
Remember to READ ALL THE WORDS to work effectively and not waste time.
This is an overview of what you will do in this assignment. Read all the words before you start working.
Complete the Tasks listed below on the Course Linux Server (CLS). Run a Checking Program to verify your work as you go. Submit your marks.
You will create file system structure in your home directory, with various directories, files, and links. You can use the Checking Program to check your work as you do the tasks. You can check your work with the checking program as often as you like before you submit your final mark. (Some tasks sections below require you to finish the whole section before running the checking program; you may not always be able to run the checking program successfully after every single task step.)
When you are finished the tasks, leave these files, directories, and links in place as part of your deliverables. Do not delete any assignment work until after the term is over! Assignments may be re-marked at any time; you must have your term work available right until term end.
This is a review lab, and all of the tasks can be completed with knowledge of the material from the prerequisite course CST8207 GNU/Linux Operating Systems I; however, you will probably need to refresh your memory of various topics by referring to the CST8207 course notes and the Linux man pages. Your lab instructor is there to help you, but he will want you to have tried consulting the notes and man pages first.
The prevous term’s course notes are available on the Internet here: CST8207 GNU/Linux Operating Systems I. All the notes files are also on the CLS. You can learn about how to read and search these files using the command line on the CLS under the heading Copies of the CST8207 course notes near the bottom of the page Course Linux Server.
Remember to READ ALL THE WORDS to work effectively and not waste time.
Do the following tasks in order, from top to bottom. READ ALL THE WORDS! and do not skip steps.
All references to the “Source Directory” below are to the directory ~idallen/cst8177/13w/assignment01/
and that name starts with a tilde character followed by a userid with no intervening slash.
Log in remotely to the Course Linux Server (CLS) from any existing computer. Pay particular attention to the special non-Algonquin password you must use, or else you will lock yourself out of the machine. If the public DNS name doesn’t work on campus (time out), try the Algonquin private name instead. All work in this assignment must be done on the CLS.
Ensure you have set the seven BASH shell options and five BASH aliases in your $HOME/.bashrc
as recommended in CST8207 Startup Files. If these options and aliases are not set when you log in, edit the .bashrc
file to add them and then log out and log back in. If they still aren’t set, also fix your $HOME/.bash_profile
file to source your .bashrc
file, as shown.
shopt -s cmdhist
shopt -s histappend
In your home directory, create a directory called: Assignments
(As with all Unix/Linux pathnames, be precise in the spelling and capitalization.) In this document, Assignments/
refers to this directory that contains all your course Assignments.
Under Assignments/
, create a directory named: assignment01
(As with all Unix/Linux pathnames, be precise in the spelling and capitalization.) All output files in the assignment must go under this assignment01/
directory. Put output files here.
There is a Checking Program named assignment01check
in the Source Directory on the CLS. Create a symbolic link to this program named check
under your new assignment01
directory so that you can easily run the program to check your work and assign your work a mark. Note: You can create a symbolic link to this executable program but you do not have permission to read or copy the program file. To verify the symbolic link, try executing it (just as you did last term).
Check your work so far using the assignment01check
program symlink.
From your home directory, use the ls
command with options to give a long listing (showing permissions), include all hidden files, include inode numbers, and recursively include all subdirectories. (Do not use any other options.) When the output is correct, redirect the output of this command into new file listing_start
under assignment01
- it will be at least 16 lines of output. (If you have files from CST8207 in your account, you may get some “permission denied” errors doing the listing [ignore the errors] and the number will be many more than 16 lines.)
Run the whoami
command. When the output is correct, redirect the output of this command into new file whoami
under assignment01
Run the id
command. When the output is correct, append the output of this command to existing file whoami
under assignment01
. (Note the word append). The file must now have two lines of output in it. Check it!
Rename the file whoami
to have the new name whoamiid
(in the same directory) and make extra sure you spelled the new name correctly.
Use a command to count only the number of lines (not characters or words) in file read.txt
in the Source Directory. (You’ll know you have the right file if the size is 818 characters.) When the output is correct, redirect the output of this command (the output containing only the line count number, not any other numbers) into new file readlines
under assignment01
Use a command to search for and display the single line containing the exact text phrase “permissions is useless” located inside any one of the text files (files having a .txt
file extension) located in the notes/
directory of the previous term CST8207 (fall 2012). The Introduction and Overview explains where to find these notes and how to search them, just as you did last term. When the output is correct, redirect the one line of output of this command into new file useless
under assignment01
The file should be one line long.
Check your work so far using the assignment01check
program symlink.
Copy the binary program file /bin/hostname
three times to files named read_only
, write_only
, and execute_only
under your assignment01
directory. This is a BINARY program file, so do not display the content of the file on your terminal screen!
Change the permissions on all three copied files so that group and other have no permissions. (You can do this with one command name and a file GLOB pattern.)
read_only
file so that only you can read the file but not write or execute the file.
/dev/null
./bin/hostname
to the file. (It should fail with “permission denied”.)write_only
file so that only you can write (including append to) the file but not read or execute the file.
execute_only
file so that only you can execute the file but not read or write the file.
Check your work so far using the assignment01check
program symlink.
Make the following directory structure under assignment01/
permissions/
permissions/read_only/
permissions/write_only/
permissions/execute_only/
Change the permissions on the permissions/
directory so the owner (you) can read, write, and search, but group and other have no permissions.
Change the permissions on all three subdirectories of permissions/
so that that group and other have no permissions. (You can do this with one command name and a file GLOB pattern.)
Change the permissions on read_only/
so that you can see the names in the directory (with echo read_only/*
or similar), but cannot take an accurate long listing, and cannot create files, and cannot cd
into the directory. (Verify that you can/cannot do these things!)
Change the permissions on write_only/
so that you cannot see the names in the directory, but you can add new files to the directory, delete files from the directory, and cd
into the directory. (Verify that you can/cannot do these things!)
Change the permissions on execute_only/
so that you can (only) cd
into the directory. You cannot see the names in the directory or add or delete files from the directory. Verify!
Check your work so far using the assignment01check
program symlink.
find
Command TasksIndexThis section refers to the maze of partially hidden files and directories under directory ~idallen/cst8177/13w/assignment01/maze
Find in the maze a single hidden file with a name similar to .abcd0001*txt
, but look for the name that starts with a period followed by your own Blackboard userid, not the fake userid abcd0001
. To look for the file, replace the string abcd0001
in .abcd0001*txt
with your own userid before you look. The name you find must be exactly 13 characters long and contain a period and a real asterisk. It must have no leading or trailing blanks around it. Hint: You might want to use a command that finds files by basename to do this. (Do not try to use “cd” and “ls” to find your file; the maze is really big.)
When you find the right file name (there is only one for your userid), put its shortest full absolute pathname into new file foundmaze
under your assignment01
directory. Note: Shortest absolute pathnames contain no /./
or /../
or tilde (“~
”) expressions; simplify the path to the shortest possible absolute pathname.
Check your work so far using the assignment01check
program symlink.
Create an absolute soft (symbolic) link to the Linux password file; create the symlink under your assignment01
directory and name the symlink mypasswd
and verify you can read the text in the password file through the mypasswd
symbolic link. (The text of the new mypasswd
symlink should be an absolute pathname to the password file.)
Display file attributes and inode numbers of both the password file and the mypasswd
symbolic link, and confirm that they are different.
Make a new relative soft link to the mypasswd
symlink you just created, named alsopasswd
, also in the assignment01
directory. (The text of the new alsopasswd
symlink should be the shortest relative pathname to mypasswd
in the same directory.) Now, alsopasswd
links to mypasswd
that links to the password file. Make sure you can also read the password file using the new alsopasswd
symlink.
Hint: All of “././foo
” and “./foo
” and “foo
” are relative pathnames that lead to the same place. Which one is shortest?
Rename the mypasswd
symlink to be otherpasswd
. Now, alsopasswd
is a (broken) symlink to a non-existent mypasswd
symlink. Confirm that you can no longer use alsopasswd
to read the text of the password file.
Check your work so far using the assignment01check
program symlink.
Note 2012-01-07: This section has been rewritten not to use the password file, because of inode changes when the file is updated. -IAN!
Create a hard link to the read.txt
file in the Source Directory (you counted the lines in this file earlier); name the hard link hardread
in the assignment01
directory. (Note; On some versions of Unix/Linux, you are not allowed to hard link to a file you cannot write. That protection has been disabled on the CLS.) Verify that you can read the file using the hardread
hard link.
Display file attributes and inode numbers of both the read.txt
file and the hardread
hard link, and confirm that they are identical. (Only the pathnames will be different.) These hard links are just two names for the same file inode.
Make a new hard link to hardread
named newhard
in the same assignment01
directory.
Display file attributes and inode numbers of the read.txt
file and both the new hard link files, and confirm that all three are identical. (Only the pathnames will be different.) These hard links are just three names for the same file inode.
Rename hardread
to junkread
and note that this does not break the hard link for newhard
. Verify that all three files have the same attributes and inode numbers and that you can read the text of the read.txt
file through both hard links, as before.
Check your work so far using the assignment01check
program symlink.
Make a backup copy of your listing_start
file, in case you accidentally overwrite it in the next step.
From the same starting directory, repeat the command you used to create listing_start
at the beginning of this lab, but redirect the output this time into the file listing_end
in the same directory as listing_start
, and make sure that all errors (standard error output) also go into the output file and not on the screen. (You might find your shell history useful here. There is a special syntax to also redirect error messages.)
Use the diff
command to compare the earlier listing file to the previous one you did before starting this lab. Note the many changes!
Check your work a final time using the assignment01check
program symlink. Submit your final mark following the directions below.
Summary: Do some tasks, then run the checking program to verify your work as you go. You can run the checking program as often as you want. When you have the best mark, upload the marks file to Blackboard.
There is a Checking Program named assignment01check
in the Source Directory on the CLS. Create a symbolic link to this program named check
under your new assignment01
directory so that you can easily run the program to check your work and assign your work a mark. Note: You can create a symbolic link to this executable program but you do not have permission to read or copy the program file. To verify the symbolic link, try executing it.
Execute the above “check” program using its symbolic link. (Review the CST8207 Search Path notes if you forget how to run a program by pathname from the command line.) This program will check your work, assign you a mark, and display the output on your screen. (You may want to paginate the long output so you can read all of it.)
You may run the “check” program as many times as you wish, to correct mistakes and get the best mark.
When you are done with checking this assignment, and you like what you see on your screen, redirect the output of the Checking Program into the text file assignment01.txt
under your assignment01
directory. Use the exact name assignment01.txt
in your assignment01
directory. You only get one chance to get the name correct. Case (upper/lower case letters) matters. Be absolutely accurate, as if your marks depended on it. Do not edit the file.
Transfer the above assignment01.txt
file from the CLS to your local computer and verify its contents. Do not edit this file! No empty files, please! Edited or damaged files will not be marked. You may want to refer to this updated page on File Transfer.
Submit the assignment01.txt
file under the correct Assignment area on Blackboard (with the exact name) before the due date. Upload the file via the assignment01 “Upload Assignment” facility in Blackboard: click on the underlined assignment01 link in Blackboard. Use “Attach File” and “Submit” to upload your plain text file.
No word-processor documents. Do not send email. Use only “Attach File”. Do not enter any text into the Submission or Comments boxes on Blackboard; I do not read them. Use only the “Attach File” section followed by the Submit button. (If you want to send me comments about your assignment, use email.)
Your instructor may also mark the assignment01
directory in your CLS account after the due date. Leave everything there on the CLS. Do not delete any assignment work from the CLS until after the term is over!
Use the exact file name given above. Upload only one single file of plain text, not HTML, not MSWord. No fonts, no word-processing. Plain text only.
Did I mention that the format is plain text (suitable for VIM/Nano/Pico/Gedit or Notepad)?
NO EMAIL, WORD PROCESSOR, PDF, RTF, or HTML DOCUMENTS ACCEPTED.
No marks are awarded for submitting under the wrong assignment number or for using the wrong file name. Use the exact name given above.
WARNING: Some inattentive students don’t read all these words. Don’t make that mistake! Be exact.
READ ALL THE WORDS. OH PLEASE, PLEASE, PLEASE READ ALL THE WORDS!