CPS393 u1Lab: commands: cd, cat, ls, pwd, cp, mkdir, mv, vim, chmod ------------------------------------ Part 1 ------------------------------------ 1. Move around directories, list entries in directories, and verify current directory using: cd, ls, pwd commands as follows: Move into your home directory: cd Move into the course directory: cd /usr/courses/cps393/dwoit/ List the entries there: ls Change into the labs directory cd labs List the entries there: ls Change into the first lab cd u1Lab List the entries there: ls Change back into your HOME directory: cd Move back-and-forth between your home directory and the preivous directory (/usr/courses/cps393/dwoit/labs/u1Lab) by using the following command over and over: cd - Each time you change directories, verify you are in the correct directory by using the following command: pwd 2. Use mkdir to create directories as follows: Move into your home directory: cd Verify you are there: pwd Make directory cps393: mkdir cps393 Verify it was created: ls Move into dir cps393: cd cps393 Verify you are there: pwd Make dir labs: mkdir labs Verify it was created: ls Move into dir labs: cd labs Make directories for the first 4 labs: mkdir vimLab u1Lab u2Lab u3Lab Verify they were created: ls 3. Use cp to copy file(s): When you did vimLab, you copied file vimTutorial.txt from /usr/courses/cps393/dwoit/labs/vimLab/ to your home directory and modified it with vim. Move your own vimTutorial.txt file from your home directory into your vimLab directory: Move into your home dir: cd Verify vimTutorial.txt is there: ls Move it into vimLab dir: mv vimTutorial.txt cps393/labs/vimLab/ Verify it moved there: ls cps393/labs/vimLab/ Move into the u1Lab directory in the course account: cd /usr/courses/cps393/dwoit/labs/u1Lab pwd ls Move into your own u1Lab dir: cd ~/cps393/labs/u1Lab Verify you are there: pwd Copy file myInfo.txt from the course u1Lab dir into your own u1Lab dir: cp /usr/courses/cps393/dwoit/labs/u1Lab/myInfo.txt . Verify it was copied over: ls Verify your vimLab dir contains vimTutorial.txt and your u1Lab dir contains myInfo.txt cd cd cps393/labs pwd ls vimLab ls u1Lab If they're not there, repeat the above. 4. Fill in myInfo.txt file: Move into your u1Lab dir: cd cd cps393 cd labs/u1Lab pwd ls Edit myInfo.txt: vim myInfo.txt NOW USE VIM TO FILL IN YOUR NAME, SID, CS LOGIN, WHERE INDICATED, LEAVING A SPACE AFTER EACH COLON 5. Look at the man page for the ls command: man ls Find an option of the "ls" command that lists directory contents so that color is used to distinguish file types. Remember: when in a man page, "space bar" goes down a page, "b" goes back up a page, "enter" goes down one line, "/abc" searches for the string "abc", "n" searches for the next occurrence of the string you searched for last, "q" quits the man page. ------------------------------------ Part 2 ------------------------------------ 1. Move into your cps393/labs directory From within labs, do the ls command with the option you found above (so the contents will be listed in color.) Use output redirection (the ">" character) to capture the output of this ls command into a file named u1Labq01 cat the file; note that colors may or may not appear in u1Labq01, depending on the actual ls option you used. 2. Use chmod to change some permissions on your files/dirs as follows: file myInfo.txt has permissions rw- for user, --x for group, and --- for other. directory labs has permissions rwx for user, r-x for group, and --- for other. 3. Move into your home directory and verify you're there. From within your home directory, use the ls command to get a long listing for myInfo.txt and labs as follows: Specify myInfo.txt using an ABSOLUTE path name. Specify labs using an RELATIVE path name. (hint: ..) Your command should look like the following (with ### replaced appropriately)": ls -ld ######myInfo.txt ######labs Use the mouse to copy and paste the actual ls command you used into file u1Labq03: If you're using putty: -"select" whole ls command with the mouse so it's hilighted (which is "copy" in putty). -vim u1Labq03 -open a new line: o -right-click mouse (which is "paste" in putty) -press escape a couple of times -:wq to save and exit If you are working in a lab room, and not using Putty, then do the above, except copy-paste more "normally" (select from a context-menu). 4. Use output redirection (the ">") to capture the OUTPUT from your ls command from question 3, and save it into file u1Labq04