Lab #5 - vim, File Permissions, Hard/Soft Links

Lab Steps:


Use vimtutor to Learn How to Use vim A. Run the vimtutor command from Terminal. Follow all the steps as directed. Take your time to read each lesson all the way through before attempting the steps. B. Save your work in your home directory. Changing File Permissions A. Open Terminal and go into your lab4 directory. B. Type chmod 444 bashprofile to only allow the file to be read, not written to. C. Open bashprofile in vim and verify that it states Read Only in the lower left corner. Quit vim. D. Type chmod +w bashprofile to add the ʻwriteʼ bit back for ʻuserʼ and ʻgroupʼ privileges. E. Type chmod g-w bashprofile to remove the ʻwriteʼ bit from ʻgroupʼ privileges on the file. F. Type ls -la bashprofile to verify that the permissions now show: -rw-r--r-G. Open the bashprofile file in vim again and verify that you can now write to the file. Quit vim. H. Create a new file called permtest in vim and add the following line to it: # echo “Hello World!” I. Add the ʻexecuteʼ permission on the file by typing the chmod +x permtest command. J. Type ./permtest and press Enter to see the message “Hello World!” echo on the screen. Creating Hard and Symbolic (Soft) File Links A. Verify you are in your lab4 directory using the pwd command. B. Create a hard link to your home directory. e.g. ln bashprofile /home/bjones/bashprofile C. Now create a symbolic (soft) link. e.g. ln -s bashprofile /home/bjones/bashprofile_sym D. List the files in your home directory to verify both links were created. E. Create a hard link to your home directory for permtest now too. F. Change directories to your home directory and execute an ls -l to see the contents. You should see your three created links. Using the gzip and gunzip Commands A. Change your directory to lab4. B. Try to compress the bashprofile file by typing gzip bashprofile. You will receive an error. C. Delete only the bashprofile hard link in your home directory, not lab4. D. Try to compress the bashprofile file in your lab4 directory again. No error should occur this time. E. Execute ls -la again and observe what has changed in your lab4 directory. F. Uncompress the file again by typing the gunzip -d bashprofile.gz command.





Master your semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master your semester with Scribd & The New York Times

Cancel anytime.