Lab05

.pdf

School

Langara College *

*We aren’t endorsed by this school

Course

1280

Subject

Statistics

Date

Apr 3, 2024

Type

pdf

Pages

3

Uploaded by raman16894

–Lab 05 – The UNIX File System (cont) Objective To figure out the commands on the UNIX terminal to complete the steps listed under The Task . Resources Needed PC with Ubuntu 20.04 LTS or higher installed, OR Ubuntu 20.04 LTS or higher installed in a VirtualBox or VMware virtual machine, OR A running instance of Ubuntu 20.04 LTS or higher on AWS About the Lab The purpose of this lab is for you to try some commands and observe their output and the command feedback (warning/error messages and so on) on the screen. The Task In this terminal session, you will practice the commands discussed in the lecture by creating directories and then manipulating files in the directories. 1. Open a new terminal and clear your command history using the command history -c . 2. Create a directory called memos in your HOME directory. mkdir memos 3. Create four directories named dir1 , dir2 , dir3 , and dir4 in your HOME directory using a single command. mkdir dir1 dir2 dir3 dir4 4. Download the files file-content.txt and file-content-add.txt from under Lab 5 in Brightspace to your HOME directory. 5. Use touch to create the empty files 1memo , 2memo , stat , stat1 , stat12 , and stat593 in a single command line in your HOME directory. touch 1memo 2memo stat stat12 stat593 6. Using the cat command, create a file called myfile in your HOME directory and add the text in file-content.txt to this file. cat file-content.txt > myfile 7. Display the contents of myfile on the terminal screen. Which CHAPTER(S) do you see in myfile ? vi myfile CHAPTER I 8. Using the cat command, append the text in file-content-add.txt to myfile . cat file-content-add.txt >> myfile 9. Display the contents of myfile on the terminal screen. Which CHAPTER(S) do you see in myfile now? vi myfile CHAPTER I and CHAPTER II 10. Using the cat command, append the following line to myfile . Which key did you use to signal the end of the input to cat ? THIS IS THE END OF MY TEXT. cat >> myfile Page 1 of 3
^ + D (ctrl + D in windows) 11. Copy myfile in your HOME directory to another file named large . cp myfile large 12. Create another name for the file large . ln large LRG 13. Using the name LRG , list two ways to open the file large in read-only mode using the vi editor. view LRG vi -R LRG 14. List two ways of displaying the number of lines in the large file on the terminal. cat -n large wc large What is the total number of lines? 467 15. Copy all files in your HOME directory to the memos directory. cp * memos (had to make a dir lab_home to avoid copying large amounts of data in HOME to memos) 16. List the contents of the memos directory. ls memos You would see that only the files from your HOME directory were copied to memos and not the directories. You would also have received a warning regarding this in step 15 when you tried to copy all files. 17. Now, while staying in your HOME directory, delete all files you just copied into memos . rm memos/* 18. Copy all files and directories in your HOME directory to the memos directory. cp -r * memos 19. Change to the memos directory. cd memos 20. Now go ahead and delete only the directories from the memos directory. (This step may require some creativity). rm -r */ 21. List the contents of the memos directory. You should see only the files you copied here. ls 22. Change the name of large to large.old . mv large large.old 23. While staying in the memos directory, use relative path to move large.old to your HOME directory. mv large.old ../../ 24. Change to your HOME directory. cd 25. List all files whose filenames start with the letter l . ls l* Which files do you see? large large.old since I named the proxy folder lab_home, its contents also show up: Page 2 of 3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help