Objectives
- Learn basic UNIX commands
Competencies
- 6670-024 Perform basic operations in an operating system environment
Materials / Resources
- Account on UNIX operating system
- UNIX Tutorial for Beginners
Procedure
Part 1:
- Logon to your computer and open the terminal (Application->Accessories->Terminal). The tools necessary for this activity will be laid out in the first 4 tutorials of the UNIX Tutorials for Beginners guide. Extensions will go into the furhter tutorials.
- In your user home directory, create a folder named UNIX_Practice. Create a text file named path which contains the path to the directory this file is currently in. Move to your user home directory, then back one into the home directory. Copy the long_file.txt file from the share directory in the home directory to your user home directory.
- There is a file named .example in one of the subdirectories of the share directory. Find it and copy it to your user home directory as well. Move back to your home directory and move the long_file.txt file form your user home directory to the UNIX_Practice directory. View the long_file.txt file to see just how long it really is.
- Create a file named YOUR_NAME_specs.txt(replacing YOUR_NAME with your first and last name seperated by a _). In your YOUR_NAME_specs.txt file include the following specs about the long_file.txt file in order with each spec on a different line: Number of words, last line of the file, number of lines, first line of the file, number of characters, and number of times the word "apple" appears in the file. Go back to youre path.txt file and add the path you put in that file to the end of the YOUR_NAME_specs.txt file and remove the path.txt file from the directory.
- Remove the .example file from your UNIX_Practice directory. Move the YOUR_NAME_specs.txt file back to the home/share directory. Then, remove the UNIX_Practice from your home directory.
Part 2:
- In your user home directory create a file named tester.txt that contains the following lines without opening an editor:
happy tired sad funny
-
Add the following lines of code to the tester.txt file without opening an editor:
smile yawn cry laugh
- Sort the lines in the tester.txt file. Create another file named tester2.txt with the following lines:
dog cat mouse
- Create a file named big_tester.txt which is a sorted combination of tester1.txt and tester2.txt. Append a sorted list of users currently on the system to the big_tester.txt file, but do not sort the big_tester.txt file again. Rename your big_tester.txt file to YOUR_NAME_big_tester.txt (replacing YOUR_NAME with your first and last name). Move the YOUR_NAME_big_tester.txt to home/share.
Extensions
This extension covers the UNIX commands laid out in the 5th and 6th lessons of the UNIX Tutorial for Beginners.
- Create a unix_extension.txt file in your home directory that lists 3 files in home/share with both read and write permissions. Copy the test_permissions.txt file from home/share to your home directory. Remove the read permission from the test_permissions.txt file. Remove the test_permissions.txt file.
- Whenever you check jobs or processes in the following set of tasks, append them to the unix_extension.txt file. Run firefox in the background. Kill firefox and then run it again normally, but kill it while its in the foreground. Run firefox again but suspend it before it finishes loading. Check the jobs to see what it is doing. Then, move the suspended firefox job to run in the background. Kill firefox. Run it again, suspend it, and try making the suspended firefox process run in the foreground again. Suspend firefox and kill it while its in suspension. Now try to successfully make firefox run. Kill the process.
- Add a line to your unix_extensions.txt file which shows the amount of space left on your file system. Add another line which lists the amount of space used by the Test_Dir_Size folder in home/share. While your in home/share copy the test_compress.txt file to your home directory. Note the size of the file (you'll need to remember it). Compress the file and note the new file size. Add a line to the unix_extension.txt file that shows the difference in value between the original size and new size of test_compress.txt. Uncompress the file. Now zip the test_compress.txt file. Add another line to the end of the unix_extension.txt file which shows the difference in value between the original file size and zipped file size of test_compress.txt. Add a classification of all the files and directories in home/share to the end of unix_extension.txt. Finally, add the history of all the commands you've typed into your terminal that day to the end of the test_compress.txt file. Rename test_compress.txt to YOUR_NAME_test_compress.txt(replacing YOUR_NAME with your first and last name) and move YOUR_NAME_test_compress.txt to home/share.
Evaluation
| Components | Points |
|---|---|
| Completion of Activities | /7 |
| Show you can properly use basic UNIX commands to move around a UNIX environment | /3 |
| Total | /10 |